/* Native-feeling, warm paper and one vermilion accent. Green and amber only ever mean how well a sound is known.
   Katakana is set in the system gothic while it's being learnt, then in the lettering real menus use. */
@font-face { font-family: "menu-maru"; src: url("fonts/zenmarugothic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "menu-mincho"; src: url("fonts/shipporimincho.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "menu-brush"; src: url("fonts/yujisyuku.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "menu-heavy"; src: url("fonts/delagothicone.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "menu-pen"; src: url("fonts/zenkurenaido.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "menu-marker"; src: url("fonts/yuseimagic.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "menu-pop"; src: url("fonts/hachimarupop.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "menu-decol"; src: url("fonts/kaiseidecol.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: light;  /* always light, whatever the phone is set to */
  --page: #f4f1ec;
  --surface: #fff;
  --bar: #fbf9f6;
  --ink: #17130f;
  --muted: #8d867e;
  --secondary: #5f5952;
  --line: rgb(67 60 50 / .18);
  --fill: rgb(128 118 105 / .14);
  --tint: rgb(0 0 0 / .045);
  --accent: #d7402b;
  --accent-soft: rgb(215 64 43 / .1);
  --good: #1f8a44;
  --warn: #c77700;
  --round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ja: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic", Meiryo, sans-serif;
  --tap: cubic-bezier(.2, .8, .2, 1);
  --gutter: max(16px, calc(50vw - 15rem + 16px));
  --bar-height: 56px;
}
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--page); }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif; letter-spacing: -.01em; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
h1, h2, p { margin: 0; font-weight: inherit; font-size: inherit; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
[lang="ja"] { font-family: var(--ja); letter-spacing: 0; }
.app { width: 100%; max-width: 30rem; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(var(--bar-height) + 28px + env(safe-area-inset-bottom)); }
/* Installed to the home screen, iOS fades the page under the status bar: keep the first card clear of it. */
@media (display-mode: standalone) { .app { padding-top: calc(26px + env(safe-area-inset-top)); } }

/* today */
.hero-card { position: relative; overflow: hidden; padding: 18px 20px 20px; border-radius: 22px; background: linear-gradient(140deg, #a3261a, #d7402b 70%, #ee6a44); color: #fff; }
/* the slits of a shop curtain */
.hero-card::before, .hero-card::after { content: ""; position: absolute; top: 0; bottom: 0; width: 1.5px; background: rgb(255 255 255 / .12); pointer-events: none; }
.hero-card::before { left: 33.3%; }
.hero-card::after { left: 66.6%; }
.hero-card > * { position: relative; z-index: 1; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 26px; color: rgb(255 255 255 / .78); font-size: 14px; font-weight: 500; }
.pill { flex: none; padding: 4px 10px; border-radius: 13px; background: rgb(255 255 255 / .2); color: #fff; font-size: 13px; font-weight: 600; }
.hero-big { margin-top: 20px; font-family: var(--round); font-size: 36px; line-height: 1.06; font-weight: 700; letter-spacing: -.02em; }
.hero-sub { margin-top: 8px; color: rgb(255 255 255 / .84); }
.hero-go { display: flex; align-items: center; justify-content: center; min-height: 52px; margin-top: 18px; border-radius: 14px; background: #fff; color: #a3261a; font-size: 18px; font-weight: 700; transition: scale .12s var(--tap); }
.hero-go:active { scale: .97; }

/* grouped lists */
.section-title { display: block; margin: 28px 16px 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.group { display: block; margin-top: 10px; border-radius: 16px; background: var(--surface); overflow: hidden; }
.section-title + .group { margin-top: 0; }
.group > li { position: relative; }
.group > li + li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--line); }
.row a { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 12px 10px 16px; transition: background .12s; }
.row a:active { background: var(--tint); }
.who { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.who strong { font-weight: 600; }
.sub { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.chevron { color: var(--muted); font-size: 21px; line-height: 1; opacity: .55; }
.note { padding: 12px 16px; color: var(--muted); font-size: 14px; }
.source { margin: 14px 4px 0; color: var(--muted); font-size: 13px; }
.source .link { min-height: 0; font-size: inherit; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; padding: 14px 0; border-radius: 16px; background: var(--surface); }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile-stat { padding: 0 6px; text-align: center; }
.tile-stat + .tile-stat { border-left: .5px solid var(--line); }
.tile-stat strong { font-family: var(--round); display: block; font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -.03em; white-space: nowrap; }
.tile-stat small { color: var(--muted); font-size: 15px; font-weight: 600; }
.tile-stat span { display: block; color: var(--muted); font-size: 12px; line-height: 1.25; }

/* a kana with its sound: the chart, and the trouble list */
.cells { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 0 12px 14px; }
.cell { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 6px; border: 1.5px solid transparent; border-radius: 12px; background: var(--fill); transition: scale .12s var(--tap); }
button.cell:active { scale: .93; }
.cell b { font-size: 28px; line-height: 1.15; font-weight: 500; }
.cell i { min-height: 1.2em; color: var(--secondary); font-size: 13px; font-style: normal; font-weight: 500; }
.cell.new { border-color: var(--line); background: none; }
.cell.learning { background: color-mix(in srgb, var(--warn) 16%, transparent); }
.cell.learning i { color: var(--warn); }
.cell.young { background: color-mix(in srgb, var(--good) 11%, transparent); }
.cell.strong { background: color-mix(in srgb, var(--good) 24%, transparent); }
.cell.young i, .cell.strong i { color: var(--good); }
.cell.locked { opacity: .45; }
.trouble { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 14px 12px 0; }
.trouble .note { grid-column: 1 / -1; padding: 4px 4px 12px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 10px 4px 2px; color: var(--muted); font-size: 12.5px; }
.key { width: 12px; height: 12px; margin-left: 6px; border: 1.5px solid transparent; border-radius: 4px; }
.key:first-child { margin-left: 0; }
.key.new { border-color: var(--line); }
.key.learning { background: color-mix(in srgb, var(--warn) 30%, transparent); }
.key.young { background: color-mix(in srgb, var(--good) 16%, transparent); }
.key.strong { background: color-mix(in srgb, var(--good) 40%, transparent); }

/* kana: one card per set */
.season-head { padding: 6px 4px 0; }
.season-head h1 { font-family: var(--round); font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; }
.season-head p { margin-top: 2px; color: var(--muted); }
.set { scroll-margin-top: 16px; }
.set-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px 6px 16px; }
.set-head h2 { font-weight: 600; }
.set.off .set-head h2 { color: var(--secondary); }
.set .note { margin-top: -6px; padding-top: 0; }
.trick-text { padding: 0 16px 8px; color: var(--secondary); font-size: 15px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 14px; }
.example-word { padding: 7px 12px; border: 0; border-radius: 10px; background: var(--fill); color: var(--secondary); font-size: 14px; }
.example-word b { color: var(--ink); font-size: 17px; font-weight: 500; }
.example-word i { color: var(--accent); font-style: normal; font-weight: 600; }

/* controls */
.link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--accent); font-weight: 600; }
.link.quiet { color: var(--secondary); font-weight: 500; }
.link.small { min-height: 36px; font-size: 14px; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 26px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 600; transition: scale .12s var(--tap), opacity .15s; }
.primary:active:not(:disabled) { scale: .97; }
.primary:disabled { background: var(--fill); color: var(--muted); cursor: default; }
.primary.small { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.primary.wide { width: 100%; }
kbd { display: none; padding: 1px 6px; border-radius: 5px; background: rgb(255 255 255 / .22); font: 600 11px/1.5 ui-monospace, Menlo, monospace; letter-spacing: 0; }
.miss kbd { background: var(--fill); }
@media (hover: hover) and (pointer: fine) { kbd { display: inline-block; } }
.error { margin: 10px 4px; color: var(--accent); font-size: 15px; font-weight: 500; }

/* the tab bar is attached to the bottom edge */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 0 var(--gutter) env(safe-area-inset-bottom); background: var(--bar); border-top: .5px solid var(--line); view-transition-name: dock; }
.dock-tabs { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--bar-height); }
.dock-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: 0; transition: color .15s, scale .12s var(--tap); }
.dock-tab:active { scale: .92; }
.dock-tab svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock-tab.active { color: var(--accent); font-weight: 600; }
.dock-tab.active svg { stroke-width: 2.1; }
.fab { color: var(--secondary); }
.fab svg { width: 30px; height: 30px; margin: -3px 0 -2px; }
.fab svg circle { fill: var(--accent); stroke: var(--accent); }
.fab svg path { fill: #fff; stroke: #fff; stroke-width: 1.4; }

/* practise: one card, one decision */
.app.study { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
#study { display: flex; flex: 1; flex-direction: column; }
.study-top { display: flex; align-items: center; gap: 6px; min-height: 44px; margin: -6px -8px 8px; }
.icon-btn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--secondary); transition: opacity .15s, background .12s; }
.icon-btn:active { background: var(--tint); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#sound .mute, #sound[aria-pressed="false"] .waves { display: none; }
#sound[aria-pressed="false"] .mute { display: inline; }
#sound[aria-pressed="false"] { color: var(--muted); }
.progress { flex: 1; height: 6px; margin: 0 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.progress i { display: block; width: 0; height: 100%; border-radius: 3px; background: var(--accent); transition: width .3s var(--tap); }

.card { display: flex; flex: 1; flex-direction: column; align-items: center; min-height: 22rem; padding: 14px 16px 20px; border-radius: 22px; background: var(--surface); container-type: inline-size; animation: deal .22s var(--tap) both; }
.card-top { display: flex; justify-content: space-between; align-items: center; align-self: stretch; min-height: 26px; color: var(--muted); font-size: 14px; font-weight: 500; }
.new-chip { padding: 3px 9px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.kana { display: flex; flex: 1; align-items: center; justify-content: center; align-self: stretch; padding: 12px 0; font-size: clamp(46px, calc(90cqw / var(--n, 1)), 150px); font-weight: 500; line-height: 1.2; text-align: center; text-wrap: balance; overflow-wrap: anywhere; }
.kana.pair { gap: .5em; }
.card.revealed .kana { flex: none; font-size: clamp(40px, calc(72cqw / var(--n, 1)), 96px); }
.kana.f-maru { font-family: "menu-maru", var(--ja); }
.kana.f-mincho { font-family: "menu-mincho", var(--ja); font-weight: 600; }
.kana.f-brush { font-family: "menu-brush", var(--ja); }
.kana.f-heavy { font-family: "menu-heavy", var(--ja); }
.kana.f-pen { font-family: "menu-pen", var(--ja); }
.kana.f-marker { font-family: "menu-marker", var(--ja); }
.kana.f-pop { font-family: "menu-pop", var(--ja); }
.kana.f-decol { font-family: "menu-decol", var(--ja); font-weight: 700; }

.back { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 6px; align-self: stretch; padding-top: 6px; border-top: .5px solid var(--line); text-align: center; animation: rise .2s var(--tap) both; }
.spell { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.spell:empty { display: none; }
.sound { display: flex; flex-direction: column; align-items: center; min-width: 46px; padding: 6px 6px 5px; border: 1.5px solid transparent; border-radius: 12px; background: var(--fill); transition: scale .12s var(--tap), background .15s; }
button.sound:active { scale: .93; }
.sound b { font-family: var(--ja); font-size: 24px; line-height: 1.2; font-weight: 500; }
.sound i { color: var(--secondary); font-size: 15px; font-style: normal; font-weight: 600; }
.sound.tripped { border-color: var(--accent); background: var(--accent-soft); }
.sound.tripped i { color: var(--accent); }
.hint { margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.answer { font-family: var(--round); font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.answer.long { font-size: 26px; }
.meaning { font-size: 21px; font-weight: 600; }
.example { color: var(--secondary); font-size: 15px; }
.example b { color: var(--ink); font-family: var(--ja); font-size: 18px; font-weight: 500; }
.card-note { max-width: 24rem; color: var(--secondary); font-size: 15px; }
.answer:empty, .meaning:empty, .example:empty, .card-note:empty { display: none; }
.back .link { min-height: 36px; font-size: 14px; }

.answerbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--bar); border-top: .5px solid var(--line); }
.grade { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.answerbar .primary, .miss { min-height: 56px; font-size: 18px; }
.miss { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 14px; background: var(--fill); color: var(--ink); font-weight: 600; transition: scale .12s var(--tap); }
.miss:active { scale: .97; }

.done { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px 16px; text-align: center; animation: rise .3s var(--tap) both; }
.done-mark { color: var(--accent); font-size: 44px; font-weight: 700; }
.done h1 { font-family: var(--round); font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.done p { color: var(--secondary); }
.done .primary { margin-top: 14px; }
@keyframes deal { from { opacity: 0; translate: 0 8px; } }
@keyframes rise { from { opacity: 0; translate: 0 6px; } }

/* menu: a café card. Tap anything to check it. */
.menu { margin-top: 0; padding: 20px 18px 22px; border-radius: 18px; }
.menu-section + .menu-section { margin-top: 22px; }
.menu-heading { display: block; width: 100%; margin: 0 0 6px; padding: 4px 0; border: 0; background: none; color: inherit; font-size: 22px; font-weight: 700; text-align: center; }
.menu-heading.plain { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.item { display: flex; align-items: baseline; gap: 8px; width: 100%; min-height: 46px; padding: 6px 4px; border: 0; border-radius: 8px; background: none; color: inherit; text-align: left; transition: background .12s; }
.item:active, .menu-heading:active { background: rgb(128 128 128 / .14); }
.item-name { font-size: 22px; }
.dots { flex: 1; min-width: 12px; border-bottom: 2px dotted currentColor; opacity: .3; translate: 0 -4px; }
.price { flex: none; font-size: 15px; opacity: .75; }
[data-item].picked .item-name, .menu-heading.picked { color: var(--accent); }

.menu { background: #fbf5e6; color: #4a3423; box-shadow: inset 0 0 0 1.5px #e6d9bd, inset 0 0 0 7px #fbf5e6, inset 0 0 0 8px #e6d9bd; }
.menu .item-name, .menu .menu-heading:not(.plain) { font-family: "menu-maru", var(--ja); font-weight: 500; }
.menu .menu-heading:not(.plain) { font-family: "menu-decol", var(--ja); font-weight: 700; }

.reading { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(var(--bar-height) + 10px + env(safe-area-inset-bottom)); z-index: 4; padding: 14px 18px 16px; border-radius: 18px; background: var(--surface); box-shadow: 0 8px 30px rgb(0 0 0 / .22), 0 0 0 .5px var(--line); text-align: center; animation: rise .2s var(--tap) both; }
.reading-word { font-size: 26px; font-weight: 500; }
.reading-romaji { color: var(--accent); font-family: var(--round); font-size: 22px; font-weight: 700; }
.reading-meaning { font-size: 18px; font-weight: 600; }
.reading-note { margin-top: 4px; color: var(--secondary); font-size: 14px; }
.reading p:empty { display: none; }
body:has(.reading:not([hidden])) .app { padding-bottom: calc(var(--bar-height) + 190px + env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}
