@import '../assets/fonts/fonts.css';

/* css/style.css */
/* ==========================================================================
   REFINED DESIGN SYSTEM & STYLING FOR "சொல்லாடல்" (SOLLADAL) TAMIL WORD GAME
   Crafted with refined, elegant design principles:
   - Cultural temple palette & warm tactile affordances
   - Fluid typography (Noto Sans Tamil + Mukta Malar) with diacritic clearance
   - Strict 100dvh mobile viewport discipline
   - Accessible WCAG AAA contrast ratios & 3D micro-interactions
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Cultural & Educational Color Palette */
  --bg-parchment: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-card-subtle: #F5EFEB;
  
  --primary-gold: #D97706;
  --primary-gold-dark: #B45309;
  --primary-gold-light: #FEF3C7;
  
  --temple-navy: #0F172A;
  --temple-slate: #1E293B;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-subtle: #E2D9CF;
  
  /* Tile Evaluation Colors */
  --tile-default-bg: #FFFFFF;
  --tile-default-border: #CBD5E1;
  --tile-active-border: #D97706;
  
  --tile-green-bg: #16A34A;
  --tile-green-border: #15803D;
  --tile-green-text: #FFFFFF;
  
  --tile-orange-bg: #EA580C;
  --tile-orange-border: #C2410C;
  --tile-orange-text: #FFFFFF;
  
  --tile-grey-bg: #64748B;
  --tile-grey-border: #475569;
  --tile-grey-text: #FFFFFF;

  /* Tactile Button Shadows */
  --shadow-btn-gold: 0 4px 0 #B45309;
  --shadow-btn-slate: 0 4px 0 #334155;
  --shadow-btn-green: 0 4px 0 #15803D;
  --shadow-card: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Typography */
  --font-tamil: 'Mukta Malar', 'Noto Sans Tamil', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --------------------------------------------------------------------------
   2. Global Reset & Viewport Discipline (100dvh)
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-parchment);
  color: var(--text-main);
  font-family: var(--font-tamil);
  font-size: 14px;
  line-height: 1.3;
  padding-top: max(2px, env(safe-area-inset-top));
  padding-bottom: max(2px, env(safe-area-inset-bottom));
  padding-left: max(4px, env(safe-area-inset-left));
  padding-right: max(4px, env(safe-area-inset-right));
}

.app-viewport {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  max-width: 520px;
  height: 100%;          /* fill body's content box (100dvh minus safe-area insets) — not 100dvh, which overflows past the bottom inset */
  max-height: 100%;
  margin: 0 auto;
  padding: 2px 4px;
  gap: 4px;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   3. Top Section: Persistent Banner & Session Controls
   -------------------------------------------------------------------------- */
.top-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px 8px;
  box-shadow: var(--shadow-card);
  width: 100%;
  flex-shrink: 0;
}

/* Top-Subsection 1: Cultural Banner */
.top-sub1-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px dashed var(--border-subtle);
  padding-bottom: 2px;
  gap: 4px;
}

.banner-invocation {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.banner-invocation.right-text {
  align-items: flex-end;
}

.banner-tamil {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--primary-gold-dark);
  letter-spacing: 0.3px;
  line-height: 1.1;
}

.banner-english {
  font-family: var(--font-system);
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  line-height: 1;
}

.banner-title-wrap {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-title {
  font-size: clamp(1.05rem, 3.2vw, 1.35rem);
  font-weight: 800;
  color: var(--temple-navy);
  line-height: 1.05;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 2px rgba(217, 119, 6, 0.15);
}

.sub-title {
  font-family: var(--font-system);
  font-size: 0.56rem;
  font-weight: 700;
  color: var(--primary-gold-dark);
  letter-spacing: 0.8px;
  line-height: 1;
}

/* Top-Subsection 2: Session Controls (Buttons only) */
.top-sub2-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding-top: 1px;
}

.btn-pill-control {
  font-family: var(--font-tamil);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  box-shadow: 0 2px 0 #CBD5E1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.btn-pill-control:active {
  transform: translateY(2px) !important;
  box-shadow: 0 1px 0 #CBD5E1;
}

.styled-select {
  font-family: var(--font-tamil);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.styled-select:focus {
  border-color: var(--primary-gold);
}

/* --------------------------------------------------------------------------
   4. Tactile 3D Buttons (refined design standard)
   -------------------------------------------------------------------------- */
.btn-tactile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-tamil);
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  touch-action: manipulation;
}

.btn-tactile:active {
  transform: translateY(2px) !important;
}

.btn-next {
  background-color: var(--primary-gold);
  color: #FFFFFF;
  box-shadow: var(--shadow-btn-gold);
  padding: 3px 10px;
  font-size: 0.78rem;
}

.btn-next:active {
  box-shadow: 0 1px 0 #B45309;
}

/* --------------------------------------------------------------------------
   5. Middle Section: Game Board Grid on Top, Clues Panel on Bottom
   -------------------------------------------------------------------------- */
.middle-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  width: 100%;
  flex-shrink: 0;
}

/* Middle-Top: Game Board Grid */
.grid-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 0;
  margin: 0;
}

.grid-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  width: 100%;
}

.grid-tile {
  width: clamp(50px, 12vw, 68px);
  height: clamp(34px, 7.2vh, 46px);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--tile-default-bg);
  border: 1.5px solid var(--tile-default-border);
  border-radius: 8px;
  font-size: clamp(1.15rem, 3.5vw, 1.6rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3; /* Generous diacritic clearance */
  white-space: nowrap;
  padding: 0 4px;
  transition: transform 250ms var(--transition-bounce), border-color var(--transition-fast), background-color var(--transition-fast);
  cursor: pointer;
  perspective: 1000px;
}

.grid-tile.active-cell {
  border-color: var(--tile-active-border);
  box-shadow: 0 0 0 2.5px var(--primary-gold-light);
  transform: scale(1.04);
}

.grid-tile.filled {
  border-color: var(--temple-navy);
}

.grid-tile.green {
  background-color: var(--tile-green-bg);
  border-color: var(--tile-green-border);
  color: var(--tile-green-text);
}

.grid-tile.orange {
  background-color: var(--tile-orange-bg);
  border-color: var(--tile-orange-border);
  color: var(--tile-orange-text);
}

.grid-tile.grey {
  background-color: var(--tile-grey-bg);
  border-color: var(--tile-grey-border);
  color: var(--tile-grey-text);
}

/* 3D Tile Flip Animation */
.grid-tile.flip {
  animation: tileFlip 500ms ease forwards;
}

@keyframes tileFlip {
  0% { transform: rotateX(0deg); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

/* Incomplete Row Shake Animation */
.grid-row.shake {
  animation: rowShake 400ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes rowShake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* Middle-Bottom: Progressive Clues Panel (2x Height & 2-Line Spacious Cards) */
.clues-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 5px 8px;
  box-shadow: var(--shadow-card);
  gap: 3px;
  margin: 0;
  height: clamp(80px, 14vh, 120px);
  max-height: clamp(80px, 14vh, 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-gold) var(--bg-card-subtle);
  -webkit-overflow-scrolling: touch;
}

.clues-panel::-webkit-scrollbar {
  width: 5px;
}

.clues-panel::-webkit-scrollbar-track {
  background: var(--bg-card-subtle);
  border-radius: 4px;
}

.clues-panel::-webkit-scrollbar-thumb {
  background: var(--primary-gold);
  border-radius: 4px;
}

.clues-panel::-webkit-scrollbar-thumb:hover {
  background: var(--primary-gold-dark);
}

.clue-cards-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.clue-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  transition: var(--transition-fast);
}

.clue-card.active {
  border-color: var(--primary-gold);
  background-color: #FFFDF9;
}

.clue-card.locked {
  opacity: 0.7;
  background-color: #F1ECE6;
}

.clue-header-line {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--primary-gold-dark);
  line-height: 1.1;
  white-space: nowrap;
}

.clue-content-line {
  font-size: 0.78rem;
  color: var(--text-main);
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
}

.clue-ta {
  color: var(--text-main);
  font-weight: 600;
}

.clue-en {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-system);
  font-style: italic;
}

.clue-locked-notice {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* --------------------------------------------------------------------------
   6. Bottom Section: Two-Step UyirMei Combination Keypad
   -------------------------------------------------------------------------- */
.bottom-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 4px 6px;
  box-shadow: var(--shadow-card);
  width: 100%;
  flex-shrink: 0;
}

/* Bottom-Subsection 1: Synthesis Preview & Action Bar */
.bottom-sub1-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-subtle);
}

.combo-preview-container {
  display: flex;
  align-items: center;
  gap: 2px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 2px 4px;
}

.preview-tile {
  width: clamp(24px, 5.2vw, 30px);
  height: clamp(24px, 5.2vw, 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: clamp(0.85rem, 2.1vw, 1.05rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.preview-tile.preview-result {
  width: clamp(44px, 9.5vw, 56px);
  min-width: clamp(44px, 9.5vw, 56px);
  padding: 0 2px;
  white-space: nowrap;
}

.preview-tile.highlight {
  background-color: var(--primary-gold-light);
  border-color: var(--primary-gold);
  color: var(--primary-gold-dark);
  box-shadow: 0 0 0 1.5px rgba(217, 119, 6, 0.15);
}

.combo-operator {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary-gold-dark);
  user-select: none;
}

.btn-select-tick {
  width: clamp(26px, 5.4vw, 32px);
  height: clamp(24px, 5.2vw, 30px);
  background-color: var(--tile-green-bg);
  color: #FFFFFF;
  border: none;
  border-radius: 4px;
  box-shadow: 0 2px 0 #15803D;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  transition: transform var(--transition-fast);
}

.btn-select-tick:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #15803D;
}

.action-btn-group {
  display: flex;
  gap: 3px;
  align-items: center;
}

.btn-nav {
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 0 #CBD5E1;
  padding: 4px 8px;
  font-size: 0.78rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-nav svg {
  display: block;
}

.btn-nav:active {
  box-shadow: 0 1px 0 #CBD5E1;
}

.btn-check {
  background-color: var(--temple-navy);
  color: #FFFFFF;
  box-shadow: var(--shadow-btn-slate);
  padding: 4px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-check:active {
  box-shadow: 0 1px 0 #0F172A;
}

/* Bottom-Subsection 2: Keypad Columns & Divider (Reduced ~8%) */
.bottom-sub2-keypad {
  display: grid;
  grid-template-columns: 1.4fr auto 1fr;
  gap: 4px;
  align-items: stretch;
}

.keypad-vertical-divider {
  width: 2px;
  background-color: var(--border-subtle);
  border-radius: 1px;
  align-self: stretch;
  margin: 1px 0;
}

.keypad-column {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.keypad-subheading {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1px;
}

.keypad-grid {
  display: grid;
  gap: 2px;
}

#mei-keypad {
  grid-template-columns: repeat(6, 1fr);
}

#uyir-keypad {
  grid-template-columns: repeat(4, 1fr);
}

.key-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(26px, 4.0vh, 32px);
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  box-shadow: 0 1.5px 0 #D4C9BC;
  font-family: var(--font-tamil);
  font-size: clamp(0.85rem, 2.2vw, 1.02rem);
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

.key-btn:active {
  transform: translateY(1.5px);
  box-shadow: 0 1px 0 #D4C9BC;
}

.key-btn.selected {
  background-color: var(--primary-gold);
  border-color: var(--primary-gold-dark);
  color: #FFFFFF;
  box-shadow: 0 1.5px 0 var(--primary-gold-dark);
}

/* Bottom-Subsection 3: Utility Modals Bar (Centered Together in Middle) */
.bottom-sub3-utilities {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 2px;
  border-top: 1px dashed var(--border-subtle);
  position: relative;
}

.btn-utility {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-tamil);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.btn-utility:hover {
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
}

.util-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  background-color: var(--primary-gold-light);
  color: var(--primary-gold-dark);
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 800;
}

.toast-message {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   7. Modals & Dialog Windows
   -------------------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
  animation: modalFadeIn 200ms ease forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background-color: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--temple-navy);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

/* Word Bank Modal */
.wordbank-filters {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background-color: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.wb-search {
  flex: 1;
  font-family: var(--font-tamil);
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  outline: none;
}

.wordbank-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 55vh;
}

.wb-item-card {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
}

.wb-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.wb-item-word {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-gold-dark);
}

.wb-item-translit {
  font-family: var(--font-system);
  font-size: 0.8rem;
  font-weight: 600;
  font-style: italic;
  color: var(--text-muted);
}

.wb-item-gloss {
  font-family: var(--font-system);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.wb-item-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  background-color: #E2E8F0;
  border-radius: 4px;
}

.wb-item-meaning-ta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.wb-item-meaning-en {
  font-size: 0.75rem;
  font-family: var(--font-system);
  font-style: italic;
  color: var(--text-muted);
}

/* Help Modal */
.help-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.help-section-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary-gold-dark);
  margin-bottom: 4px;
}

.example-combo {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
}

.pill-demo {
  padding: 4px 8px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-weight: 800;
}

.pill-demo.highlight {
  background-color: var(--primary-gold-light);
  border-color: var(--primary-gold);
  color: var(--primary-gold-dark);
}

.color-demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.demo-tile {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 800;
  color: #FFFFFF;
}

.demo-tile.green { background-color: var(--tile-green-bg); }
.demo-tile.orange { background-color: var(--tile-orange-bg); }
.demo-tile.grey { background-color: var(--tile-grey-bg); }

/* Game Over Modal */
.gameover-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.solved-word-display {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-gold-dark);
  letter-spacing: 2px;
}

.solved-word-translit {
  font-family: var(--font-system);
  font-size: 1rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 2px;
}

.solved-word-gloss {
  font-family: var(--font-system);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 2px 0 8px;
}

.solved-word-meaning p {
  margin-bottom: 4px;
}

.gameover-stats-row {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 14px;
  background-color: var(--bg-card-subtle);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.stat-num {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--temple-navy);
}

.stat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.modal-actions-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.btn-share {
  flex: 1;
  padding: 10px;
  background-color: var(--temple-slate);
  color: #FFFFFF;
  box-shadow: var(--shadow-btn-slate);
  font-size: 0.95rem;
}

.btn-modal-next {
  flex: 1;
  padding: 10px;
  background-color: var(--primary-gold);
  color: #FFFFFF;
  box-shadow: var(--shadow-btn-gold);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   8. Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (min-width: 601px) {
  .app-viewport {
    max-width: 560px;
    padding: 6px 8px;
    gap: 5px;
  }
  
  .grid-tile {
    width: clamp(44px, 10vw, 54px);
    height: clamp(32px, 6vh, 42px);
  }

  .key-btn {
    height: clamp(28px, 4.2vh, 36px);
  }
}
