:root {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #ffffff;
  --accent: #1d4ed8;
}

html.dark {
  color-scheme: dark;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: #1e293b;
  --paper: #0b0d10;
  --accent: #60a5fa;
}

html,
body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: Inter, "Noto Sans TC", "Noto Sans JP", "Noto Sans KR", "Noto Sans Thai", sans-serif;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: #dbeafe;
  color: #1e3a8a;
}

html.dark ::selection {
  background: #1e3a8a;
  color: #eff6ff;
}

.font-display {
  font-family: "Plus Jakarta Sans", "Noto Sans TC", "Noto Sans JP", "Noto Sans KR", sans-serif;
}

.jp-text {
  font-family: "Noto Sans JP", sans-serif;
}

.kr-text {
  font-family: "Noto Sans KR", sans-serif;
}

.thai-text {
  font-family: "Noto Sans Thai", sans-serif;
  line-height: 1.85 !important;
}

.blur-mask {
  filter: blur(7px);
  opacity: 0.45;
  user-select: none;
  transition: filter 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
}

.blur-mask.is-revealed {
  filter: none;
  opacity: 1;
  user-select: auto;
}

@keyframes pulseWave {
  0%,
  100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.speaking {
  animation: pulseWave 0.6s infinite ease-in-out;
}

@keyframes wrongShake {
  0%,
  100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.is-wrong {
  animation: wrongShake 0.28s ease;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.topbar {
  padding-top: env(safe-area-inset-top);
}

.tabbar {
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet {
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

input,
select,
textarea {
  font-size: 16px;
}

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