/* ============================================================
   KANJI RUSH · estilos v2
   idioma, niveles, sakura, ranking, premium, modales
   ============================================================ */

/* ---------- toggle de idioma + acciones cabecera ---------- */
.home-top-actions { display: flex; gap: 8px; align-items: center; }

.lang-toggle {
  display: flex;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: var(--washi-hi);
}
.lang-toggle button {
  font-family: var(--font-body);
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  padding: 0 13px;
  min-height: 44px;
  border: none; background: transparent; color: var(--ink-soft);
  cursor: pointer;
}
.lang-toggle button.is-active { background: var(--ink); color: var(--washi-hi); }

/* ---------- pétalos de sakura ----------
   caída en el contenedor, vaivén en el ::before:
   solo transform, nada de layout */
.petals { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.petals i {
  position: absolute; top: -24px;
  width: 12px; height: 12px;
  opacity: .8;
  animation: petal-fall var(--fall) linear var(--fall-delay) infinite;
}
.petals i::before {
  content: "";
  display: block;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #f6cfd4, #eba8b4);
  border-radius: 70% 0 70% 0;
  animation: petal-sway var(--sway) ease-in-out var(--sway-delay) infinite alternate;
}
.petals i:nth-child(1) { left: 8%;  --fall: 11s;   --sway: 2.3s; --fall-delay: 0s; --sway-delay: 0s; }
.petals i:nth-child(2) { left: 22%; --fall: 14s;   --sway: 3.1s; --fall-delay: 2s; --sway-delay: .4s; width: 9px; height: 9px; }
.petals i:nth-child(3) { left: 35%; --fall: 12s;   --sway: 2.7s; --fall-delay: 5s; --sway-delay: .2s; }
.petals i:nth-child(4) { left: 48%; --fall: 16s;   --sway: 3.4s; --fall-delay: 1s; --sway-delay: .6s; width: 10px; height: 10px; }
.petals i:nth-child(5) { left: 61%; --fall: 13s;   --sway: 2.5s; --fall-delay: 7s; --sway-delay: .1s; }
.petals i:nth-child(6) { left: 73%; --fall: 15s;   --sway: 3s;   --fall-delay: 3s; --sway-delay: .5s; width: 8px; height: 8px; }
.petals i:nth-child(7) { left: 84%; --fall: 11.5s; --sway: 2.8s; --fall-delay: 6s; --sway-delay: .3s; }
.petals i:nth-child(8) { left: 93%; --fall: 17s;   --sway: 3.6s; --fall-delay: 4s; --sway-delay: 0s; width: 9px; height: 9px; }
@keyframes petal-fall {
  to { transform: translateY(110vh) rotate(540deg); }
}
@keyframes petal-sway {
  from { transform: translateX(-14px); }
  to   { transform: translateX(14px); }
}

/* ---------- selector de nivel (fuda de colores) ----------
   tamaños fluidos (clamp + vw/dvh): grandes en móvil sin
   desbordar en pantallas estrechas (320px) ni bajas (SE) */
.levels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(5px, 1.8vw, 9px);
  width: 100%;
}
.level-chip {
  --lv: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  min-height: 84px;
  min-height: clamp(80px, 11.5dvh, 104px);
  min-width: 0;
  padding: 10px 2px 8px;
  font-family: var(--font-body);
  background: var(--washi-hi);
  border: 1.5px solid rgba(33,29,24,.25);
  border-top: 5px solid var(--lv);
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s, border-color .15s;
}
.level-chip .lv-name {
  font-family: var(--font-display);
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 800; color: var(--ink);
  line-height: 1;
}
.level-chip .lv-sample {
  font-family: var(--font-display);
  font-size: clamp(12px, 3.6vw, 15px);
  line-height: 1.1;
  color: var(--lv);
  letter-spacing: .1em; margin-right: -.1em;
  white-space: nowrap;
}
.level-chip .lv-count {
  font-size: clamp(9px, 2.5vw, 11.5px);
  font-weight: 700; color: var(--ink-soft);
  white-space: nowrap; max-width: 100%; overflow: hidden;
}
.level-chip.is-active {
  background: var(--lv);
  border-color: var(--lv);
  transform: translateY(-4px) rotate(-1.5deg);
  box-shadow: 0 10px 18px -8px rgba(33,29,24,.45);
}
.level-chip.is-active .lv-name,
.level-chip.is-active .lv-sample,
.level-chip.is-active .lv-count { color: var(--washi-hi); }
/* N1 lleva color tinta: su muestra se confunde con el nombre,
   así que en reposo va atenuada */
.level-chip:not(.is-active) .lv-sample { opacity: .85; }

.level-tag {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 800;
  color: var(--washi-hi);
  background: var(--lv-current, var(--ink));
  border-radius: 7px;
  padding: 4px 8px;
  transform: rotate(-2deg);
  display: inline-block;
}

.game-top-right {
  justify-self: end;
  display: flex; align-items: center; gap: 10px;
}

/* ---------- chips de acción (ranking, cuenta, premium) ---------- */
.home-secondary { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btn-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700;
  color: var(--ink);
  background: var(--washi-hi);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 44px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(33,29,24,.7);
  transition: transform .12s, box-shadow .12s;
}
.btn-chip:active { transform: translateY(2px); box-shadow: none; }
.btn-chip .chip-jp {
  font-family: var(--font-display);
  color: var(--vermilion); font-weight: 800;
}
.btn-chip-gold { border-color: var(--gold); color: var(--gold-text); background: var(--gold-wash); }
.btn-chip-gold .chip-jp { color: var(--gold); }

.over-links { display: flex; gap: 14px; align-items: center; }

/* ---------- cabecera de páginas internas ---------- */
.page-head {
  width: 100%;
  display: grid; grid-template-columns: 44px 1fr 56px;
  align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.page-head h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 800; text-align: center;
}
.page-head-jp { color: var(--vermilion); }

/* ---------- ranking ---------- */
#screen-rank { justify-content: flex-start; }
.rank-tabs {
  display: flex; gap: 6px;
  width: 100%;
  background: var(--washi-dim);
  border-radius: 12px;
  padding: 5px;
}
.rank-tabs button {
  flex: 1;
  font-family: var(--font-body);
  font-size: 13px; font-weight: 700;
  min-height: 44px;
  padding: 9px 0;
  border: none; border-radius: 9px;
  background: transparent; color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.rank-tabs button.is-active { background: var(--ink); color: var(--washi-hi); }

.rank-list {
  width: 100%;
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
  flex: 1;
}
.rank-row {
  display: grid; grid-template-columns: 40px 1fr auto;
  align-items: center; gap: 10px;
  background: var(--washi-hi);
  border: 1.5px solid rgba(33,29,24,.14);
  border-radius: 12px;
  padding: 11px 14px;
  animation: reveal .4s ease both;
}
.rank-row.is-me { border-color: var(--vermilion); box-shadow: 0 0 0 1px var(--vermilion); }
.rank-pos {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800; color: var(--ink-soft);
}
.rank-pos.medal {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  color: var(--washi-hi);
  transform: rotate(-4deg);
  font-size: 15px;
}
.rank-pos.m1 { background: var(--gold-deep); }
.rank-pos.m2 { background: var(--silver); }
.rank-pos.m3 { background: var(--bronze); }
.rank-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name small { color: var(--vermilion-text); font-weight: 700; }
.rank-score {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.rank-empty {
  text-align: center; color: var(--ink-soft);
  font-size: 14px; line-height: 1.6;
  padding: 36px 20px;
}
.rank-empty .big {
  font-family: var(--font-display); font-size: 40px;
  display: block; margin-bottom: 10px; color: var(--ink-soft); opacity: .5;
}

/* ---------- premium ---------- */
#screen-premium { justify-content: flex-start; }
.premium-card {
  width: 100%;
  background: var(--washi-hi);
  border: 1.5px solid rgba(33,29,24,.16);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  padding: 28px 22px 24px;
  text-align: center;
  position: relative;
  margin-top: 26px;
}
.premium-seal {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%) rotate(-5deg);
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: var(--gold);
  color: var(--washi-hi);
  font-family: var(--font-display);
  font-size: 24px; font-weight: 800;
  border-radius: 11px;
  box-shadow: inset 0 0 0 2.5px var(--washi-hi), inset 0 0 0 4px var(--gold);
}
.premium-card h3 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  margin-top: 10px;
}
.premium-once { margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--vermilion-text); }
.premium-benefits {
  list-style: none;
  margin: 18px 0 20px; padding: 0;
  display: flex; flex-direction: column; gap: 11px;
  text-align: left;
}
.premium-benefits li { display: flex; gap: 11px; align-items: center; font-size: 14px; font-weight: 400; }
.pb-ico {
  flex: 0 0 30px; height: 30px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800;
  color: var(--vermilion);
  background: rgba(207,59,43,.08);
  border-radius: 8px;
}
.btn-buy {
  width: 100%;
  font-family: var(--font-body);
  font-size: 16px; font-weight: 700; letter-spacing: .12em;
  color: var(--ink);
  background: var(--gold);
  border: none; border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--gold-deep);
  transition: transform .12s, box-shadow .12s;
}
.btn-buy:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--gold-deep); }
.btn-buy.is-owned { background: var(--ink); color: var(--washi-hi); box-shadow: 0 5px 0 #000; cursor: default; }
.premium-note { margin-top: 12px; font-size: 12px; color: var(--ink-soft); min-height: 1em; }

/* ---------- modales (dialog nativo: foco, Escape y trampa gratis) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  width: 100%; height: 100dvh;
  max-width: none; max-height: none;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 20px;
  display: none;
  align-items: center; justify-content: center;
}
.modal[open] { display: flex; animation: screen-in .3s ease; }
.modal::backdrop {
  background: rgba(33,29,24,.55);
  backdrop-filter: blur(3px);
}
.modal-card {
  position: relative;
  width: min(100%, 400px);
  background: var(--washi-hi);
  border-radius: 22px;
  border: 1.5px solid rgba(33,29,24,.2);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);
  padding: 30px 24px 26px;
  text-align: center;
  max-height: 88dvh; overflow-y: auto;
}
.modal-hanko {
  width: 54px; height: 54px;
  margin: -57px auto 14px;
  display: grid; place-items: center;
  background: var(--vermilion);
  color: var(--washi-hi);
  font-family: var(--font-display);
  font-size: 26px; font-weight: 800;
  border-radius: 12px;
  transform: rotate(-5deg);
  box-shadow: inset 0 0 0 2.5px var(--washi-hi), inset 0 0 0 4px var(--vermilion), 0 8px 18px -6px rgba(163,38,25,.5);
}
.modal-card h2 { font-family: var(--font-display); font-size: 23px; font-weight: 800; }
.modal-intro { margin-top: 8px; font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.howto {
  list-style: none;
  margin: 18px 0 22px; padding: 0;
  display: flex; flex-direction: column; gap: 13px;
  text-align: left;
}
.howto li { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; }
.howto-ico {
  flex: 0 0 34px; height: 34px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 17px; font-weight: 800;
  color: var(--vermilion);
  border: 1.5px solid var(--vermilion);
  border-radius: 9px;
  transform: rotate(-3deg);
}
.modal-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px; font-weight: 700;
  color: var(--ink-soft);
}
.modal-close {
  position: absolute; top: 2px; right: 4px;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 24px; line-height: 1;
  background: none; border: none; color: var(--ink-soft);
  cursor: pointer;
}

/* ---------- formulario de cuenta ---------- */
.oauth-row { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-body);
  font-size: 14.5px; font-weight: 700;
  color: var(--ink);
  background: var(--washi-hi);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: transform .12s, background .2s;
}
.oauth-btn:active { transform: translateY(2px); }
.oauth-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
.oauth-apple, .oauth-github { background: var(--ink); color: var(--washi-hi); }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px;
  font-size: 12px; color: var(--ink-soft);
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--ink-soft); opacity: .35;
}
.login-form { display: flex; flex-direction: column; gap: 11px; margin-top: 16px; }
.login-form input {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 13px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--washi);
  color: var(--ink);
  text-align: center;
}
.login-form input:focus { outline: 2px solid var(--vermilion); outline-offset: 1px; }
.login-btn {
  font-family: var(--font-body);
  font-size: 15px; font-weight: 700;
  color: var(--washi-hi);
  background: var(--ink);
  border: none; border-radius: 12px;
  padding: 13px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--vermilion-deep);
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.login-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--vermilion-deep); }
.login-btn:disabled { opacity: .5; }
.login-msg { font-size: 13px; font-weight: 700; min-height: 1.2em; }
.login-msg.ok { color: #4a7a3a; }
.login-msg.err { color: var(--vermilion-text); }
.login-user-mail { font-size: 13px; color: var(--ink-soft); word-break: break-all; }
.premium-badge-mini {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  color: var(--gold-text); background: var(--gold-wash);
  border-radius: 999px; padding: 4px 12px;
}

/* ---------- páginas estáticas (instrucciones / privacidad) ---------- */
.doc-body {
  overflow: auto; user-select: text;
}
.doc {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 22px 60px;
}
.doc header { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.doc .hanko { width: 56px; height: 56px; font-size: 20px; margin: 0; }
.doc h1 { font-family: var(--font-display); font-size: 30px; font-weight: 800; line-height: 1.1; }
.doc h2 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 800;
  margin: 30px 0 10px;
  padding-left: 12px;
  border-left: 4px solid var(--vermilion);
}
.doc p, .doc li { font-size: 15px; line-height: 1.7; color: #3c362e; }
.doc ul, .doc ol { padding-left: 22px; margin: 8px 0; }
.doc li { margin: 6px 0; }
.doc a { color: var(--vermilion-text); font-weight: 700; }
.doc .back {
  display: inline-block; margin-top: 36px;
  font-weight: 700; text-decoration: none;
  border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 10px 22px; color: var(--ink);
}
.doc .muted { font-size: 13px; color: var(--ink-soft); }
.doc table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.doc th, .doc td { border: 1px solid rgba(33,29,24,.2); padding: 8px 10px; font-size: 13.5px; text-align: left; }
.doc th { background: var(--washi-dim); font-family: var(--font-display); }

/* ============================================================
   MOVIMIENTO REDUCIDO · global
   Entradas como crossfade; nada de overshoot, shake ni bucles.
   ============================================================ */
@keyframes reduced-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }

  /* entradas: crossfade plano, sin desplazamiento ni stagger */
  .screen.is-active,
  .modal[open] { animation: reduced-fade .2s ease; }
  .reveal {
    animation: reduced-fade .25s ease forwards;
    animation-delay: 0s;
    transform: none;
  }
  .rank-row { animation: reduced-fade .2s ease both; }

  /* sellos: aparición directa en su pose final, sin overshoot */
  .stamp.stamp-in {
    animation: reduced-fade .15s ease forwards;
    transform: rotate(-7deg);
  }
  .over-stamp { animation: reduced-fade .2s ease both; }
  .kanji-glyph { animation: reduced-fade .2s ease both; filter: none; transform: none; }

  /* feedback sin sacudidas ni rebotes */
  .kanji-card.shake,
  .score.bump,
  .combo.pop .combo-x { animation: none; }
  .drop.is-lost {
    animation: none;
    opacity: .18;
    transform: rotate(-8deg) scale(.8);
  }

  /* el kanji aparece ya dibujado (anula la transición inline por trazo) */
  .kanji-svg path { transition: none !important; }
}
