:root {
  --cream: #FAF3E7;
  --ink: #2B2620;
  --basil: #1F3D2B;
  --basil-tint: #E4EBE0;
  --yolk: #F2B705;
  --yolk-tint: #FBEBBB;
  --tomato: #C1440E;
  --tomato-tint: #F3D9CC;
  --line: rgba(43, 38, 32, 0.12);

  --font-display: 'Fraunces', serif;
  --font-body: 'Work Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  position: relative;
  padding-bottom: 84px;
}

.view { display: none; padding: 20px 20px 24px; animation: fadein 0.25s ease; }
.view.active { display: block; }

@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  margin: 4px 0 8px;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--tomato);
  margin: 0 0 2px;
}

.muted { color: rgba(43,38,32,0.62); font-size: 0.95rem; line-height: 1.45; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.center { text-align: center; align-items: center; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  margin-top: 16px;
  box-shadow: 0 1px 2px rgba(43,38,32,0.04);
}

/* Loading */
.loading-wrap {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.pasta-spinner svg { width: 90px; height: 90px; }
.pasta-spinner path {
  fill: none;
  stroke: var(--yolk);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 40 20;
  animation: dash 1.1s linear infinite;
}
@keyframes dash { to { stroke-dashoffset: -120; } }

/* Forms */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(43,38,32,0.7);
  font-weight: 500;
}
input[type="text"] {
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  outline: none;
}
input[type="text"]:focus {
  border-color: var(--basil);
  outline: 2px solid var(--yolk);
  outline-offset: 1px;
}

.person-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.color-pick { display: flex; gap: 8px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.yolk { background: var(--yolk); }
.swatch.basil { background: var(--basil); }
.swatch.tomato { background: var(--tomato); }
.swatch.selected { border-color: var(--ink); }

.btn-primary {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  background: var(--basil);
  color: var(--cream);
  border: none;
  border-radius: 14px;
  padding: 15px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:hover { background: #16301f; }

.icon-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink);
  padding: 8px;
  border-radius: 10px;
}
.icon-btn:hover { background: var(--basil-tint); }

.hidden { display: none !important; }
.error { color: var(--tomato); font-size: 0.88rem; }

/* Login */
.profile-list { display: flex; flex-direction: column; gap: 10px; }
.profile-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--cream);
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: var(--font-display);
}
.profile-item .dot { width: 14px; height: 14px; border-radius: 50%; }
.profile-item .dot.yolk { background: var(--yolk); }
.profile-item .dot.basil { background: var(--basil); }
.profile-item .dot.tomato { background: var(--tomato); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}
.page-title {
  font-size: 1.2rem;
  margin: 0;
}

/* Today card */
.today-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.streak-pill {
  background: var(--yolk-tint);
  border-radius: 999px;
  padding: 6px 12px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-mono);
}
.streak-pill #streak-num { font-weight: 700; font-size: 1.1rem; color: var(--tomato); }
.streak-label { font-size: 0.65rem; color: rgba(43,38,32,0.6); text-transform: uppercase; letter-spacing: 0.04em; }

.linguine-progress { margin: 18px 0 10px; }
.linguine-progress svg { width: 100%; height: 36px; display: block; }
#linguine-track { fill: none; stroke: var(--line); stroke-width: 5; stroke-linecap: round; }
#linguine-fill { fill: none; stroke: var(--yolk); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }

/* Tabbar */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(43,38,32,0.5);
  padding: 8px 2px;
  border-radius: 10px;
  cursor: pointer;
}
.tab.active { color: var(--basil); background: var(--basil-tint); }

/* Duel */
.duel-card { text-align: center; }
.turn-indicator {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--tomato-tint);
  color: var(--tomato);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
}
.prompt-en {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  margin: 18px 0 6px;
}
.tts-btn { font-size: 1.5rem; margin-bottom: 14px; }
.answer-input {
  width: 100%;
  text-align: center;
  font-size: 1.15rem;
  margin-bottom: 14px;
}
.feedback {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  font-weight: 600;
}
.feedback.correct { background: var(--basil-tint); color: var(--basil); }
.feedback.wrong { background: var(--tomato-tint); color: var(--tomato); }
.feedback .answer-reveal { display: block; font-family: var(--font-display); font-size: 1.2rem; margin-top: 4px; }

.phrase-of-day {
  font-family: var(--font-display);
  font-size: 1.7rem;
  background: var(--yolk-tint);
  padding: 20px;
  border-radius: 16px;
  margin: 8px 0;
}

/* Deck grid */
.deck-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.deck-tile {
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  border: 1px solid var(--line);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.deck-tile.yolk { background: var(--yolk-tint); }
.deck-tile.basil { background: var(--basil-tint); }
.deck-tile.tomato { background: var(--tomato-tint); }
.deck-tile h3 { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 4px; }
.deck-tile p { font-size: 0.78rem; color: rgba(43,38,32,0.65); margin: 0; }
.deck-tile .count { font-family: var(--font-mono); font-size: 0.7rem; margin-top: 8px; opacity: 0.7; }

/* Phrase list (deck detail) */
.phrase-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.phrase-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.phrase-row .it { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.phrase-row .en { font-size: 0.8rem; color: rgba(43,38,32,0.6); }
.phrase-row button { background: none; border: none; font-size: 1.1rem; cursor: pointer; }

/* Trip log */
.trip-intro { margin-top: 14px; }
.trip-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.trip-item .it { font-family: var(--font-display); font-weight: 600; }
.trip-item .meta { font-family: var(--font-mono); font-size: 0.7rem; color: rgba(43,38,32,0.5); margin-top: 4px; }
