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

:root {
  --cream: #F5F0E6;
  --cream-dark: #EBE4D6;
  --ink: #2C2416;
  --ink-light: #5C4D3C;
  --ink-faint: #73685A;
  --vermillion: #C2553A;
  --vermillion-light: #D4735A;
  --gold: #B8A070;
  --gold-light: #D4C49C;
  --forest: #4A7C59;
  --forest-light: #6B9E78;
  --paper-white: #FAF7F0;
  --divider: linear-gradient(90deg, transparent, var(--gold-light), transparent);
  --hm-0: #EDF3ED;
  --hm-1: #C5DDC8;
  --hm-2: #8FBA96;
  --hm-3: #6A9876;
  --hm-4: #4A7C59;
}

html, body { height: 100%; }

body {
  background: linear-gradient(180deg, var(--cream) 0%, #F2ECDF 50%, var(--cream) 100%);
  color: var(--ink);
  font-family: 'Crimson Pro', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* Screen system */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.screen.active { opacity: 1; pointer-events: auto; }

@keyframes incorrect-flash {
  0%   { opacity: 0.18; }
  100% { opacity: 0; }
}
body.incorrect-flash::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--vermillion);
  pointer-events: none;
  z-index: 999;
  animation: incorrect-flash 0.35s ease-out forwards;
}

/* Hanko stamp */
.hanko {
  position: absolute;
  top: 2.5rem;
  right: 3rem;
  width: 52px;
  height: 52px;
  border: 2.5px solid var(--vermillion);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Shippori Mincho B1', serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--vermillion);
  opacity: 0.4;
  transform: rotate(-3deg);
  writing-mode: vertical-rl;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease,
              box-shadow 0.3s ease,
              font-size 0.25s ease;
}
.hanko:hover {
  transform: rotate(0deg);
  opacity: 0.65;
}

/* Streak levels — applied to .hanko when streak is active */
.hanko--streak {
  writing-mode: horizontal-tb;
}
.hanko--streak-1 {
  opacity: 0.65;
  box-shadow: 0 0 12px rgba(194, 85, 58, 0.12);
}
.hanko--streak-2 {
  opacity: 0.8;
  font-size: 1.4rem;
  box-shadow: 0 0 20px rgba(194, 85, 58, 0.18),
              0 0 40px rgba(194, 85, 58, 0.08);
}
.hanko--streak-3 {
  opacity: 0.95;
  font-size: 1.5rem;
  box-shadow: 0 0 25px rgba(194, 85, 58, 0.28),
              0 0 50px rgba(194, 85, 58, 0.14),
              0 0 80px rgba(194, 85, 58, 0.06);
}
.hanko--streak-4 {
  opacity: 1;
  font-size: 1.5rem;
  box-shadow: 0 0 30px rgba(194, 85, 58, 0.35),
              0 0 60px rgba(194, 85, 58, 0.2),
              0 0 100px rgba(194, 85, 58, 0.1);
  animation: streak-pulse 2.5s ease-in-out infinite;
}
.hanko--streak-4:hover {
  opacity: 1;
}
.hanko--stamp {
  animation: streak-stamp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hanko--streak-4.hanko--stamp {
  animation: streak-stamp 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
             streak-pulse 2.5s ease-in-out infinite 0.45s;
}
.hanko--bounce {
  animation: streak-bounce 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes streak-stamp {
  0%   { transform: rotate(-3deg) scale(1.6); opacity: 0.4; }
  35%  { transform: rotate(-1deg) scale(0.9); }
  65%  { transform: rotate(-4deg) scale(1.08); }
  100% { transform: rotate(-3deg) scale(1); opacity: 1; }
}
@keyframes streak-bounce {
  0%   { transform: rotate(-3deg) scale(1); }
  50%  { transform: rotate(-3deg) scale(1.15); }
  100% { transform: rotate(-3deg) scale(1); }
}
@keyframes streak-pulse {
  0%, 100% {
    box-shadow: 0 0 30px rgba(194, 85, 58, 0.35),
                0 0 60px rgba(194, 85, 58, 0.2),
                0 0 100px rgba(194, 85, 58, 0.1);
  }
  50% {
    box-shadow: 0 0 35px rgba(194, 85, 58, 0.45),
                0 0 70px rgba(194, 85, 58, 0.25),
                0 0 110px rgba(194, 85, 58, 0.14);
  }
}

/* Progress */
.progress {
  position: absolute;
  top: 2.8rem;
  left: 3rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
}

/* Katakana word */
.word {
  font-family: 'Shippori Mincho B1', serif;
  font-size: clamp(4rem, 10vw, 8rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin-bottom: 3rem;
  position: relative;
}
.word::after {
  content: '';
  position: absolute;
  bottom: -1.2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: var(--divider);
}

/* Input */
.input-area {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  min-height: 4rem;
  margin-bottom: 0.8rem;
}
/* Transparent, focusable field that lets mobile browsers raise the soft
   keyboard. Not display:none/visibility:hidden — those are unfocusable on iOS.
   font-size:16px stops iOS zooming the viewport when it gains focus. */
.input-capture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-size: 16px;
  text-align: center;
}
.input-text {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 400;
  line-height: 1;
  color: var(--ink-light);
  letter-spacing: 0.08em;
  text-align: center;
}
.cursor {
  display: inline-block;
  width: 2px;
  height: 2.6rem;
  background: var(--vermillion);
  margin-left: 2px;
  animation: blink 1s ease-in-out infinite;
  position: relative;
  top: 0.25rem;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.input-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* Shortcuts */
.shortcuts {
  position: absolute;
  bottom: 2.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  color: var(--ink-faint);
}
.shortcut { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.shortcut:hover kbd { background: var(--cream-dark); }
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 1.8rem;
  padding: 0.2rem 0.5rem;
  background: var(--paper-white);
  border: 1px solid var(--gold-light);
  border-radius: 3px;
  color: var(--ink-light);
  box-shadow: 0 1px 0 var(--cream-dark);
}
@keyframes kbd-flash {
  0%   { background: var(--cream-dark); }
  100% { background: var(--paper-white); }
}
kbd.flash { animation: kbd-flash 0.3s ease-out; }

/* ============================================
   FEEDBACK SCREEN
   ============================================ */
.fb-answer {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  letter-spacing: 0.08em;
  margin-top: 1em;
  margin-bottom: 0.5rem;
  animation: fadeUp 0.25s ease-out;
}
.fb-answer.correct { color: var(--forest); font-weight: 500; }

.fb-answer .ch {
  position: relative;
  display: inline-block;
  padding: 0 0.1em;
  min-width: 0.6em;
}
.fb-answer .ch.ok { color: var(--ink-light); }
.fb-answer .ch.wrong,
.fb-answer .ch.extra {
  color: var(--vermillion);
  text-decoration: line-through;
  text-decoration-color: var(--vermillion-light);
  text-decoration-thickness: 1.5px;
}
.fb-answer .ch.missing {
  color: transparent;
  border-bottom: 1px dashed var(--vermillion-light);
}
.fb-answer .ch[data-correct]::after {
  content: attr(data-correct);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.15em;
  font-size: 0.55em;
  font-weight: 500;
  color: var(--forest);
  text-decoration: none;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.fb-definition {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 500;
  font-style: normal;
  color: var(--ink-light);
  letter-spacing: 0.01em;
  margin-bottom: 0.8rem;
  animation: fadeUp 0.3s ease-out 0.1s both;
}

.enter-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   SUMMARY SCREEN
   ============================================ */
.summary-card {
  background: var(--paper-white);
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(44, 36, 22, 0.07);
  padding: 3rem 2.5rem;
  max-width: 560px;
  width: 100%;
  animation: fadeUp 0.35s ease-out;
}

.summary-title {
  font-family: 'Shippori Mincho B1', serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2.5rem;
  text-align: center;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.stat { text-align: center; }
.stat__value {
  font-family: 'Shippori Mincho B1', serif;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.stat__value--accent { color: var(--forest); }
.stat__label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.summary-streak {
  text-align: center;
  margin-top: 0.8rem;
  font-family: 'Shippori Mincho B1', serif;
  font-size: 1.1rem;
  color: var(--vermillion);
  letter-spacing: 0.08em;
  animation: fadeUp 0.3s ease-out 0.05s both;
}

.summary-divider {
  height: 1px;
  background: var(--divider);
  margin: 1.5rem 0;
}

.missed-title {
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-faint);
  margin-bottom: 1rem;
  text-align: center;
}
.missed-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  margin-bottom: 2rem;
}
.missed-word {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.9rem;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: 4px;
}
.missed-word__kana {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.1rem;
}
.missed-word__reading {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  color: var(--ink-faint);
}
.perfect-msg {
  text-align: center;
  font-family: 'Crimson Pro', serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--forest);
  margin-bottom: 2rem;
}

.summary-shortcuts {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  color: var(--ink-faint);
}
.summary-shortcuts .shortcut {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Tier indicator */
.tier-indicator {
  text-align: center;
  margin-top: 1.2rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/* ============================================
   PROGRESS SCREEN
   ============================================ */
.progress-tiers {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.progress-tier {
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: fadeUp 0.3s ease-out both;
}

.progress-tier__label {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  color: var(--ink-light);
  min-width: 3.5rem;
}

.progress-tier__bar {
  flex: 1;
  height: 8px;
  background: var(--cream-dark);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.progress-tier__fill {
  height: 100%;
  transition: width 0.4s ease;
}
.progress-tier__fill--mastered { background: var(--forest); }
.progress-tier__fill--progress { background: var(--gold); }

.progress-tier__count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--ink-faint);
  min-width: 5rem;
  text-align: right;
}

.progress-tier--locked { opacity: 0.45; }
.progress-tier--locked .progress-tier__count { font-style: italic; }

.progress-loading {
  text-align: center;
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-faint);
  padding: 2rem 0;
}

/* ============================================
   MOBILE BUTTONS
   ============================================ */
.mobile-buttons,
.mobile-utils {
  display: none;
}

.mobile-btn {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--gold-light);
  border-radius: 4px;
  background: var(--paper-white);
  color: var(--ink-light);
  cursor: pointer;
  transition: background 0.15s ease;
}
.mobile-btn:active {
  background: var(--cream-dark);
}
.mobile-btn.primary {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.mobile-btn.primary:active {
  background: var(--ink-light);
}

.mobile-util-btn {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--gold-light);
  border-radius: 4px;
  background: var(--paper-white);
  color: var(--ink-light);
  cursor: pointer;
  transition: background 0.15s ease;
}
.mobile-util-btn:active {
  background: var(--cream-dark);
}

/* Auth indicator */
.auth-indicator {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.auth-link {
  color: var(--ink-faint);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}
.auth-link:hover { opacity: 1; color: var(--gold); }

/* Auth pages (login / inbox confirmation) */
.auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  overflow-y: auto;
}
.auth-card {
  width: 100%;
  max-width: 28rem;
  background: var(--paper-white);
  border: 1px solid var(--cream-dark);
  border-radius: 6px;
  padding: 3rem 2.5rem 2.5rem;
  text-align: center;
  position: relative;
  box-shadow: 0 1px 2px rgba(44, 36, 22, 0.04);
}
.auth-card .hanko {
  position: static;
  margin: 0 auto 1.5rem;
  transform: rotate(-3deg);
  opacity: 0.55;
}
.auth-card .hanko:hover {
  transform: rotate(0deg);
  opacity: 0.7;
}
.auth-title {
  font-family: 'Shippori Mincho B1', serif;
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--ink);
  margin-bottom: 0.6rem;
}
.auth-sub {
  color: var(--ink-light);
  font-size: 1rem;
  line-height: 1.55;
  margin-bottom: 1rem;
}
.auth-sub--muted {
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin-top: 1.5rem;
  margin-bottom: 0;
}
.auth-sub a {
  color: var(--vermillion);
  text-decoration: none;
}
.auth-sub a:hover {
  text-decoration: underline;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.auth-input {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--cream-dark);
  border-radius: 4px;
  background: var(--cream);
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.auth-input:focus {
  outline: none;
  border-color: var(--gold);
}
.auth-submit {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.9rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: var(--ink);
  color: var(--cream);
  cursor: pointer;
  transition: background 0.15s ease;
}
.auth-submit:hover {
  background: var(--ink-light);
}
.auth-error {
  background: rgba(194, 85, 58, 0.08);
  border: 1px solid rgba(194, 85, 58, 0.25);
  color: var(--vermillion);
  font-size: 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .auth-card {
    padding: 2.5rem 1.75rem 2rem;
  }
  .shortcuts,
  .summary-shortcuts,
  .enter-hint {
    display: none;
  }

  .mobile-buttons {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 1.5rem;
  }

  .mobile-utils {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 1rem;
  }

  .hanko {
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .progress {
    top: 1.8rem;
    left: 1.5rem;
    font-size: 0.75rem;
  }

  .screen {
    padding: 2rem 1.5rem;
  }

  .summary-card {
    padding: 2rem 1.5rem;
  }

  .auth-indicator { bottom: 1rem; right: 1rem; font-size: 0.65rem; }
}

/* ============================================
   PROGRESS SCREEN (redesigned)
   ============================================ */

/* Make the progress screen scrollable instead of vh-centered. */
#progress-screen {
  align-items: flex-start;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 3rem 2rem 4rem;
}

.progress-page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

.progress-page__header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.progress-page__title {
  font-family: 'Shippori Mincho B1', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.progress-page__title::after {
  content: '';
  display: block;
  width: 80px;
  height: 1px;
  background: var(--divider);
  margin: 1rem auto 0;
}

.progress-card {
  background: var(--paper-white);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  box-shadow: 0 2px 16px rgba(44, 36, 22, 0.05);
  padding: 1.8rem 2rem;
  margin-bottom: 1.4rem;
}
.progress-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  margin-bottom: 1.4rem;
}
.progress-card-row .progress-card { margin-bottom: 0; }

.progress-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.1rem;
}

.progress-hero .hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.progress-hero .hero-divider {
  height: 1px;
  background: var(--divider);
  margin: 1.6rem 0 1.2rem;
}
.progress-hero .hero-lower {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}
.progress-hero .hero-streak {
  text-align: center;
}
.stat__value--streak {
  color: var(--vermillion);
  font-feature-settings: "tnum";
}

/* List rows shared by weak words / slow words / confusables */
.progress-list { display: flex; flex-direction: column; }
.progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--cream-dark);
}
.progress-row:last-child { border-bottom: none; }
.progress-row__kana {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.progress-row__meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.progress-row__meta strong { font-weight: 500; color: var(--ink-light); }

/* Character grid */
.progress-char-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.45rem;
}
.progress-char {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Shippori Mincho B1', serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
  gap: 0.15rem;
  line-height: 1;
}
.progress-char__pct {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  color: var(--ink-faint);
  font-weight: 400;
  letter-spacing: 0.04em;
}
.progress-char--bad { background: rgba(194, 85, 58, 0.08); border-color: rgba(194, 85, 58, 0.18); }
.progress-char--bad .progress-char__pct { color: var(--vermillion); }
.progress-char--mid { background: rgba(184, 160, 112, 0.1); border-color: rgba(184, 160, 112, 0.22); }
.progress-char--mid .progress-char__pct { color: var(--gold); }

/* Confusable row variation */
.progress-confusable__pair {
  font-family: 'Shippori Mincho B1', serif;
  font-size: 1.4rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.progress-confusable__pair .arrow {
  color: var(--ink-faint);
  font-size: 0.95rem;
  margin: 0 0.5rem;
  font-family: 'Crimson Pro', serif;
  font-style: italic;
}
.progress-confusable__count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.progress-confusable__count strong { color: var(--vermillion); font-weight: 500; }

/* Trend chart */
.progress-trend { height: 160px; position: relative; margin-top: 0.5rem; }
.progress-trend svg { display: block; width: 100%; height: 100%; overflow: visible; }
.progress-trend__meta {
  display: flex; justify-content: space-between;
  margin-top: 0.6rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem; color: var(--ink-faint); letter-spacing: 0.06em;
}
.progress-trend__legend {
  display: flex; gap: 1.4rem; margin-top: 0.4rem;
  font-family: 'Crimson Pro', serif; font-size: 0.9rem; font-style: italic; color: var(--ink-faint);
}
.progress-trend__legend-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 0.4rem; vertical-align: middle;
}

/* Heatmap */
.progress-heatmap-wrap { margin-top: 0.5rem; }
.progress-heatmap {
  display: grid;
  grid-template-columns: repeat(26, 1fr);
  gap: 3px;
}
.progress-heatmap__day { aspect-ratio: 1; border-radius: 2px; background: var(--hm-0); }
.progress-heatmap__day--l1 { background: var(--hm-1); }
.progress-heatmap__day--l2 { background: var(--hm-2); }
.progress-heatmap__day--l3 { background: var(--hm-3); }
.progress-heatmap__day--l4 { background: var(--hm-4); }
.progress-heatmap-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.9rem;
  font-family: 'Crimson Pro', serif; font-style: italic; color: var(--ink-faint); font-size: 0.9rem;
}
.progress-heatmap-scale {
  display: flex; align-items: center; gap: 0.35rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.06em; color: var(--ink-faint);
}
.progress-heatmap-scale .progress-heatmap__day {
  width: 11px; height: 11px; aspect-ratio: auto;
}

/* Mobile: stack everything */
@media (max-width: 768px) {
  .progress-card-row { grid-template-columns: 1fr; }
  .progress-hero .hero-lower { grid-template-columns: 1fr; }
  .progress-char-grid { grid-template-columns: repeat(5, 1fr); }
  .progress-heatmap { grid-template-columns: repeat(13, 1fr); }
}

/* ============================================
   ABOUT PAGE
   Editorial reading page — washi card, mincho
   masthead, left-aligned prose. Quiet luxury.
   ============================================ */
.about-card {
  width: 100%;
  max-width: 34rem;
  background: var(--paper-white);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  box-shadow: 0 2px 20px rgba(44, 36, 22, 0.06);
  padding: 3.75rem 3rem 2.5rem;
  position: relative;
}

/* Masthead — big 特訓 + gold divider + romaji gloss, centered */
.about-mast {
  text-align: center;
  margin-bottom: 2.75rem;
  animation: fadeUp 0.45s ease-out both;
}
.about-mark {
  display: inline-block;
  position: relative;
  font-family: 'Shippori Mincho B1', serif;
  font-weight: 700;
  font-size: clamp(3rem, 8vw, 4.25rem);
  line-height: 1;
  letter-spacing: 0.16em;
  text-indent: 0.16em; /* offset trailing letter-spacing so glyphs stay optically centered */
  color: var(--ink);
  text-decoration: none;
  transition: color 0.25s ease;
}
.about-mark:hover { color: var(--vermillion); }
.about-mark::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1.15rem;
  transform: translateX(-50%);
  width: 4.5rem;
  height: 1px;
  background: var(--divider);
}
.about-gloss {
  margin-top: 2rem;
  font-family: 'Crimson Pro', serif;
  font-weight: 400;
  font-style: italic;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.about-romaji {
  color: var(--ink-light);
  font-weight: 600;
  font-style: normal;
}

/* Body — left-aligned reading column */
.about-body { animation: fadeUp 0.45s ease-out 0.09s both; }
.about-body p {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--ink-light);
  margin-bottom: 1.2rem;
  text-wrap: pretty;
}
.about-body p:last-child { margin-bottom: 0; }
.about-body p.about-lead {
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 1.4rem;
}
.about-body sup { line-height: 0; }
.about-body sup a {
  color: var(--vermillion);
  text-decoration: none;
  font-size: 0.72em;
  padding-left: 0.06em;
}
.about-body sup a:hover { text-decoration: underline; }

/* Footer — gold divider + back link */
.about-foot { animation: fadeUp 0.45s ease-out 0.18s both; }
.about-divider {
  height: 1px;
  background: var(--divider);
  margin: 2.1rem 0 1.5rem;
}
.about-back {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  color: var(--vermillion);
  text-decoration: none;
}
.about-back:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .about-card { padding: 2.75rem 1.75rem 2rem; }
  .about-body p { font-size: 1.14rem; }
  .about-body p.about-lead { font-size: 1.3rem; }
}

/* ============================================
   ANONYMOUS USAGE GATE
   ============================================ */
.anon-nudge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--gold);
  margin-top: 0.6rem;
  animation: fadeUp 0.3s ease-out, nudge-breathe 7s ease-in-out 1s infinite;
}
.anon-nudge a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--gold-light);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.15s ease, text-decoration-color 0.15s ease;
}
.anon-nudge a:hover {
  opacity: 1;
  text-decoration-color: var(--gold);
}
@keyframes nudge-breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.7; }
}

.anon-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(44, 36, 22, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.anon-gate-card {
  background: var(--paper-white);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  padding: 3rem 2.5rem;
  max-width: 24rem;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(44, 36, 22, 0.12);
  animation: fadeUp 0.35s ease-out;
}
.anon-gate-title {
  font-family: 'Shippori Mincho B1', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.8rem;
}
.anon-gate-text {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 1.1rem;
  color: var(--ink-light);
  margin-bottom: 2rem;
  line-height: 1.5;
}
.anon-gate-btn {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.9rem 2rem;
  border-radius: 4px;
  background: var(--ink);
  color: var(--cream);
  text-decoration: none;
  transition: background 0.15s ease;
}
.anon-gate-btn:hover {
  background: var(--ink-light);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--ink-light);
  background: var(--cream);
  border: 1px solid var(--gold-light);
  border-radius: 3px;
  padding: 0.3rem 0.8rem;
  pointer-events: none;
  z-index: 900;
  animation: toast-fade 1.4s ease-out forwards;
}
@keyframes toast-fade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
