/* ============================================================
   Government vocabulary — flashcards
   Cool ice-glass study deck: calm cool-white/ice-blue canvas,
   restrained translucent surfaces, one soft specular highlight.
   Light theme by design direction.
   ============================================================ */

:root {
  --bg-top: #F3F8FC;
  --bg-bottom: #E2EDF7;
  --ink: #0F2A40;
  --ink-2: #3F5E78;
  --ink-3: #61798F;
  --accent: #1B6DB5;
  --accent-press: #175FA0;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.85);
  --hairline: rgba(15, 42, 64, 0.05);
  --shadow-soft: 0 10px 26px rgba(15, 42, 64, 0.10);
  --shadow-card: 0 18px 44px rgba(15, 42, 64, 0.12);
  --flip-ms: 190ms;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 540px at 50% -160px, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed;
  padding: 14px 14px 56px;
}

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid rgba(27, 109, 181, 0.85); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.app {
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- toolbar ---- */
.toolbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  border-radius: 20px;
  padding: 13px 16px 15px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.counts { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.count-sep { color: var(--ink-3); }

.btn-restart {
  flex: none;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 42, 64, 0.10);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-restart:hover { background: rgba(255, 255, 255, 0.92); color: var(--ink); }

.progress {
  margin-top: 12px;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 42, 64, 0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.35s ease;
}

/* ---- card ---- */
.card {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  width: 100%;
  min-height: clamp(280px, 46vh, 400px);
  padding: 34px 26px;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  perspective: 1000px;
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.55));
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  color: var(--ink);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* the one soft specular highlight */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 46%;
  background: radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transition: transform var(--flip-ms) cubic-bezier(0.2, 0.7, 0.3, 1), opacity var(--flip-ms) ease;
}
.card-inner.flip-out { transform: rotateY(90deg); opacity: 0; }
.card-inner.flip-in  { transform: rotateY(-90deg); opacity: 0; }
.no-anim { transition: none !important; }

.face-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.term {
  font-size: clamp(30px, 7vw, 46px);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.08;
  text-wrap: balance;
  max-width: 16ch;
}

.definition {
  font-size: clamp(16.5px, 2.6vw, 19px);
  line-height: 1.62;
  font-weight: 400;
  text-align: left;
  max-width: 44ch;
}

.review-note {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: rgba(15, 42, 64, 0.06);
  border: 1px solid rgba(15, 42, 64, 0.08);
  padding: 4px 11px;
  border-radius: 999px;
}

.hint {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}

/* ---- action buttons ---- */
.actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  appearance: none;
  -webkit-appearance: none;
  min-height: 54px;
  padding: 14px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 18px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: transform 0.12s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.btn:active { transform: scale(0.98); }

.btn-got {
  background: var(--accent);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 22px rgba(27, 109, 181, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-got:hover { background: var(--accent-press); }

.btn-again {
  background: var(--glass-strong);
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(15, 42, 64, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.btn-again:hover { background: rgba(255, 255, 255, 0.92); }

.key {
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  padding: 1px 6px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  opacity: 0.65;
}
@media (hover: none), (pointer: coarse) {
  .key { display: none; }
}

/* ---- panels: loading / error / done ---- */
.panel {
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 0 0 1px var(--hairline), var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.skeleton-panel {
  min-height: clamp(280px, 46vh, 400px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 34px 26px;
}
.skeleton { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.sk-line {
  height: 16px;
  width: 62%;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(15, 42, 64, 0.06), rgba(15, 42, 64, 0.13), rgba(15, 42, 64, 0.06));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.sk-big { height: 34px; width: 46%; }
.sk-short { width: 38%; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.message-panel { padding: 44px 26px; text-align: center; }
.message-panel h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.message {
  margin: 0 auto 24px;
  max-width: 40ch;
  font-size: 15.5px;
  color: var(--ink-2);
}
.btn-wide { width: 100%; max-width: 300px; }

/* ---- larger screens ---- */
@media (min-width: 640px) {
  body { padding: 28px 20px 64px; }
  .card { padding: 40px 36px; border-radius: 28px; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .card-inner,
  .progress-fill,
  .btn,
  .btn-restart { transition: none; }
  .sk-line { animation: none; }
}
