/* Kana practice. The theme tokens, header and buttons come from
   /styles.css; this file is the page shell and setup screen around the
   quiz - the quiz itself (hud, lane, cards, answer box, recap, share) is
   drill.css, so a future page can reuse it with a different setup screen. */

/* The page shell. /styles.css carries the theme tokens, the header and the
   buttons, but NOT the intro layout - /card and /twibbonizer each define
   these for themselves, so this page has to as well or it renders on a white
   background with the content jammed against the left edge. */
.kn-page {
  background: var(--c-wash);
}

.l-intro {
  padding: 3.5rem 1.5rem 5rem;
}

.l-intro__inner {
  max-width: 940px;
  margin: 0 auto;
  text-align: center;
}

.l-intro__title {
  font-size: 2rem;
  color: var(--c-pink);
  margin-bottom: 2.5rem;
}

.l-intro__back { margin-top: 2.5rem; font-size: 0.88rem; }
.l-intro__back a { color: var(--c-pink); font-weight: 700; }

/* The two-roots-in-one-document switch lived here: an `is-n5` class on <html>
   decided which of them displayed. It is gone because the documents are, and
   the rules had to go with them - a page that no longer sets the class was
   left permanently hidden by `html:not(.is-n5) .js-n5-root { display: none }`,
   which is exactly what emptied every /kana/advanced/ page after the split. */

/* The heading above is centred; everything inside the panels reads as a form
   and is not. */
.kn-setup, .kn-quiz, .kn-recap { text-align: left; }

/* ============================ setup ============================ */

.kn-setup, .kn-quiz, .kn-recap {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 22px;
  padding: 28px 24px;
  margin: 28px 0 20px;
  box-shadow: 0 10px 30px rgba(229, 48, 125, .06);
}

.kn-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.kn-mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 10px;
  border: 2px solid var(--c-border);
  border-radius: 16px;
  background: var(--c-wash);
  cursor: pointer;
  font-family: inherit;
  color: var(--c-body);
  transition: border-color .18s, background .18s, transform .18s;
}
.kn-mode:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--c-pink-light); }
.kn-mode.is-active { border-color: var(--c-pink); background: #fff; }
.kn-mode:disabled { opacity: .45; cursor: not-allowed; }

.kn-mode__kana {
  font-family: 'Noto Sans JP', 'Manrope', sans-serif;
  font-size: 30px;
  line-height: 1;
  color: var(--c-pink);
}
.kn-mode__name { font-weight: 800; font-size: 15px; }
.kn-mode__note { font-size: 12px; color: var(--c-muted); }

/* The door to /kana/n5. A link, not a mode tile: it leaves this page
   entirely rather than switching state on it. */
.kn-n5-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  border-radius: 16px;
  border: 2px solid var(--c-border);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}
.kn-n5-banner:hover { border-color: var(--c-pink-light); transform: translateY(-1px); }
.kn-n5-banner__body { flex: 1; min-width: 0; }
.kn-n5-banner__eyebrow {
  display: inline-block;
  margin-bottom: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--c-pink);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.kn-n5-banner__title { display: block; font-weight: 800; font-size: 15px; }
.kn-n5-banner__desc { display: block; font-size: 12.5px; color: var(--c-muted); }
.kn-n5-banner__arrow { font-size: 20px; color: var(--c-pink); flex: none; }

/* The daily banner. Deliberately unlike the practice tiles below it: it is a
   different kind of thing, on a clock, and it pays. */
.kn-daily {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 18px 20px;
  margin-bottom: 22px;
  border-radius: 18px;
  border: 2px solid var(--c-pink-light);
  background: linear-gradient(120deg, #fff6fa, #fffaf2);
}
.kn-daily__body { flex: 1; min-width: 220px; }
.kn-daily__eyebrow {
  margin: 0 0 6px;
  font-family: 'Montserrat Alternates', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--c-pink);
}
.kn-daily__eyebrow span { color: #f0a500; }
.kn-daily__desc { margin: 0 0 8px; font-size: 13.5px; line-height: 1.6; }
.kn-daily__timer { margin: 0; font-size: 12.5px; color: var(--c-muted); }
.kn-daily__timer b {
  color: var(--c-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
/* .c-btn is written for an <a>; on a <button> the native chrome shows through. */
.kn-daily__play { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; flex: none; }
.kn-daily__play[disabled] { opacity: .5; cursor: not-allowed; }

/* Once today's daily is done, the banner carries the code instead of the
   pitch, so a page reopened later still has it. */
.kn-daily--done { border-style: solid; border-color: #43b581; background: #f4fbf7; }
.kn-daily__code {
  display: inline-block;
  margin-top: 4px;
  font-family: 'Montserrat Alternates', sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--c-pink);
  user-select: all;
}

.kn-daily-prize {
  margin-top: 22px;
  padding: 18px;
  border: 2px dashed var(--c-pink-light);
  border-radius: 16px;
  background: var(--c-wash);
  text-align: center;
}
.kn-daily-prize__label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.kn-daily-prize__code {
  margin: 0 0 10px;
  font-family: 'Montserrat Alternates', sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .12em;
  color: var(--c-pink);
  /* Long enough to be worth selecting by hand if the copy button fails. */
  user-select: all;
}
.kn-daily-prize__how { margin: 0 0 12px; font-size: 13px; line-height: 1.6; }
.kn-daily-prize__how code {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 12.5px;
  color: var(--c-body);
}
.kn-daily-prize__status { margin-left: 10px; font-size: 12px; font-weight: 700; color: #43b581; }

.kn-decks { margin-top: 22px; }
.kn-decks__title {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin: 0 0 10px;
}
.kn-decks__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.kn-deck {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.kn-deck:hover { border-color: var(--c-pink-light); }
.kn-deck input { accent-color: var(--c-pink); width: 17px; height: 17px; flex: none; cursor: pointer; }
.kn-deck.is-on { border-color: var(--c-pink); background: var(--c-wash); }

/* The label, the count and the progress bar are one stack that fills the rest
   of the row. Without this the wrapper shrinks to the text and the bar reads
   as an underline on the label rather than as a track under it. */
.kn-deck__body { flex: 1; min-width: 0; display: block; }
.kn-deck__row { display: flex; align-items: baseline; gap: 10px; }
.kn-deck__label { font-size: 14px; font-weight: 500; line-height: 1.35; }
.kn-deck__meta { margin-left: auto; font-size: 11px; color: var(--c-muted); white-space: nowrap; }

/* How much of this set is already learned. */
.kn-deck__bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--c-border);
  margin-top: 9px;
  overflow: hidden;
}
.kn-deck__bar i { display: block; height: 100%; border-radius: 2px; background: var(--c-pink); transition: width .3s; }

.kn-decks__quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.kn-rounds { margin-top: 22px; }
.kn-rounds__grid { display: flex; flex-wrap: wrap; gap: 8px; }

/* .kn-chip (the pill button both the deck quick-picks and the round-length
   picker use) lives in drill.css alongside its other uses - the recap
   actions and the share row. */

.kn-setup__hint { min-height: 20px; margin: 16px 0 0; font-size: 13px; color: var(--c-pink); }

/* .c-btn in /styles.css is written for an <a>, which has no border, no
   background and no padding of its own. On a <button> those native styles
   survive and show up as a grey box around the pill, so they are cleared
   here - the same reset /card needs for its two buttons. .kn-recap__again
   gets the same reset in drill.css. */
.kn-start {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  margin-top: 6px;
}
.kn-setup__progress { margin: 14px 0 0; font-size: 13px; color: var(--c-muted); }

/* Deliberately quiet. It throws away everything the learner has built up, so
   it should not look like something to press by accident. */
.kn-reset {
  margin-top: 6px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--c-muted);
  text-decoration: underline;
  cursor: pointer;
}
.kn-reset:hover { color: #e05b5b; }

/* The quiz itself - hud, lane, cards, answer box, recap content and share -
   is drill.css. */

/* ============================ mobile ============================ */

/* Tablets. Wide enough to keep the three-across mode picker and the desktop
   lane, but the page padding and heading are sized for a 1200px window. */
@media (max-width: 1024px) and (min-width: 701px) {
  .l-intro { padding: 3rem 1.25rem 4rem; }
  .l-intro__title { font-size: 1.8rem; margin-bottom: 2rem; }
  .kn-decks__grid { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
  .kn-mode { padding: 15px 10px; }
}

/* The keyboard is up: on any size, the heading is the first thing to give way
   so the lane and the answer box stay on screen together. Driven by a class
   rather than a width so a tablet gets the same treatment as a phone. */
body.is-keyboard.is-practicing .c-eyebrow,
body.is-keyboard.is-practicing .l-intro__title,
body.is-keyboard.is-practicing .l-intro__back { display: none; }
body.is-keyboard.is-practicing .l-intro { padding-top: 1.25rem; }

@media (max-width: 700px) {
  .kn-setup, .kn-quiz, .kn-recap { padding: 20px 16px; border-radius: 18px; }

  .l-intro { padding: 2.5rem 1rem 3.5rem; }
  .l-intro__title { font-size: 1.6rem; margin-bottom: 1.75rem; }
  body.is-keyboard.is-practicing .kn-quiz { margin-top: 12px; }
  .kn-modes { grid-template-columns: 1fr; }
  .kn-daily-prize__code { font-size: 24px; letter-spacing: .08em; }
  .kn-daily { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  .kn-daily__play { align-self: stretch; }
  .kn-mode { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 13px 15px; text-align: left; }
  .kn-mode__kana { font-size: 24px; }
  .kn-mode__note { margin-left: auto; }
  .kn-decks__grid { grid-template-columns: 1fr; }
}

/* ── Account row ────────────────────────────────────────────────────────────
   Sits above the daily banner because it changes what the daily does: signed
   in, the coins land straight away and there is no code to carry anywhere. */
.kn-account {
  border: 1px dashed var(--c-border);
  border-radius: 16px;
  background: var(--c-wash);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
}

.kn-account__side {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.kn-account__text {
  flex: 1 1 220px;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--c-body);
}

.kn-account__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--c-pink-light);
}

.kn-account__login {
  flex: 0 0 auto;
  display: inline-block;
  border-radius: 999px;
  background-color: #5865f2;   /* Discord blurple, so the button reads as theirs */
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.7rem 1.25rem;
  transition: background-color 0.2s ease;
}

.kn-account__login:hover { background-color: #4752c4; }

.kn-account__logout {
  flex: 0 0 auto;
  border: 1px solid var(--c-border);
  background: #ffffff;
  color: var(--c-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.kn-account__logout:hover { color: var(--c-pink); border-color: var(--c-pink-light); }

/* Paid straight into the wallet, so there is no command to copy and nothing
   to do in Discord. */
.kn-daily-prize.is-auto .js-daily-copy,
.kn-daily-prize.is-auto .js-daily-copied {
  display: none;
}

@media (max-width: 560px) {
  .kn-account__side { gap: 0.7rem; }
  .kn-account__login { width: 100%; text-align: center; }
}
