* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, '맑은 고딕', sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  padding: 24px 16px 60px;
  color: #e0e0e0;
}

.container {
  max-width: 640px;
  margin: 0 auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 12px;
}
.header-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.subtitle {
  margin-top: 8px;
  color: #a0aec0;
  font-size: 0.95rem;
}

/* Formula box */
.formula-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  text-align: center;
}
.formula-box h3 {
  font-size: 0.9rem;
  color: #a0aec0;
  margin-bottom: 14px;
  text-align: left;
}
.formula {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 4px;
}
.frac .num {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.frac .den {
  color: #a0aec0;
}
.highlight {
  color: #f6ad55;
  font-weight: 600;
}
.coefficients {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.85rem;
  color: #a0aec0;
}
.coefficients b {
  color: #68d391;
}

/* Cards */
.card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}
.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Form elements */
.form-group {
  margin-bottom: 16px;
}
.form-group:last-child {
  margin-bottom: 0;
}
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #a0aec0;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input[type="number"],
select {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1rem;
  color: #fff;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
input[type="number"]:focus,
select:focus {
  border-color: #4299e1;
  background: rgba(66,153,225,0.1);
}
input[type="number"]::placeholder {
  color: #4a5568;
}
select option {
  background: #1a1a2e;
  color: #e0e0e0;
}

/* Gender buttons */
.gender-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.gender-btn {
  padding: 12px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #a0aec0;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.gender-btn:hover {
  border-color: #4299e1;
  color: #fff;
}
.gender-btn.active {
  border-color: #4299e1;
  background: rgba(66,153,225,0.2);
  color: #63b3ed;
}

/* Drink items */
.drink-item {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: rgba(0,0,0,0.2);
}
.drink-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.drink-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: #63b3ed;
}
.remove-btn {
  background: rgba(229,62,62,0.2);
  border: 1px solid rgba(229,62,62,0.4);
  color: #fc8181;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.remove-btn:hover {
  background: rgba(229,62,62,0.4);
}
.drink-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Add drink button */
.add-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 2px dashed rgba(255,255,255,0.2);
  background: transparent;
  color: #a0aec0;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}
.add-btn:hover {
  border-color: #4299e1;
  color: #63b3ed;
  background: rgba(66,153,225,0.05);
}

/* Time row */
.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.time-input {
  display: flex;
  align-items: center;
  gap: 8px;
}
.time-input input {
  flex: 1;
}
.time-input span {
  font-size: 0.9rem;
  color: #a0aec0;
  white-space: nowrap;
}

/* Calc button */
.calc-btn {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #3182ce, #2b6cb0);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 20px rgba(49,130,206,0.4);
}
.calc-btn:hover {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(49,130,206,0.5);
}
.calc-btn:active {
  transform: translateY(0);
}

/* Result card */
.result-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 28px 24px;
  backdrop-filter: blur(10px);
}
.result-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* BAC display */
.bac-display {
  text-align: center;
  margin-bottom: 20px;
  padding: 28px;
  border-radius: 16px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.05);
}
.bac-value {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  transition: color 0.3s;
}
.bac-label {
  font-size: 0.85rem;
  color: #a0aec0;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Status badge */
.status-badge {
  text-align: center;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 24px;
}
.status-safe { background: rgba(72,187,120,0.2); color: #68d391; border: 1px solid rgba(72,187,120,0.4); }
.status-warning { background: rgba(237,137,54,0.2); color: #f6ad55; border: 1px solid rgba(237,137,54,0.4); }
.status-danger { background: rgba(229,62,62,0.2); color: #fc8181; border: 1px solid rgba(229,62,62,0.4); }

.bac-color-safe { color: #68d391; }
.bac-color-warning { color: #f6ad55; }
.bac-color-danger { color: #fc8181; }

/* Detail section */
.detail-section {
  margin-bottom: 24px;
}
.detail-section h3,
.legal-section h3,
.sober-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.detail-grid {
  display: grid;
  gap: 8px;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  font-size: 0.9rem;
}
.detail-row .d-label { color: #a0aec0; }
.detail-row .d-value { color: #fff; font-weight: 600; }

/* Legal section */
.legal-section {
  margin-bottom: 24px;
}
.legal-grid {
  display: grid;
  gap: 8px;
}
.legal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
}
.legal-item.safe { background: rgba(72,187,120,0.1); border: 1px solid rgba(72,187,120,0.2); }
.legal-item.warning { background: rgba(237,137,54,0.1); border: 1px solid rgba(237,137,54,0.2); }
.legal-item.danger { background: rgba(229,62,62,0.1); border: 1px solid rgba(229,62,62,0.2); }
.legal-range { font-weight: 700; color: #fff; }
.legal-item.safe .legal-range { color: #68d391; }
.legal-item.warning .legal-range { color: #f6ad55; }
.legal-item.danger .legal-range { color: #fc8181; }
.legal-desc { color: #a0aec0; font-size: 0.85rem; }

/* Sober section */
.sober-section {
  margin-bottom: 24px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(66,153,225,0.1);
  border: 1px solid rgba(66,153,225,0.2);
}
.sober-section h3 { color: #63b3ed; }
.sober-time {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}

/* Disclaimer */
.disclaimer {
  font-size: 0.8rem;
  color: #718096;
  line-height: 1.6;
  padding: 14px;
  border-radius: 10px;
  background: rgba(0,0,0,0.2);
  border-left: 3px solid #4a5568;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-card {
  animation: fadeIn 0.4s ease;
}

@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  .bac-value { font-size: 2.8rem; }
  .drink-row { grid-template-columns: 1fr; }
  .time-row { grid-template-columns: 1fr; }
}
