/* ============================================================
   PourCraft — Editorial Zine PWA
   Warm cafe paper palette, Fraunces serif + Inter sans
   ============================================================ */

:root {
  /* Light mode (warm cafe paper) */
  --bg: #FBF3E5;
  --surface: #FFF8EC;
  --surface2: #F0E6D0;
  --ink: #2A1F1B;
  --muted: #6B5239;
  --muted-soft: #8A6F52;
  --accent: #B87333;
  --on-accent: #FFF8EC;
  --rule: rgba(42, 31, 27, 0.18);
  --rule-strong: rgba(42, 31, 27, 0.85);
  --chip: rgba(184, 115, 51, 0.12);
  --chip-strong: rgba(184, 115, 51, 0.18);
  --bloom-orange: #C5794F;
  --sage: #7F9B78;

  /* Layout */
  --radius-row: 14px;
  --radius-card: 18px;
  --radius-control: 12px;
  --tab-bar-height: 64px;
  --content-max: 720px;

  /* Type */
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --bg: #221915;
  --surface: #2C211C;
  --surface2: #352721;
  --ink: #F0E6D6;
  --muted: #C4A88A;
  --muted-soft: #A38A6E;
  --accent: #D4935A;
  --on-accent: #221915;
  --rule: rgba(240, 230, 214, 0.20);
  --rule-strong: rgba(240, 230, 214, 0.65);
  --chip: rgba(212, 147, 90, 0.16);
  --chip-strong: rgba(212, 147, 90, 0.24);
}

/* ============================================================
   Reset & Base
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.3s ease, color 0.3s ease;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* ============================================================
   App Shell
   ============================================================ */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}

.status-bar {
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding-bottom: calc(var(--tab-bar-height) + 24px);
}

/* ============================================================
   Tab Bar
   ============================================================ */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  transition: color 0.2s ease;
  position: relative;
}

.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active::before {
  width: 28px;
}

.tab-icon {
  width: 22px;
  height: 22px;
  display: block;
  font-size: 18px;
  line-height: 22px;
  text-align: center;
}

.tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ============================================================
   Typography helpers
   ============================================================ */
.kicker {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.micro {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============================================================
   Masthead / Headers
   ============================================================ */
.masthead {
  padding: 24px 24px 0;
}

.masthead-title {
  font-family: var(--serif);
  font-size: 46px;
  font-weight: 400;
  letter-spacing: -1.5px;
  line-height: 1.05;
  color: var(--ink);
}

.masthead-title em {
  font-style: italic;
  color: var(--accent);
}

.masthead-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

.sub-header {
  padding: 24px 24px 0;
}

.sub-header-title {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -1px;
  line-height: 1.1;
  color: var(--ink);
}

.sub-header-title em {
  font-style: italic;
  color: var(--accent);
}

.sub-header-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.sub-header-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

/* ============================================================
   Sections
   ============================================================ */
.section {
  padding: 0 24px;
  margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.section-number {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.3px;
}

.section-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.4px;
  color: var(--ink);
  white-space: nowrap;
}

.section-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 18px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.card-pad-0 { padding: 0; }

/* ============================================================
   Rule (divider)
   ============================================================ */
.rule {
  height: 1px;
  background: var(--rule);
  margin: 14px 0;
}

.rule-strong {
  height: 2px;
  background: var(--rule-strong);
  margin: 18px 0 2px;
}

/* ============================================================
   Roast rows
   ============================================================ */
.roast-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roast-row {
  display: flex;
  align-items: stretch;
  text-align: left;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-row);
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.roast-row.selected {
  background: var(--chip);
  border-color: rgba(184, 115, 51, 0.42);
}

.roast-row .accent-bar {
  width: 3px;
  background: transparent;
  margin: 12px 0;
  border-radius: 2px;
  flex-shrink: 0;
}

.roast-row.selected .accent-bar {
  background: var(--accent);
}

.roast-row-content {
  flex: 1;
  padding: 12px 12px 12px 14px;
}

.roast-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.roast-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.roast-descriptor {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.roast-ratio {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
  margin-left: auto;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.roast-flavor {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 4px;
  display: block;
}

/* ============================================================
   Dose input
   ============================================================ */
.dose-display {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dose-number-wrap {
  display: flex;
  align-items: baseline;
}

.dose-number {
  font-family: var(--serif);
  font-size: 76px;
  font-weight: 400;
  letter-spacing: -3px;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.dose-unit {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--muted);
  margin-left: 6px;
}

.dose-steppers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  color: var(--ink);
  font-size: 20px;
  font-weight: 400;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.stepper-btn:disabled {
  opacity: 0.35;
}

.stepper-btn:active {
  background: var(--surface2);
}

/* Ruler slider */
.dose-ruler {
  position: relative;
  height: 34px;
  margin: -2px 0 10px;
  touch-action: none;
  cursor: pointer;
}

.ruler-ticks {
  display: flex;
  align-items: flex-start;
  height: 18px;
  width: 100%;
}

.ruler-tick {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

.ruler-tick::before {
  content: '';
  width: 1px;
  height: 9px;
  background: var(--ink);
  opacity: 0.35;
}

.ruler-tick.major::before {
  height: 18px;
  opacity: 0.85;
}

.ruler-marker {
  position: absolute;
  top: -6px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--accent);
  transform: translateX(-7px);
  transition: left 0.15s ease;
  pointer-events: none;
}

.dose-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 13px;
}

.dose-ratio-text {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
}

.dose-ratio-text strong {
  font-family: var(--serif);
  font-style: normal;
  font-weight: 500;
  color: var(--accent);
}

.dose-range {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ============================================================
   Pour block
   ============================================================ */
.pour-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
}

.pour-line:first-child { padding-top: 0; }
.pour-line:last-child { padding-bottom: 0; }

.pour-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink);
}

.pour-label.big {
  font-size: 18px;
}

.pour-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

.pour-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.pour-value .num {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -1px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pour-value.big .num {
  font-size: 36px;
}

.pour-value .unit {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
}

.pour-value.big .unit {
  font-size: 16px;
}

.temp-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.temp-picker-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
}

.segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.segmented button {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.segmented button.active {
  background: var(--accent);
  color: var(--on-accent);
}

/* ============================================================
   Begin brew CTA
   ============================================================ */
.begin-brew {
  margin-top: 24px;
  padding: 0 24px;
}

.begin-brew-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-card);
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.2px;
  transition: opacity 0.2s ease, transform 0.1s ease;
}

.begin-brew-btn:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.begin-brew-btn .btn-icon {
  font-size: 18px;
}

.save-preset {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.save-preset-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.save-preset-btn.saved {
  background: var(--chip);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   Grind tab — 1Zpresso K-Ultra
   ============================================================ */
.grind-hero {
  text-align: center;
  padding: 20px 24px 0;
}

.grind-hero-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.grind-hero-sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.grind-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 0;
}

.grind-dial-ring {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--surface);
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.grind-dial-ring .clicks {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 500;
  letter-spacing: -2px;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.grind-dial-ring .clicks-unit {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--muted);
  margin-top: 4px;
}

.grind-dial-ring .clicks-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}

.grind-click-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.grind-click-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rule);
}

.grind-click-dot.filled {
  background: var(--accent);
}

.grind-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.grind-ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-size: 24px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.grind-ctrl-btn:active {
  background: var(--surface2);
}

.grind-ctrl-btn:disabled {
  opacity: 0.35;
}

.grind-settings {
  width: 100%;
  padding: 24px 24px 0;
}

.grind-setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.grind-setting-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
  width: 90px;
}

.grind-setting-value {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  flex-shrink: 0;
  width: 50px;
  text-align: center;
}

.grind-setting-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: var(--rule);
  outline: none;
  cursor: pointer;
}

.grind-setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--on-accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.grind-setting-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--on-accent);
  cursor: pointer;
}

.grind-presets {
  width: 100%;
  padding: 24px 24px 0;
}

.grind-presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.grind-preset-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-row);
  padding: 16px;
  margin-bottom: 10px;
}

.grind-preset-card .preset-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
}

.grind-preset-card .preset-details {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
}

.grind-preset-card .preset-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.grind-preset-card .preset-actions button {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--rule);
  color: var(--ink);
  transition: background 0.2s ease;
}

.grind-preset-card .preset-actions button.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.grind-preset-card .preset-actions button.delete {
  color: #B33A3A;
  background: rgba(179, 58, 58, 0.08);
  border-color: rgba(179, 58, 58, 0.2);
}

/* Taste adjust section */
.taste-adjust {
  width: 100%;
  padding: 24px 24px 0;
}

.taste-adjust-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 18px;
}

.taste-adjust-header {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.taste-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.taste-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-row);
  border: 1px solid var(--rule);
  background: var(--surface);
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.taste-btn:active {
  background: var(--chip);
}

.taste-btn .taste-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.taste-btn .taste-text-wrap {
  flex: 1;
}

.taste-btn .taste-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}

.taste-btn .taste-desc {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.taste-btn .taste-arrow {
  font-size: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

/* Grind history */
.grind-history {
  width: 100%;
  padding: 24px 24px 48px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-row {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-row);
  padding: 14px 16px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.history-row .history-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.history-row .history-coffee {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-row .history-grind {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

.history-row .history-meta {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.history-row .history-note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink);
  margin-top: 6px;
  line-height: 1.5;
  opacity: 0.85;
}

.empty-state {
  text-align: center;
  padding: 32px 0;
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.empty-state .empty-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
}

.empty-state .empty-desc {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* ============================================================
   Guide tab
   ============================================================ */
.recipe-summary {
  margin-top: 18px;
  padding: 0 24px;
}

.summary-cells {
  display: flex;
  gap: 0;
  margin-top: 10px;
}

.summary-cell {
  flex: 1;
  text-align: left;
}

.summary-cell .key {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-cell .value {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Timer */
.timer-strip {
  margin-top: 14px;
  padding: 0 24px;
}

.timer-display {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.timer-elapsed-wrap {
  text-align: left;
}

.timer-elapsed {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -1px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.timer-target-wrap {
  text-align: right;
}

.timer-phase {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.timer-phase.active {
  color: var(--accent);
}

.timer-target {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.timer-progress-wrap {
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.timer-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s linear;
}

.timer-instruction {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}

.timer-buttons {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}

.timer-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-control);
  font-size: 15px;
  font-weight: 500;
  font-family: var(--serif);
  transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.timer-btn.solid {
  background: var(--accent);
  color: var(--on-accent);
}

.timer-btn.solid:disabled {
  opacity: 0.4;
}

.timer-btn.ghost {
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
}

.timer-btn.ghost:active {
  background: var(--surface2);
}

/* Guide steps */
.steps-section {
  margin-top: 24px;
  padding: 0 24px;
}

.steps-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.step-row {
  width: 100%;
  display: flex;
  align-items: stretch;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-row);
  overflow: hidden;
  margin-bottom: 8px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.step-row.active {
  background: var(--chip);
  border-color: rgba(184, 115, 51, 0.42);
}

.step-row .accent-bar {
  width: 3px;
  background: transparent;
  margin: 14px 0;
  border-radius: 2px;
  flex-shrink: 0;
}

.step-row.active .accent-bar {
  background: var(--accent);
}

.step-number {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -1.5px;
  color: var(--ink);
  width: 44px;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.step-row.active .step-number {
  color: var(--accent);
}

.step-content {
  flex: 1;
  padding: 14px 12px 14px 0;
  min-width: 0;
}

.step-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.step-icon {
  font-size: 16px;
  color: var(--ink);
  transition: color 0.2s ease;
}

.step-row.active .step-icon {
  color: var(--accent);
}

.step-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.step-meta {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.step-body {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
  max-height: 0;
  overflow: hidden;
  opacity: 0.85;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.step-row.active .step-body {
  max-height: 200px;
  margin-top: 6px;
}

.step-chevron {
  font-size: 14px;
  color: var(--muted);
  padding: 14px 16px 0 8px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.step-row.active .step-chevron {
  transform: rotate(90deg);
}

/* Outro */
.outro-quote {
  text-align: center;
  padding: 28px 24px 0;
}

.outro-quote .quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  margin-top: 16px;
}

.outro-quote .attribution {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* ============================================================
   Tips tab
   ============================================================ */
.tips-intro {
  padding: 18px 24px 0;
}

.tips-intro-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  letter-spacing: -0.4px;
  color: var(--ink);
  line-height: 1.4;
}

.contents-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px 0;
}

.contents-header .line {
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.contents-header .count {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--muted);
  white-space: nowrap;
}

.tips-list {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.tip-row {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-row);
  padding: 16px 14px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.tip-row:active {
  background: var(--chip);
}

.tip-number {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -1px;
  color: var(--accent);
  width: 38px;
  flex-shrink: 0;
}

.tip-content {
  flex: 1;
  min-width: 0;
}

.tip-category {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.tip-title {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.3px;
  color: var(--ink);
  line-height: 1.2;
  margin-top: 3px;
}

.tip-dek {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 3px;
}

.tip-chevron {
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 14px;
}

.tips-end {
  text-align: center;
  padding: 20px 24px;
}

.tips-end .end-mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--muted);
  margin-top: 18px;
}

/* Tip detail */
.tip-back {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

.tip-detail {
  padding: 0 24px;
  max-width: var(--content-max);
  margin: 0 auto;
}

.tip-detail .tip-detail-header {
  padding-top: 20px;
}

.tip-detail .tip-detail-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -1px;
  line-height: 1.15;
  color: var(--ink);
  margin-top: 6px;
}

.tip-detail .tip-pull-quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 23px;
  letter-spacing: -0.3px;
  line-height: 1.4;
  color: var(--ink);
  padding: 24px 0 18px;
}

.tip-detail .tip-body-text {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 16px;
}

.tip-references {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-top: 24px;
}

.tip-references .ref-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.ref-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
}

.ref-key {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.ref-dots {
  flex: 1;
  border-bottom: 1px dotted var(--rule);
  height: 1px;
}

.ref-value {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-align: right;
}

.tip-next {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s ease;
}

.tip-next:hover {
  background: var(--chip);
}

/* ============================================================
   About tab
   ============================================================ */
.manifesto {
  padding: 24px 24px 0;
}

.manifesto-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  letter-spacing: -0.4px;
  line-height: 1.5;
  color: var(--ink);
}

.about-body {
  padding: 18px 24px 0;
}

.about-body-text {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
}

.settings-section {
  padding: 32px 24px 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 44px;
}

.setting-row .setting-label {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}

.setting-row .setting-value {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  min-height: 44px;
  cursor: pointer;
}

.toggle-row .toggle-label {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}

.toggle-switch {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--rule);
  position: relative;
  transition: background 0.2s ease;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.on {
  background: var(--accent);
}

.toggle-switch.on::after {
  transform: translateX(18px);
  background: var(--on-accent);
}

.chevron-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  min-height: 44px;
  width: 100%;
  text-align: left;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  cursor: pointer;
}

.chevron-row .chevron {
  font-size: 14px;
  color: var(--muted);
}

.credit-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  min-height: 44px;
}

.credit-row .credit-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.credit-row .credit-dots {
  flex: 1;
  border-bottom: 1px dotted var(--rule);
  height: 1px;
}

.credit-row .credit-person {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
}

.about-footer {
  text-align: center;
  padding: 32px 24px 0;
}

.about-footer .footer-mark {
  font-size: 28px;
  color: var(--accent);
}

.about-footer .footer-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 8px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.about-footer .footer-version {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 14px;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(var(--tab-bar-height) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 200;
  max-width: calc(100vw - 48px);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Wide layout (tablet+)
   ============================================================ */
@media (min-width: 700px) {
  .tab-bar {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--rule);
    border-right: 1px solid var(--rule);
    border-radius: 16px 16px 0 0;
  }

  .content {
    max-width: 720px;
    margin: 0 auto;
  }
}

@media (min-width: 900px) {
  .content {
    padding-bottom: 24px;
  }
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-content {
  animation: fadeInUp 0.3s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.timer-phase.active.running {
  animation: pulse 1.5s ease infinite;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}