*,
*::before,
*::after {
  box-sizing: border-box;
}
:root {
  --bg: #f1f1ee;
  --fg: #14151b;
  --mut: #6c6d75;
  --line: #d2d2cb;
  --g: #2fa862;
  --y: #e6b21f;
  --r: #e0503f;
  --n: #bdbdb6;
  --card: #fbfbf9;
  --seal: #d93a2b;
  --help-green: #217a45;
  --help-yellow: #926b00;
  --display:
    "Unbounded", "Arial Black", "Helvetica Neue", system-ui, sans-serif;
  --body:
    "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --pop: cubic-bezier(0.3, 1.7, 0.5, 1);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111215;
    --fg: #efeee9;
    --mut: #9a9ba3;
    --line: #34353b;
    --card: #191a1e;
    --n: #4a4b52;
    --help-green: #76d296;
    --help-yellow: #f0c84b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111215;
  --fg: #efeee9;
  --mut: #9a9ba3;
  --line: #34353b;
  --card: #191a1e;
  --n: #4a4b52;
  --help-green: #76d296;
  --help-yellow: #f0c84b;
  color-scheme: dark;
}
html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
  overscroll-behavior-y: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.4 var(--body);
  -webkit-font-smoothing: antialiased;
}

/* ---------- background ---------- */
.bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  transform: translate3d(0, 0, 0);
}
.bg svg {
  position: absolute;
  display: block;
  overflow: visible;
}

.kj {
  position: absolute;
  display: block;
  aspect-ratio: 1;
  opacity: 0.09;
}
.k1 {
  top: -30px;
  right: -120px;
  width: min(100vw, 440px);
  rotate: 8deg;
}
.k2 {
  left: -130px;
  bottom: -120px;
  width: min(105vw, 470px);
  rotate: -6deg;
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  --gap: 5em;
  --ln: 1px;
  --gc: color-mix(in srgb, var(--fg) 6%, transparent);
  background-image:
    linear-gradient(
      -90deg,
      transparent calc(var(--gap) - var(--ln)),
      var(--gc) calc(var(--gap) - var(--ln) + 1px),
      var(--gc) var(--gap)
    ),
    linear-gradient(
      0deg,
      transparent calc(var(--gap) - var(--ln)),
      var(--gc) calc(var(--gap) - var(--ln) + 1px),
      var(--gc) var(--gap)
    );
  background-size: var(--gap) var(--gap);
}

@keyframes drop {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* ---------- layout ---------- */
main {
  position: relative;
  z-index: 1;
  max-width: 440px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 26px 18px 64px;
}
.utility-nav {
  display: flex;
  gap: 9px;
  margin: 0 0 12px;
}
.utility-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: visible;
  border-radius: 50%;
  border-color: var(--line);
  background: color-mix(in srgb, var(--card) 84%, transparent);
}
.mode-toggle {
  flex: none;
  height: 38px;
  margin-left: auto;
  padding: 0 12px;
  border: 2px solid var(--fg);
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font: 700 10px/1 var(--display);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.utility-button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.utility-button .theme-moon {
  display: none;
}
:root[data-theme="dark"] .utility-button .theme-sun {
  display: none;
}
:root[data-theme="dark"] .utility-button .theme-moon {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .utility-button .theme-sun {
    display: none;
  }
  :root:not([data-theme="light"]) .utility-button .theme-moon {
    display: block;
  }
}
.profile-button {
  position: relative;
}
.profile-tip {
  position: absolute;
  z-index: 3;
  top: calc(100% + 9px);
  left: 0;
  width: max-content;
  max-width: min(270px, calc(100vw - 48px));
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 8px 24px #0002;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 0.18s ease,
    transform 0.18s var(--ease);
}
.profile-button:hover .profile-tip,
.profile-button:focus-visible .profile-tip,
.profile-button.show-tip .profile-tip {
  opacity: 1;
  transform: translateY(0);
}
.profile-tip[hidden] {
  display: none;
}
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
h1 {
  margin: 0;
  flex: 1;
  min-width: 0;
  max-width: 330px;
  font: 800 clamp(2.75rem, 14vw, 4.25rem) / 1 var(--display);
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.jp {
  writing-mode: vertical-rl;
  color: var(--mut);
  font-size: 18px;
  letter-spacing: 0.28em;
  margin: 0 4px 4px 0;
  opacity: 1;
}
@keyframes fade {
  to {
    opacity: 1;
  }
}
.sub {
  color: var(--mut);
  font-size: 15px;
  font-weight: 500;
  margin: 12px 0 18px;
}

.tag {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  font-size: 19px;
  font-style: italic;
  margin: 2px 0 10px;
}
.stroke-note {
  margin: -4px 0 10px;
  color: var(--mut);
  font-size: 13px;
}

/* ---------- board ---------- */
.board {
  position: relative;
}
#cv {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: var(--card);
  border: 3px solid var(--fg);
  border-radius: 30px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: crosshair;
}

#seal {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--seal);
  color: var(--card);
  filter: url(#rough);
  pointer-events: none;
  opacity: 0;
  transform: scale(1.9) rotate(-14deg);
  transform-origin: bottom right;
}
#seal::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid var(--card);
  border-radius: 5px;
}
#seal .sk {
  font:
    400 68px/1 "Yuji Boku",
    "Hiragino Mincho ProN",
    "Yu Mincho",
    "Noto Serif JP",
    serif;
  -webkit-text-stroke: 1.5px currentColor;
}
#seal .sk.two {
  font-size: 34px;
  line-height: 1.05;
  writing-mode: vertical-rl;
  text-orientation: upright;
}
#seal .sk:not(.two) {
  transform: translateY(-4px);
}
#seal.on {
  opacity: 0.94;
  transform: rotate(-6deg);
}
#seal.stamp {
  animation: stamp 0.55s var(--d, 1s) both cubic-bezier(0.3, 1.4, 0.5, 1);
}
@keyframes stamp {
  0% {
    opacity: 0;
    transform: scale(1.9) rotate(-14deg);
  }
  55% {
    opacity: 0.94;
    transform: scale(0.92) rotate(-6deg);
  }
  100% {
    opacity: 0.94;
    transform: scale(1) rotate(-6deg);
  }
}

/* ---------- buttons ---------- */
.btns {
  display: flex;
  gap: 10px;
  margin: 14px 0;
  width: 100%;
  max-width: 100%;
}
#practice-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -4px 0 8px;
}
#practice-tools[hidden] {
  display: none;
}
#practice-tools button {
  padding: 8px 13px;
  border-color: var(--line);
  color: var(--mut);
  font-size: 12px;
  font-weight: 700;
}
#practice-tools #practice-forfeit {
  margin-left: auto;
  border-color: var(--r);
  background: color-mix(in srgb, var(--r) 12%, var(--card));
  color: var(--fg);
}
button {
  font: 600 15px/1 var(--body);
  padding: 14px 20px;
  border-radius: 999px;
  border: 2px solid var(--fg);
  background: transparent;
  color: var(--fg);
}
button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease),
    background-color 0.25s ease,
    color 0.25s ease,
    opacity 0.2s ease;
}
button:active {
  transform: scale(0.95);
}
button.p {
  flex: 1;
  background: var(--fg);
  color: var(--bg);
  padding: 16px 22px;
  font: 700 15px/1 var(--display);
  letter-spacing: -0.02em;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}
button[hidden] {
  display: none;
}
@media (hover: hover) {
  button:not(.p):hover {
    background: var(--fg);
    color: var(--bg);
  }
  button.p:hover {
    transform: translateY(-2px);
  }
  button.p:active {
    transform: scale(0.95);
  }
}
button:focus-visible {
  outline: 3px solid var(--g);
  outline-offset: 3px;
}
.ink {
  position: absolute;
  pointer-events: none;
  background: currentColor;
  opacity: 0;
  transform: scale(0);
  animation: ink 0.75s var(--ease) forwards;
}
@keyframes ink {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0.3;
  }
  100% {
    transform: scale(1) rotate(25deg);
    opacity: 0;
  }
}
/* ---------- status ---------- */
.status {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 22px 0 4px;
}
#msg {
  min-height: 56px;
}
#msg.loading {
  display: flex;
  align-items: center;
  gap: 12px;
}
.loading-mark {
  position: relative;
  display: block;
  flex: none;
  width: 64px;
  height: 24px;
  color: var(--fg);
}
.loading-mark::before,
.loading-mark::after {
  content: "";
  position: absolute;
  background: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.loading-mark::before {
  inset: 0;
  opacity: 0.9;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 24'%3E%3Cpath d='M3 15.2C3 13.2 5 12 8 11.6C22 9.6 42 8.6 61 11C42 12.4 22 14.8 8 17.4C5 17.9 3 17 3 15.2Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 24'%3E%3Cpath d='M3 15.2C3 13.2 5 12 8 11.6C22 9.6 42 8.6 61 11C42 12.4 22 14.8 8 17.4C5 17.9 3 17 3 15.2Z'/%3E%3C/svg%3E");
  animation: stroke-run 2s infinite;
}
.loading-mark::after {
  top: 0;
  left: -1px;
  width: 16px;
  height: 16px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 15L2.6 10.2L11.6 1.2Q12.5 .5 13.4 1.2L14.8 2.6Q15.5 3.5 14.8 4.4L5.8 13.4Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1 15L2.6 10.2L11.6 1.2Q12.5 .5 13.4 1.2L14.8 2.6Q15.5 3.5 14.8 4.4L5.8 13.4Z'/%3E%3C/svg%3E");
  animation:
    pen-run 2s infinite,
    pen-lift 2s infinite,
    pen-fade 2s infinite;
}
@keyframes stroke-run {
  0% {
    clip-path: inset(0 100% 0 0);
    animation-timing-function: cubic-bezier(0.55, 0.1, 0.2, 1);
  }
  48% {
    clip-path: inset(0 0 0 0);
    animation-timing-function: linear;
  }
  58% {
    clip-path: inset(0 0 0 0);
    animation-timing-function: cubic-bezier(0.55, 0.1, 0.2, 1);
  }
  100% {
    clip-path: inset(0 0 0 100%);
  }
}
@keyframes pen-run {
  0% {
    transform: translateX(0);
    animation-timing-function: cubic-bezier(0.55, 0.1, 0.2, 1);
  }
  48%,
  100% {
    transform: translateX(64px);
  }
}
@keyframes pen-lift {
  0% {
    translate: 0 -6px;
    animation-timing-function: ease-out;
  }
  8% {
    translate: 0 0;
    animation-timing-function: cubic-bezier(0.3, 0.6, 0.4, 1);
  }
  48% {
    translate: 0 -4px;
    animation-timing-function: ease-out;
  }
  56%,
  100% {
    translate: 0 -9px;
  }
}
@keyframes pen-fade {
  0% {
    opacity: 0;
  }
  6%,
  46% {
    opacity: 1;
  }
  54%,
  100% {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .loading-mark::before {
    animation: none;
    clip-path: none;
  }
  .loading-mark::after {
    display: none;
  }
}
#msg.loading .big {
  font: 700 15px/1.2 var(--body);
  letter-spacing: 0;
}
#msg .big {
  display: block;
  font: 800 28px/1 var(--display);
  letter-spacing: -0.045em;
}
#msg .meta {
  display: block;
  margin-top: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--mut);
}
#duplicate-notice {
  position: fixed;
  z-index: 10;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  width: max-content;
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0 8px 24px #0003;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.3s var(--ease),
    visibility 0s linear 0.2s;
}
#duplicate-notice.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  transition-delay: 0s;
}
#msg.in {
  animation: wipein 0.7s var(--ease);
}
main.mode-transition .utility-nav,
main.mode-transition .top,
main.mode-transition #mode-label,
main.mode-transition .stroke-note,
main.mode-transition .board,
main.mode-transition .btns,
main.mode-transition .practice-tools:not([hidden]),
main.mode-transition .status,
main.mode-transition #answer:not([hidden]),
main.mode-transition #hint {
  animation: mode-enter 0.52s var(--ease) both;
  animation-delay: var(--mode-delay, 0ms);
}
main.mode-transition .utility-nav {
  --mode-delay: 0ms;
}
main.mode-transition .top {
  --mode-delay: 35ms;
}
main.mode-transition #mode-label {
  --mode-delay: 80ms;
}
main.mode-transition .stroke-note {
  --mode-delay: 115ms;
}
main.mode-transition .board {
  --mode-delay: 145ms;
}
main.mode-transition .btns,
main.mode-transition .practice-tools:not([hidden]) {
  --mode-delay: 190ms;
}
main.mode-transition .status {
  --mode-delay: 235ms;
}
main.mode-transition #answer:not([hidden]),
main.mode-transition #hint {
  --mode-delay: 280ms;
}
main.mode-transition .mode-toggle {
  animation: mode-toggle-pop 0.48s var(--pop) both;
}
@keyframes mode-enter {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  65% {
    opacity: 1;
    transform: translateY(-2px) scale(1.005);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes mode-toggle-pop {
  0% {
    opacity: 0.7;
    transform: scale(0.84);
  }
  65% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes wipein {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
#pips {
  display: flex;
  gap: 6px;
  align-self: flex-start;
  padding-top: 6px;
  flex: none;
}
#pips[hidden] {
  display: none;
}
.pip {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--fg);
}
.pip.on {
  background: var(--fg);
}
.pip.win {
  background: var(--g);
  border-color: var(--g);
}
.pip.pop {
  animation: drop 0.5s var(--pop) var(--d, 0.9s) both;
}

/* ---------- hint ---------- */
#hint:empty {
  display: none;
}
.hint {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 16px;
  padding: 16px;
  border: 3px solid var(--fg);
  border-radius: 26px;
  background: color-mix(in srgb, var(--y) 26%, var(--card));
}
.hint.in {
  animation: wipein 0.45s var(--ease) var(--d, 0s) both;
}
.hint-tag {
  flex: none;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--y);
  color: #14151b;
  font: 700 13px/1 var(--display);
  letter-spacing: -0.02em;
}
.hint-rows {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.hint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.hint-row b {
  width: 34px;
  font: 700 12px/1 var(--display);
  letter-spacing: -0.02em;
  color: var(--mut);
}
.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid var(--fg);
  background: var(--card);
  font: 700 19px/1 var(--body);
}

/* ---------- answer ---------- */
#answer[hidden] {
  display: none;
}
.ans {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border: 3px solid var(--fg);
  border-radius: 28px;
}
.ans.win {
  background: color-mix(in srgb, var(--g) 20%, var(--card));
  color: var(--fg);
}
.ans.lose {
  background: color-mix(in srgb, var(--r) 16%, var(--card));
  color: var(--fg);
}
.ans.in {
  animation: wipein 0.5s var(--ease) var(--d, 0s) both;
}
.ans-k {
  flex: none;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font:
    400 84px/1 "Yuji Boku",
    "Hiragino Mincho ProN",
    "Yu Mincho",
    "Noto Serif JP",
    serif;
}
.ans-character {
  display: block;
  transform: translateY(-0.05em);
}
.ans.win .ans-k,
.ans.lose .ans-k {
  background: var(--card);
  color: var(--fg);
  border: 2px solid var(--fg);
}
.ans.in .ans-k {
  animation: drop 0.55s var(--pop) calc(var(--d, 0s) + 0.25s) both;
}
.ans-body {
  display: grid;
  gap: 9px;
  min-width: 0;
}
.practice-next {
  margin-top: 6px;
}
.ans-tag {
  justify-self: start;
  padding: 7px 12px;
  border-radius: 999px;
  color: #fff;
  font: 700 12px/1 var(--display);
  letter-spacing: -0.02em;
}
.ans.win .ans-tag {
  background: var(--g);
}
.ans.lose .ans-tag {
  background: var(--r);
}
.ans-mean {
  font: 800 24px/1.05 var(--display);
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}
.ans-read {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0.85;
}
.ans-read b {
  font: 700 12px/1.7 var(--display);
  opacity: 0.6;
}
.share-button {
  width: 100%;
}
.share-button:disabled {
  opacity: 1;
}
.share-button.copying {
  cursor: wait;
}
.share-button.copied {
  border-color: var(--g);
  background: var(--g);
  color: #fff;
  animation: share-success 0.45s var(--pop) both;
}
.share-button.copy-error {
  border-color: var(--r);
  background: var(--r);
  color: #fff;
  animation: share-failure 0.35s ease both;
}
.share-result {
  display: grid;
  margin-top: 20px;
}
@keyframes share-success {
  0% {
    opacity: 0.65;
    transform: scale(0.94);
  }
  65% {
    transform: scale(1.04);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes share-failure {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

/* ---------- history ---------- */
#hist {
  margin-top: 14px;
}
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 2px solid var(--line);
}
.history-body {
  flex: 1;
  min-width: 0;
}
.th {
  width: 72px;
  height: 72px;
  border: 2px solid var(--fg);
  border-radius: 18px;
  background: var(--card);
  flex: none;
}
.tiles {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.tiles span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
}
.g {
  background: var(--g);
}
.y {
  background: var(--y);
}
.n {
  background: var(--n);
}
.txt {
  font-size: 14px;
  font-weight: 500;
  color: var(--mut);
  margin-top: 9px;
  width: 100%;
}
.row.new .th {
  animation: wipein 0.7s var(--ease) 0.35s both;
}
.row.new .tiles span {
  animation: drop 0.45s var(--pop) both;
  animation-delay: calc(0.6s + var(--i, 0) * 70ms);
}
.row.new .txt {
  animation: fade 0.5s ease 0.9s both;
}

/* ---------- support ---------- */
.support-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding: 16px;
  border: 2px solid var(--fg);
  border-radius: 24px;
  background: color-mix(in srgb, var(--g) 20%, var(--card));
  color: var(--fg);
  text-decoration: none;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s ease;
}
.support-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 color-mix(in srgb, var(--fg) 12%, transparent);
}
.support-card:focus-visible {
  outline: 3px solid var(--g);
  outline-offset: 3px;
}
.support-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--fg);
  color: var(--bg);
  font-size: 23px;
  object-fit: cover;
}
.support-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.support-copy b {
  font: 700 14px/1.2 var(--display);
}
.support-copy span {
  color: var(--mut);
  font-size: 13px;
  line-height: 1.3;
}
.support-link {
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- information dialog ---------- */
#info-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(82dvh, 640px);
  margin: auto;
  padding: 24px;
  overflow: auto;
  border: 3px solid var(--fg);
  border-radius: 28px;
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 16px 48px #0003;
}
#info-dialog[open] {
  animation: dialog-in 0.32s var(--ease) both;
}
#info-dialog::backdrop {
  background: #10111688;
  animation: backdrop-in 0.25s ease both;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}
.dialog-eyebrow {
  color: var(--mut);
  font: 700 11px/1.2 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#dialog-title {
  margin: 7px 0 0;
  font: 800 clamp(21px, 6vw, 28px)/1.1 var(--display);
  letter-spacing: -0.045em;
}
.dialog-close {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border-color: var(--line);
  font-size: 25px;
  line-height: 1;
}
.dialog-content {
  min-width: 0;
}
.practice-setting {
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 18px;
}
.practice-setting legend {
  padding: 0 6px;
  color: var(--mut);
  font: 700 11px/1.2 var(--display);
  letter-spacing: 0.04em;
}
.practice-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  font-weight: 600;
  cursor: pointer;
}
.practice-choice + .practice-choice {
  border-top: 1px solid var(--line);
}
.practice-choice input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--g);
}
.practice-choice-copy {
  display: grid;
  gap: 3px;
}
.practice-choice-copy span,
.practice-settings-note {
  color: var(--mut);
  font-size: 13px;
}
.practice-settings-note {
  margin: 0 2px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.stat-card {
  min-width: 0;
  padding: 14px 10px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 60%, var(--card));
  animation: dialog-item-in 0.4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 90ms);
}
@keyframes dialog-item-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.stat-value {
  display: block;
  font: 800 clamp(24px, 8vw, 34px)/1 var(--display);
  letter-spacing: -0.06em;
}
.stat-label {
  display: block;
  margin-top: 8px;
  color: var(--mut);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.stats-note {
  margin: 16px 2px 0;
  color: var(--mut);
  font-size: 13px;
}
.next-kanji {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 2px solid var(--fg);
  border-radius: 18px;
  background: color-mix(in srgb, var(--g) 12%, var(--card));
}
.next-kanji-label {
  color: var(--mut);
  font: 700 10px/1.2 var(--display);
  letter-spacing: 0.08em;
}
.next-kanji-time {
  font: 800 clamp(24px, 8vw, 32px)/1 var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
}
.next-kanji-note {
  color: var(--mut);
  font-size: 12px;
}
.accuracy-label {
  display: block;
  margin-top: 16px;
  color: var(--mut);
  font: 700 10px/1.2 var(--display);
  letter-spacing: 0.08em;
}
.accuracy-meter {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}
.accuracy-track {
  flex: 1;
  min-width: 0;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.accuracy-fill {
  height: 100%;
  width: var(--accuracy, 0%);
  border-radius: inherit;
  background: var(--g);
  transform-origin: left;
  animation: accuracy-in 0.7s var(--ease) 0.25s both;
}
@keyframes accuracy-in {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.accuracy-percent {
  flex: none;
  width: 44px;
  text-align: right;
  font: 700 13px/1 var(--display);
  font-variant-numeric: tabular-nums;
}
.help-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.help-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 13px;
  border: 2px solid var(--line);
  border-radius: 18px;
  animation: dialog-item-in 0.4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 100ms);
}
.help-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--fg);
  color: var(--bg);
  font: 700 13px/1 var(--display);
}
.help-step b {
  display: block;
  margin: 1px 0 4px;
  font: 700 14px/1.2 var(--display);
}
.help-step span:last-child {
  color: var(--mut);
  font-size: 13px;
}
.help-credits {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--mut);
  font-size: 11px;
  line-height: 1.4;
}
.help-feedback-green {
  color: var(--help-green);
}
.help-feedback-yellow {
  color: var(--help-yellow);
}

@media (max-width: 390px) {
  .support-card {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .support-icon {
    width: 40px;
    height: 40px;
  }
  .support-link {
    grid-column: 2;
    justify-self: start;
  }
  .ans-k {
    width: 88px;
    height: 88px;
    font-size: 68px;
  }
  .ans {
    gap: 12px;
  }
}
@media (max-width: 340px) {
  main {
    padding-right: 14px;
    padding-left: 14px;
  }
  .status {
    gap: 8px;
  }
  #pips {
    gap: 4px;
  }
  .support-card {
    padding: 12px;
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

.profile-button .profile-photo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.profile-button.has-photo svg {
  display: none;
}
.profile-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.profile-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--fg);
  font: 600 15px var(--body);
}
.profile-form button {
  padding: 10px 16px;
  font-size: 13px;
}
.dist {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.dist-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dist-row b {
  width: 12px;
  font: 700 12px var(--display);
}
.dist-row .accuracy-track {
  flex: 1;
}
.dist-count {
  width: 28px;
  text-align: right;
  font: 700 12px var(--display);
}
.profile-out {
  width: 100%;
  margin-top: 20px;
}
.profile-avatar {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 8px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--fg);
}

.dialog-close {
  transition: none;
}
@media (hover: hover) {
  button.dialog-close:hover {
    background: transparent;
    color: var(--fg);
    border-color: var(--fg);
  }
}

#info-dialog {
  overflow: hidden;
}
#info-dialog[open] {
  display: flex;
  flex-direction: column;
}
.dialog-head {
  flex: none;
}
.dialog-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin: -6px -10px -6px -6px;
  padding: 6px 10px 6px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

body.booting main {
  visibility: hidden;
}
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition:
    opacity 0.4s ease,
    visibility 0s linear 0.4s;
}
#page-loader > * {
  opacity: 0;
  animation: fade 0.3s ease 0.2s forwards;
}
#page-loader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-text {
  color: var(--mut);
  font: 700 13px/1 var(--display);
  letter-spacing: -0.02em;
}

/* ---------- practice streak chip ---------- */
.status-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}
.status-side #pips {
  align-self: flex-end;
}
.streak {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px 3px 8px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 84%, transparent);
  font: 800 13px/1 var(--display);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  cursor: default;
  transition:
    border-color 0.4s var(--ease),
    box-shadow 0.4s var(--ease);
}
.streak[hidden] {
  display: none;
}
.flame {
  width: 12px;
  height: 16px;
  flex: none;
  overflow: visible;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 0 3px #ff7a1a66);
  animation: flicker 1.5s ease-in-out infinite alternate;
  transition: filter 0.4s var(--ease);
}
.flame-out {
  fill: url(#flame-grad);
}
.flame-in {
  fill: url(#flame-core);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: flicker-core 1.1s ease-in-out infinite alternate;
}
@keyframes flicker {
  0% {
    transform: scale(1, 1) skewX(0deg);
  }
  30% {
    transform: scale(0.95, 1.06) skewX(-3deg);
  }
  60% {
    transform: scale(1.03, 0.96) skewX(2deg);
  }
  100% {
    transform: scale(0.97, 1.04) skewX(-1deg);
  }
}
@keyframes flicker-core {
  from {
    transform: scale(1, 1);
  }
  to {
    transform: scale(0.88, 1.14);
  }
}
.streak[data-tier="0"] .flame {
  animation: none;
  filter: grayscale(1);
  opacity: 0.4;
}
.streak[data-tier="0"] .flame-in {
  animation: none;
}
.streak[data-tier="2"] {
  border-color: color-mix(in srgb, #ff8a1f 45%, var(--line));
}
.streak[data-tier="2"] .flame {
  filter: drop-shadow(0 0 5px #ff7a1a99);
}
.streak[data-tier="3"] {
  border-color: color-mix(in srgb, #ff8a1f 75%, var(--line));
  box-shadow: 0 0 14px #ff7a1a33;
}
.streak[data-tier="3"] .flame {
  filter: drop-shadow(0 0 6px #ff7a1acc);
}
.streak.bump {
  animation: streak-bump 0.6s var(--pop);
}
.streak.bump .flame {
  animation: flame-surge 0.6s ease;
}
@keyframes streak-bump {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.18);
    box-shadow: 0 0 18px #ff7a1a66;
  }
  100% {
    transform: scale(1);
  }
}
@keyframes flame-surge {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.35, 1.5);
  }
  100% {
    transform: scale(1);
  }
}
.streak.out .flame {
  animation: flame-out 0.55s ease forwards;
}
@keyframes flame-out {
  to {
    opacity: 0.4;
    transform: scale(0.45, 0.25);
    filter: grayscale(1);
  }
}

/* ---------- streak warning (practice options) ---------- */
.streak-warning {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 2px solid var(--r);
  border-radius: 18px;
  background: color-mix(in srgb, var(--r) 10%, var(--card));
  animation: dialog-item-in 0.35s var(--ease) both;
}
.streak-warning[hidden] {
  display: none;
}
.streak-warning-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.streak-warning-head .flame {
  width: 18px;
  height: 24px;
}
.streak-warning-copy {
  display: grid;
  gap: 3px;
}
.streak-warning-copy span {
  color: var(--mut);
  font-size: 13px;
}
.streak-warning-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.streak-warning-actions button {
  padding: 9px 14px;
  font-size: 13px;
}
button.danger {
  border-color: var(--r);
  color: var(--r);
}
@media (hover: hover) {
  button.danger:hover:not(:disabled) {
    background: var(--r);
    border-color: var(--r);
    color: #fff;
  }
}
.practice-streak-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--mut);
  font-size: 13px;
}
.flame.mini {
  width: 11px;
  height: 15px;
  animation: none;
  filter: none;
}
.flame.mini .flame-in {
  animation: none;
}

/* ---------- practice leaderboard ---------- */
.lb {
  margin-top: 16px;
}
.lb-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.lb-label {
  color: var(--mut);
  font: 700 10px/1.2 var(--display);
  letter-spacing: 0.08em;
}
.lb-sub {
  color: var(--mut);
  font-size: 12px;
  font-weight: 600;
}
.lb-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 60%, var(--card));
}
.lb-list[hidden] {
  display: none;
}
.lb-row {
  display: grid;
  grid-template-columns: 26px 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
  animation: dialog-item-in 0.4s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}
.lb-row + .lb-row,
.lb-gap + .lb-row {
  border-top: 1px solid var(--line);
}
.lb-gap {
  padding-bottom: 2px;
  border-top: 1px solid var(--line);
  color: var(--mut);
  line-height: 10px;
  text-align: center;
}
.lb-row.me {
  background: color-mix(in srgb, var(--g) 14%, var(--card));
}
.lb-rank {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--mut);
  font: 800 12px/1 var(--display);
  letter-spacing: -0.04em;
}
.lb-row[data-rank="1"] .lb-rank {
  background: linear-gradient(145deg, #f4cf4d, #d9a413);
  color: #3b2a00;
}
.lb-row[data-rank="2"] .lb-rank {
  background: linear-gradient(145deg, #d9dce3, #a9adb8);
  color: #2b2d34;
}
.lb-row[data-rank="3"] .lb-rank {
  background: linear-gradient(145deg, #e0a46a, #b8763a);
  color: #3a1f08;
}
.lb-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--fg) 8%, var(--card));
  color: var(--mut);
  font: 800 12px/1 var(--display);
}
.lb-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lb-row[data-rank="1"] .lb-avatar {
  border-color: #d9a413;
}
.lb-name {
  min-width: 0;
  overflow: hidden;
  font: 700 14px/1.2 var(--body);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-you {
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font: 700 9px/1 var(--display);
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.lb-score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 800 15px/1 var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
}
.lb-row[data-rank="1"] .flame.mini {
  animation: flicker 1.5s ease-in-out infinite alternate;
}
.lb-row.skeleton > span {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--line) 0%,
    color-mix(in srgb, var(--line) 40%, transparent) 50%,
    var(--line) 100%
  );
  background-size: 200% 100%;
  animation: lb-shimmer 1.2s linear infinite;
}
.lb-row.skeleton .lb-name {
  width: 60%;
  height: 12px;
}
.lb-row.skeleton .lb-score {
  width: 34px;
  height: 12px;
}
@keyframes lb-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}
.lb-foot {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.lb-foot:empty {
  display: none;
}
.lb-empty {
  margin: 0 2px;
  color: var(--mut);
  font-size: 13px;
}
.lb-signin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  border: 2px dashed var(--line);
  border-radius: 18px;
  color: var(--mut);
  font-size: 13px;
  font-weight: 600;
}
.lb-signin button,
.lb-retry {
  flex: none;
  padding: 8px 14px;
  font-size: 13px;
}
.lb-retry {
  justify-self: start;
}
