:root {
  --bg: #1a1614;
  --surface: #231f1c;
  --surface-hover: #2d2724;
  --border: #3a332e;
  --text: #e8e0d8;
  --text-muted: #9a8e82;
  --accent: #c4956a;
  --accent-light: #d4a87a;
  --accent-dim: rgba(196, 149, 106, 0.15);
  --highlight: #e8c9a0;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header {
  text-align: center;
  padding: 32px 0 24px;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--highlight);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Steps */
.step {
  margin-bottom: 28px;
}

.step h2 {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Method Grid */
.method-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
  font-family: inherit;
}

.method-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--text);
}

.method-card.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-light);
}

.method-icon {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
}

.method-name {
  font-size: 0.65rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

/* Recipe Selector */
.recipe-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recipe-btn {
  padding: 8px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  transition: all 0.2s;
}

.recipe-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.recipe-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-light);
  font-weight: 500;
}

/* Input */
.input-row {
  display: flex;
  gap: 12px;
}

.input-group {
  flex: 1;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-with-unit {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color 0.2s;
}

.input-with-unit:focus-within {
  border-color: var(--accent);
}

.input-with-unit input[type="number"] {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 10px 0;
  outline: none;
  width: 60px;
  -moz-appearance: textfield;
}

.input-with-unit input[type="number"]::-webkit-inner-spin-button,
.input-with-unit input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.unit, .unit-prefix {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  user-select: none;
}

.unit-prefix {
  margin-right: 2px;
}

/* Range slider */
.input-with-unit input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  margin: 12px 8px 12px 0;
}

.input-with-unit input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 300;
}

/* Quick Presets */
.quick-presets {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.preset-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.preset-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* Roast Selector */
.roast-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 6px;
}

.roast-selector {
  display: flex;
  gap: 6px;
}

.roast-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 400;
  transition: all 0.2s;
  text-align: center;
}

.roast-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.roast-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent-light);
  font-weight: 500;
}

/* Results */
.results {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 8px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.results h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--highlight);
  margin-bottom: 2px;
}

.recipe-credit {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.recipe-source {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  font-style: italic;
}

/* Difficulty Badge */
.difficulty-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.difficulty-beginner {
  background: rgba(104, 180, 104, 0.15);
  color: #7cc87c;
  border: 1px solid rgba(104, 180, 104, 0.3);
}

.difficulty-intermediate {
  background: rgba(196, 149, 106, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(196, 149, 106, 0.3);
}

.difficulty-advanced {
  background: rgba(200, 100, 100, 0.15);
  color: #d48080;
  border: 1px solid rgba(200, 100, 100, 0.3);
}

/* Taste Tags */
.taste-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.taste-tag {
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
}

.result-cards {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.result-card {
  flex: 1;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
}

.result-card.highlight {
  background: var(--accent-dim);
}

.result-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.result-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.result-card.highlight .result-value {
  color: var(--highlight);
}

.result-unit {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Brew Params */
.brew-params {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.param {
  background: var(--bg);
  padding: 12px 10px;
  text-align: center;
}

.param-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.param-value {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

/* Pour Schedule */
.pour-schedule {
  margin-bottom: 20px;
}

.pour-schedule h3,
.tips h3 {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pour-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.pour-step:last-child {
  border-bottom: none;
}

.pour-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 42px;
  font-variant-numeric: tabular-nums;
}

.pour-detail {
  flex: 1;
}

.pour-action {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 400;
}

.pour-amount {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Tips */
.tips ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tips li {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}

.tips li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
}

/* Footer */
footer {
  text-align: center;
  padding: 32px 0 16px;
}

footer p {
  font-size: 0.7rem;
  color: var(--text-muted);
  max-width: 300px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Mobile */
@media (max-width: 480px) {
  .method-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .result-cards {
    flex-wrap: wrap;
  }

  .result-card {
    min-width: calc(50% - 4px);
  }

  .brew-params {
    grid-template-columns: 1fr;
  }

  .input-row {
    flex-direction: column;
    gap: 12px;
  }

  .results-header {
    flex-direction: column;
    gap: 8px;
  }
}
