:root {
  --accent-blue: #375E97;
  --accent-yellow: #FFBB00;
  --accent-yellow-text: #6B4700;
  --text-primary: #4c4c4c;
  --text-secondary: #666666;
  --surface: #FFFFFF;
  --surface-alt: #1E2430;
  --bg-light: #F7F9FC;
  --border: #EAEAEA;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --modal-overlay: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg-light);
  color: var(--text-primary);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

.top {
  text-align: center;
  padding: 14px 12px 8px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: 800;
  letter-spacing: .24em;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  color: var(--accent-blue);
}

.logo .vowel-logo {
  color: var(--accent-yellow);
}

/* Sub-header Puzzle Navigation Bar */
.puzzle-nav-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.puzzle-nav-container {
  width: 100%;
  max-width: 1050px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-view {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Default (Explorer) mode */
.nav-view-in-session {
  display: none;
}

.nav-view-explorer {
  display: flex;
}

/* In-Session mode activated via JS */
.puzzle-nav-bar.is-in-session .nav-view-in-session {
  display: flex;
}

.puzzle-nav-bar.is-in-session .nav-view-explorer {
  display: none;
}

/* Common Navigation Button Styles */
.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.18s ease-in-out;
  cursor: pointer;
  line-height: 1.3;
  user-select: none;
}

.nav-btn .nav-icon {
  flex-shrink: 0;
}

/* Secondary Button (Prev, Next, Today) */
.nav-btn-secondary {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.nav-btn-secondary:hover:not(.disabled) {
  background: #ECEFF5;
  color: var(--accent-blue);
  border-color: #D3D8E2;
}

/* Primary Button (Play This Puzzle, Back to Puzzle) */
.nav-btn-primary {
  background: var(--accent-blue);
  color: #FFFFFF;
  border: 1px solid var(--accent-blue);
  box-shadow: var(--shadow-sm);
}

.nav-btn-primary:hover {
  background: #2D4E7F;
  border-color: #2D4E7F;
  color: #FFFFFF;
}

/* Disabled State (Future Puzzles) */
.nav-btn.disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--bg-light);
  color: var(--text-secondary);
  border-color: var(--border);
  box-shadow: none;
}

@media (max-width: 600px) {
  .puzzle-nav-bar {
    padding: 6px 10px;
  }

  .nav-view {
    gap: 6px;
  }

  .nav-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
}

.theme-line {
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 10px 12px;
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  font-weight: 700;
}

.container {
  max-width: 1050px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.intro {
  max-width: 820px;
  margin: 0 auto 26px;
  text-align: center;
  color: var(--text-secondary);
}

.rules {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.rule {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 10px;
  border-radius: 5px;
  font-size: .9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.word-card {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.word-header {
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.index {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: rgba(55, 94, 151, 0.12);
  color: var(--accent-blue);
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 8px;
  flex: 0 0 auto;
}

.letter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.letter {
  width: 38px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease;
}

.letter.consonant {
  background: linear-gradient(180deg, #4A74B2 0%, var(--accent-blue) 100%);
  color: var(--surface);
}

.letter.vowel {
  background: linear-gradient(180deg, #FFCD38 0%, var(--accent-yellow) 100%);
  color: var(--accent-yellow-text);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

.word-header .letter.consonant {
  color: transparent;
}

details {
  border-top: 1px solid var(--border);
}

summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.15s ease, color 0.15s ease;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary:hover {
  background: rgba(0, 0, 0, 0.025);
}

summary:active {
  background: rgba(0, 0, 0, 0.05);
}

.summary-label {
  display: inline-flex;
  align-items: center;
}

.summary-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 10px;
  flex: 0 0 auto;
  line-height: 1;
}

.summary-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}

.icon-hint {
  background: rgba(245, 158, 11, 0.14);
  color: #D97706;
}

.icon-answer {
  background: rgba(59, 130, 246, 0.14);
  color: #2563EB;
}

.icon-info {
  background: rgba(139, 92, 246, 0.14);
  color: #7C3AED;
}

summary::after {
  content: "";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: rgba(55, 94, 151, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23375E97' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  flex: 0 0 auto;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease;
  transform: rotate(0deg);
}

details[open] summary {
  background: rgba(0, 0, 0, 0.015);
}

details[open] summary::after {
  transform: rotate(90deg);
  background-color: rgba(55, 94, 151, 0.16);
}

.detail {
  padding: 2px 18px 16px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.detail ol {
  margin: 0;
  padding-left: 20px;
}

.answer-panel .detail {
  background: var(--bg-light);
  padding: 14px 18px 16px;
}

.reveal {
  padding-bottom: 2px;
}

.trivia {
  margin-top: 30px;
  border-top: 2px solid var(--accent-blue);
  padding-top: 20px;
}

.trivia h2 {
  text-align: center;
  color: var(--accent-blue);
}

.trivia-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.fact {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 15px;
  border-radius: 4px;
}

.fact strong {
  color: var(--accent-blue);
}

.app-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.footer-social-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.social-link-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.social-link-item:hover {
  transform: translateY(-2px);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.social-link-item svg {
  width: 20px;
  height: 20px;
  display: block;
}

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.95rem;
}

.footer-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.footer-link:hover {
  text-decoration: underline;
}

.footer-divider {
  color: var(--text-secondary);
  user-select: none;
}

.footer-copyright {
  color: var(--text-secondary);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

@media(max-width: 760px) {

  .grid,
  .trivia-grid {
    grid-template-columns: 1fr;
  }

  .letter {
    width: 33px;
    height: 40px;
    font-size: 1.15rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #FEFEFE;
    --text-secondary: #A0AEC0;

    --bg-light: #1A1F2B;
    --border: #2A2F3A;

    --surface: #121620;
    --surface-alt: #1E2430;

    /* Slightly tuned brand colors for dark */
    --accent-blue: #4C7EDB;
    --accent-yellow: #FFC933;
    --accent-yellow-text: #2B1800;
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.45), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
    --modal-overlay: rgba(0, 0, 0, 0.7);
  }

  .letter {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.3);
  }

  .index {
    background: rgba(76, 126, 219, 0.2);
    color: var(--accent-blue);
  }

  summary:hover {
    background: rgba(255, 255, 255, 0.03);
  }

  summary:active {
    background: rgba(255, 255, 255, 0.06);
  }

  summary::after {
    background-color: rgba(76, 126, 219, 0.18);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234C7EDB' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
  }

  details[open] summary {
    background: rgba(255, 255, 255, 0.02);
  }

  details[open] summary::after {
    background-color: rgba(76, 126, 219, 0.3);
  }

  .icon-hint {
    background: rgba(245, 158, 11, 0.2);
    color: #FBBF24;
  }

  .icon-answer {
    background: rgba(76, 126, 219, 0.22);
    color: #60A5FA;
  }

  .icon-info {
    background: rgba(168, 85, 247, 0.22);
    color: #C084FC;
  }
}