:root {
  --bg: #0f172a;
  --fg: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
}

/* Light theme variables */
:root[data-theme="light"] {
  --bg: #f7fafc;
  --fg: #0f172a;
  --muted: #334155;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--fg);
  background: var(--bg);
}

/* Keep subtle highlight only for light theme */
:root[data-theme="light"] body {
  background: radial-gradient(1200px 800px at 80% -200px, #cbd5e1 0%, var(--bg) 60%);
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.6);
  color: var(--fg);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.container {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(1024px, 100%);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* Light theme card adjustments */
:root[data-theme="light"] .card {
  background: rgba(255,255,255,0.9);
  border-color: rgba(15,23,42,0.12);
  box-shadow: 0 10px 30px rgba(2,6,23,0.08);
}

.kana {
  font-size: clamp(72px, 14vw, 168px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 16px 0 8px;
}

.kana-pair {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(16px, 5vw, 48px);
}

.kana.katakana {
  font-weight: 600;
  opacity: 0.9;
}

.romaji {
  font-size: clamp(22px, 4vw, 36px);
  color: var(--muted);
  margin-bottom: 28px;
  min-height: 1.4em;
}

/* Five-cards layout */
.cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.item-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  border-radius: 14px;
  padding: 18px 12px;
}

:root[data-theme="light"] .item-card {
  background: rgba(241,245,249,0.85);
  border-color: rgba(15,23,42,0.12);
}

.item-kana {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.item-kana .hira { font-size: 60px; font-weight: 700; }
.item-kana .kata { font-size: 56px; opacity: 0.95; }

.item-roma { color: var(--muted); font-size: 20px; min-height: 1.8em; }
.item-roma.hidden { visibility: hidden; }

.item-actions { margin-top: 8px; }
.item-actions .btn { padding: 8px 10px; font-size: 14px; }

/* Review grid placeholders */
.cell.placeholder {
  background: transparent;
  border-color: transparent;
}

.hidden {
  display: none;
}

.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.top-controls {
  margin-bottom: 16px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.6);
  color: var(--fg);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.2s ease, border-color 0.2s ease;
}

:root[data-theme="light"] .btn {
  background: rgba(241,245,249,0.9);
  border-color: rgba(15,23,42,0.15);
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(226, 232, 240, 0.6);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  border-color: rgba(34, 211, 238, 0.6);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(167, 139, 250, 0.18));
}

.btn.primary:hover {
  border-color: rgba(167, 139, 250, 0.8);
}

.btn.outline {
  background: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Overlay styles */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(2, 6, 23, 0.7);
  backdrop-filter: blur(4px);
  z-index: 50;
}

/* Ensure hidden state wins over base overlay display */
.overlay.hidden {
  display: none !important;
}

:root[data-theme="light"] .overlay {
  background: rgba(15, 23, 42, 0.4);
}

.modal {
  width: min(1200px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}

/* Light theme modal */
:root[data-theme="light"] .modal {
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.12);
  box-shadow: 0 24px 60px rgba(2,6,23,0.12);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  gap: 6px;
  padding: 10px;
}

.cell {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  border-radius: 10px;
  padding: 8px;
  text-align: center;
}

/* Light theme cell */
:root[data-theme="light"] .cell {
  background: rgba(241,245,249,0.85);
  border-color: rgba(15,23,42,0.12);
}

.cell .hira {
  font-size: 26px;
  font-weight: 700;
}

.cell .kata {
  font-size: 24px;
  opacity: 0.95;
}

.cell .roma {
  color: var(--muted);
  margin-top: 4px;
  font-size: 13px;
}


