:root {
  --bg: #eef2f7;
  --text: #1b2430;
  --muted: #5b6878;
  --accent: #1f4e79;
  --accent-soft: #dce8f5;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(20, 40, 70, 0.15);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111821;
    --text: #e8edf3;
    --muted: #9aa8b8;
    --accent: #8cbcf0;
    --accent-soft: #1d2b3b;
    --card: #1a2430;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}

.app__header {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.app__header h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--accent);
}

.app__progress {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.card {
  width: 100%;
  max-width: 440px;
  flex: 1;
  max-height: 720px;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: center;
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 120ms ease;
}

.card:active {
  transform: scale(0.985);
}

.card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.card:disabled {
  cursor: progress;
}

/* Sign drawings are black line art on white, so keep the image area white in both themes. */
.card__image-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #fff;
}

.card__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 150ms ease;
}

.card__image.is-loading {
  opacity: 0;
}

.card__loading {
  position: absolute;
  color: #5b6878;
}

.card__loading[hidden] {
  display: none;
}

.card__answer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 20px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 220ms ease,
    opacity 220ms ease,
    padding 220ms ease;
}

.card.is-revealed .card__answer {
  max-height: 220px;
  opacity: 1;
  padding: 18px 20px 6px;
}

.card__meaning {
  font-size: clamp(1.8rem, 8vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
}

.card__category {
  font-size: 0.95rem;
  color: var(--muted);
}

.card__notes {
  font-size: 0.95rem;
  color: var(--muted);
  font-style: italic;
}

.card__notes:empty {
  display: none;
}

.card__hint {
  margin: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
