/* src/styles/tokens.css */
:root {
  --paper: #FFFFFF;
  --ink: #1B1D1F;
  --muted: #6B7076;
  --line: #E4E6E8;
  --ok: #2E8B4A;
  --no: #C4453A;
  --topic: #3C8C4A;
  --tap: 72px;
  --r: 14px;
  --f:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}

/* src/styles/touch.css */
:root {
  color-scheme: light;
}
button,
a.btn,
.word-row,
.choice-btn {
  touch-action: manipulation;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.choice-btn {
  -webkit-touch-callout: none;
  user-select: none;
}
.word-list {
  overscroll-behavior-y: contain;
}
body.is-game {
  overflow: hidden;
  height: 100dvh;
}
.loading {
  opacity: 0;
  animation: loading-in 120ms 250ms forwards;
}
@keyframes loading-in {
  to {
    opacity: 1;
  }
}
input,
select,
textarea {
  font-size: max(16px, 1rem);
}
.word-row[data-playing] .audio-icon {
  animation: pulse 0.6s infinite alternate;
}
@keyframes pulse {
  to {
    opacity: 0.4;
  }
}
.word-row[data-playing] {
  background: color-mix(in srgb, var(--topic) 8%, transparent);
}
.install-banner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  text-align: center;
}
@media print {
  nav,
  .game-buttons,
  .install-banner,
  script {
    display: none;
  }
  body {
    font-size: 11pt;
  }
  .word-row {
    break-inside: avoid;
    border-bottom: 0.5pt solid #ccc;
  }
  .word-list {
    column-count: 2;
    column-gap: 1.5cm;
  }
  .audio-icon {
    display: none;
  }
}

/* src/styles/base.css */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-family: var(--f);
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
}
a {
  color: var(--topic);
}
button {
  font-family: inherit;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 1.25rem;
  border-radius: var(--r);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  transition: opacity 150ms;
}
.btn:active {
  opacity: 0.75;
}
.btn-primary {
  background: var(--topic);
  color: #fff;
}
.btn-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: transparent;
}
.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 1.5rem;
  text-align: center;
}
.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.result-score {
  font-size: 1.5rem;
}
.result-record {
  color: var(--muted);
}
.result-record--new {
  color: var(--ok);
  font-weight: 700;
}
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
  margin-top: 0.5rem;
}
.picker {
  padding: 1.5rem;
}
.picker h2 {
  margin-bottom: 1rem;
}
.picker-suggestion {
  margin-bottom: 1rem;
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.topic-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: var(--r);
  border: 2px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 150ms;
  min-height: var(--tap);
}
.topic-card:hover {
  border-color: var(--topic);
}
.topic-card__code {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.topic-card__title {
  font-weight: 600;
}
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--muted);
}
.topic-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 1rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 10;
}
.topic-page {
  margin-left: auto;
  font-size: 0.875rem;
  color: var(--muted);
}
.topic-actions {
  display: flex;
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
}
.topic-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.875rem 0.5rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  border-right: 1px solid var(--line);
  transition: background 150ms;
}
.topic-action-btn:last-child {
  border-right: none;
}
.topic-action-btn:active {
  background: color-mix(in srgb, var(--topic) 8%, transparent);
}
.topic-action-icon {
  font-size: 1.5rem;
}
.word-list {
  list-style: none;
  padding: 0;
}
.word-row {
  display: grid;
  grid-template-columns: var(--tap) 1fr 48px;
  align-items: center;
  min-height: var(--tap);
  border-bottom: 1px solid var(--line);
}
.word-sprite {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background-repeat: no-repeat;
  overflow: hidden;
}
.word-row:active {
  background: color-mix(in srgb, var(--topic) 6%, transparent);
}
.audio-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.word-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.5rem 0;
}
.word-top {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.word-en {
  font-size: 1.125rem;
  font-weight: 600;
}
.word-ipa {
  font-size: 0.75rem;
  color: var(--muted);
}
.word-pl {
  font-size: 0.875rem;
}
.stars {
  display: flex;
  gap: 2px;
}
.star {
  font-size: 1.1rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(*) {
    animation-duration: 180ms;
  }
}
