/* ==========================================================================
   Le Grand Pendu — Stylesheet
   Responsive, accessible, light/dark theme support
   ========================================================================== */

:root {
  --bg-main: #f6f4ef;
  --bg-card: #ffffff;
  --bg-subtle: #ede9df;
  --bg-accent-soft: #eef2ff;
  --text-main: #1e2430;
  --text-muted: #5b6475;
  --border-color: #dcd6c8;
  --primary: #4338ca;
  --primary-hover: #3730a3;
  --primary-light: #e0e7ff;
  --secondary: #0f766e;
  --secondary-light: #ccfbf1;
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --p1-color: #4338ca;
  --p1-bg: #e0e7ff;
  --p2-color: #be123c;
  --p2-bg: #ffe4e6;
  --shadow-sm: 0 2px 6px rgba(30, 36, 48, 0.06);
  --shadow-md: 0 8px 24px rgba(30, 36, 48, 0.09);
  --shadow-lg: 0 16px 40px rgba(30, 36, 48, 0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --gallows-stroke: #334155;
  --figure-stroke: #4338ca;
}

[data-theme="dark"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-subtle: #334155;
  --bg-accent-soft: #1e1b4b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-light: #312e81;
  --secondary: #14b8a6;
  --secondary-light: #134e4a;
  --success: #22c55e;
  --success-bg: #14532d;
  --warning: #f59e0b;
  --warning-bg: #451a03;
  --danger: #ef4444;
  --danger-bg: #450a0a;
  --p1-color: #818cf8;
  --p1-bg: #312e81;
  --p2-color: #fb7185;
  --p2-bg: #4c0519;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --gallows-stroke: #94a3b8;
  --figure-stroke: #818cf8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Header */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: max(0.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.5rem max(1rem, env(safe-area-inset-left));
  position: relative;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.tab-label-short {
  display: none;
}

button,
.key-btn,
.age-card,
.theme-chip,
.avatar-option {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.3);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.brand-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
}

/* Mode Switcher */
.mode-tabs {
  display: flex;
  background: var(--bg-subtle);
  padding: 0.28rem;
  border-radius: 999px;
  gap: 0.25rem;
}

.mode-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mode-tab:hover {
  color: var(--text-main);
}

.mode-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Main Container */
.main-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

.hidden {
  display: none !important;
}

/* Cards & Panels */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Solo Filter Bar (Age + Theme Selection) */
.solo-config-panel {
  margin-bottom: 1.5rem;
}

.config-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.age-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.age-card {
  border: 2px solid var(--border-color);
  background: var(--bg-main);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.age-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.age-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.age-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.age-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.age-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Theme Pills Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.65rem;
}

.theme-chip {
  border: 2px solid var(--border-color);
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.theme-chip:hover {
  border-color: var(--primary);
}

.theme-chip.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

[data-theme="dark"] .theme-chip.selected {
  color: #fff;
}

.theme-chip .chip-icon {
  font-size: 1.2rem;
}

/* Game Layout */
.game-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

/* Gallows Visual Box */
.gallows-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.active-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-main);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

[data-theme="dark"] .badge-primary {
  color: #e0e7ff;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.gallows-svg-wrapper {
  width: 100%;
  max-width: 250px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25rem 0 0.75rem;
}

.gallows-svg {
  width: 100%;
  height: 100%;
}

.gallows-part {
  stroke: var(--gallows-stroke);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  transition: opacity 0.3s ease;
}

.figure-part {
  stroke: var(--figure-stroke);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0;
  transform-origin: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.figure-part.visible {
  opacity: 1;
}

.lives-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  font-size: 1.05rem;
}

.lives-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Play Area (Right Column) */
.play-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.stat-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Word Slots */
.word-display-area {
  background: var(--bg-main);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.6rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 130px;
}

.word-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.letter-tile {
  width: 46px;
  height: 56px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-bottom-width: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.letter-tile.revealed {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
}

[data-theme="dark"] .letter-tile.revealed {
  color: #fff;
}

.letter-tile.missed-reveal {
  border-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}

.letter-tile.separator {
  width: 26px;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 1.6rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .letter-tile {
    width: 36px;
    height: 46px;
    font-size: 1.25rem;
  }
}

/* Hint Box */
.hint-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--warning-bg);
  border: 1px solid rgba(180, 83, 9, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.hint-text {
  font-size: 0.92rem;
  color: var(--warning);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="dark"] .hint-text {
  color: #fcd34d;
}

.hint-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Virtual Keyboard */
.keyboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-items: center;
  user-select: none;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  flex-wrap: wrap;
}

.key-btn {
  min-width: 44px;
  height: 48px;
  padding: 0 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  border-bottom: 3px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.key-btn:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
  background: var(--primary-light);
}

.key-btn:active:not(:disabled) {
  transform: translateY(1px);
  border-bottom-width: 1px;
}

.key-btn.correct {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
  cursor: default;
}

.key-btn.wrong {
  background: var(--bg-subtle);
  border-color: transparent;
  color: var(--text-muted);
  opacity: 0.45;
  text-decoration: line-through;
  cursor: default;
}

@media (max-width: 600px) {
  .key-btn {
    min-width: 31px;
    height: 42px;
    font-size: 0.92rem;
    padding: 0 0.25rem;
  }
  .keyboard-row {
    gap: 0.28rem;
  }
}

/* Round Result Banner */
.round-result-banner {
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  animation: fadeIn 0.25s ease;
}

.round-result-banner.win {
  background: var(--success-bg);
  border: 2px solid var(--success);
}

.round-result-banner.lose {
  background: var(--danger-bg);
  border: 2px solid var(--danger);
}

.result-details h3 {
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}

.result-details p {
  font-size: 0.92rem;
  color: var(--text-main);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--primary);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn-lg {
  padding: 0.9rem 1.75rem;
  font-size: 1.05rem;
  border-radius: 12px;
}

/* ==========================================================================
   1v1 Duel Mode Styles
   ========================================================================== */

.duel-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.player-score-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.player-score-card.p1 {
  background: var(--p1-bg);
}

.player-score-card.p2 {
  background: var(--p2-bg);
  flex-direction: row-reverse;
  text-align: right;
}

.player-score-card.active-turn {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15);
}

.player-avatar {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.player-meta h3 {
  font-size: 1.05rem;
  font-weight: 800;
}

.player-meta .role-tag {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 600;
}

.player-points {
  margin-left: auto;
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--primary);
}

.player-score-card.p2 .player-points {
  margin-left: 0;
  margin-right: auto;
  color: var(--p2-color);
}

.duel-round-pill {
  text-align: center;
  padding: 0.4rem 1rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
}

.duel-round-pill .round-num {
  font-size: 0.95rem;
  font-weight: 800;
  display: block;
}

.duel-round-pill .round-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .duel-scoreboard {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .player-score-card.p2 {
    flex-direction: row;
    text-align: left;
  }
  .player-score-card.p2 .player-points {
    margin-left: auto;
    margin-right: 0;
  }
}

/* Duel Setup Form */
.duel-setup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
  .duel-setup-grid {
    grid-template-columns: 1fr;
  }
}

.player-setup-box {
  background: var(--bg-main);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.player-setup-box.p1-box {
  border-top: 5px solid var(--p1-color);
}

.player-setup-box.p2-box {
  border-top: 5px solid var(--p2-color);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.text-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
}

.avatar-picker {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.avatar-option {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.avatar-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.08);
}

.duel-options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.select-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
}

/* Secret Word Entry Box & Spellchecker Feedback */
.secret-entry-container {
  max-width: 680px;
  margin: 0 auto;
}

.privacy-banner {
  background: var(--warning-bg);
  border: 1px solid rgba(180, 83, 9, 0.35);
  color: var(--warning);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .privacy-banner {
  color: #fde68a;
}

.secret-input-wrapper {
  position: relative;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.secret-word-input {
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  padding: 0.9rem 1.15rem;
}

.spellcheck-panel {
  margin-top: 0.75rem;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.1rem;
  border: 2px solid var(--border-color);
  background: var(--bg-main);
  transition: all 0.2s ease;
}

.spellcheck-panel.valid {
  border-color: var(--success);
  background: var(--success-bg);
}

.spellcheck-panel.corrected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.spellcheck-panel.unknown {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.spellcheck-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.correction-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
}

.strike-word {
  text-decoration: line-through;
  opacity: 0.7;
  font-weight: 600;
}

.corrected-highlight {
  background: var(--primary);
  color: #fff;
  padding: 0.15rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.suggestions-row {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.suggestion-chip {
  border: 1px solid var(--primary);
  background: var(--bg-card);
  color: var(--text-main);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.suggestion-chip:hover {
  background: var(--primary);
  color: #fff;
}

/* Inspiration Generator Box in 1v1 */
.inspiration-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg-subtle);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  font-size: 0.85rem;
}

/* Pass Device Screen */
.pass-device-card {
  max-width: 560px;
  margin: 2rem auto;
  text-align: center;
  padding: 2.5rem 2rem;
}

.pass-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

/* Final Podium & History Table */
.podium-card {
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.winner-banner {
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(67, 56, 202, 0.12), rgba(124, 58, 237, 0.15));
  border: 2px solid var(--primary);
  margin-bottom: 1.5rem;
}

.winner-trophy {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.final-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

@media (max-width: 650px) {
  .final-comparison-grid {
    grid-template-columns: 1fr;
  }
}

.final-player-box {
  background: var(--bg-main);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.final-player-box.winner {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
}

.final-score-big {
  font-size: 2.4rem;
  font-weight: 900;
  color: var(--primary);
  margin: 0.4rem 0;
}

.history-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.5rem;
  text-align: left;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.history-table th,
.history-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.history-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

/* PWA Install Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 120;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 460px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.modal-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-steps {
  list-style: none;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.pwa-steps li {
  background: var(--bg-main);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Tablet & Mobile Responsive Tweaks */
@media (max-width: 1024px) and (min-width: 721px) {
  .game-layout {
    grid-template-columns: 280px 1fr;
    gap: 1.15rem;
  }
  .key-btn {
    min-width: 48px;
    height: 52px;
    font-size: 1.1rem;
  }
}

@media (max-width: 720px) {
  /* Ultra-compact single-row header for smartphones (e.g. Galaxy S25) */
  .app-header {
    padding: max(0.35rem, env(safe-area-inset-top)) 0.6rem 0.35rem 0.6rem;
  }
  .header-inner {
    gap: 0.35rem;
    flex-wrap: nowrap;
  }
  .brand {
    gap: 0.4rem;
    min-width: 0;
  }
  .brand-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.95rem;
    flex-shrink: 0;
  }
  .brand-text h1 {
    font-size: 0.88rem;
    white-space: nowrap;
  }
  .brand-text span {
    display: none;
  }
  @media (max-width: 410px) {
    .brand-text {
      display: none;
    }
  }
  .mode-tabs {
    padding: 0.18rem;
    gap: 0.15rem;
    flex-shrink: 0;
  }
  .mode-tab {
    padding: 0.32rem 0.6rem;
    font-size: 0.78rem;
    gap: 0.25rem;
  }
  .tab-label-full {
    display: none;
  }
  .tab-label-short {
    display: inline;
  }
  .header-actions {
    gap: 0.25rem;
    flex-shrink: 0;
  }
  .install-label {
    display: none;
  }
  #btn-install-pwa {
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }
  .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.92rem;
  }

  /* Compact main layout so entire game fits on smartphone screen */
  .main-container {
    padding: 0.5rem 0.6rem;
  }
  .card {
    padding: 0.7rem 0.8rem;
    border-radius: 14px;
  }
  .solo-config-panel {
    margin-bottom: 0.55rem;
    padding: 0.5rem 0.75rem;
  }
  .config-header-row {
    margin-bottom: 0;
    gap: 0.4rem;
  }
  .config-header-row .section-title {
    font-size: 0.86rem;
  }
  .game-layout {
    gap: 0.55rem;
  }

  /* Compact horizontal Gallows Card on mobile */
  .gallows-card {
    display: grid;
    grid-template-columns: 100px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 0.65rem;
    row-gap: 0.2rem;
    align-items: center;
    text-align: left;
    padding: 0.5rem 0.75rem;
  }
  .gallows-svg-wrapper {
    grid-column: 1;
    grid-row: 1 / span 3;
    max-width: 96px;
    height: 96px;
    margin: 0;
  }
  .active-badges {
    grid-column: 2;
    justify-content: flex-start;
    margin-bottom: 0;
    gap: 0.3rem;
  }
  .badge {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
  }
  .lives-bar {
    grid-column: 2;
    justify-content: flex-start;
    font-size: 0.85rem;
    margin-top: 0;
  }
  .lives-text {
    grid-column: 2;
    font-size: 0.76rem;
    margin-top: 0;
  }

  /* Compact 4-column stats ribbon */
  .play-card {
    gap: 0.65rem;
  }
  .stats-ribbon {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
  }
  .stat-box {
    padding: 0.35rem 0.2rem;
  }
  .stat-label {
    font-size: 0.62rem;
  }
  .stat-value {
    font-size: 0.95rem;
  }

  .word-display-area {
    padding: 0.7rem 0.45rem;
    min-height: 74px;
  }
  .letter-tile {
    width: 32px;
    height: 40px;
    font-size: 1.15rem;
    border-radius: 7px;
  }
  .hint-container {
    padding: 0.5rem 0.65rem;
    gap: 0.45rem;
  }
  .hint-text {
    font-size: 0.8rem;
  }

  /* Compact Duel Scoreboard on mobile */
  .duel-scoreboard {
    grid-template-columns: 1fr auto 1fr;
    gap: 0.35rem;
    padding: 0.45rem 0.6rem;
    margin-bottom: 0.6rem;
  }
  .player-score-card {
    padding: 0.35rem 0.45rem;
    gap: 0.35rem;
  }
  .player-score-card.p2 {
    flex-direction: row-reverse;
    text-align: right;
  }
  .player-avatar {
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
  }
  .player-meta h3 {
    font-size: 0.78rem;
  }
  .player-meta .role-tag {
    display: none;
  }
  .player-points {
    font-size: 0.95rem;
  }
  .duel-round-pill {
    padding: 0.25rem 0.45rem;
  }
  .duel-round-pill .round-num {
    font-size: 0.72rem;
  }
  .duel-round-pill .round-sub {
    font-size: 0.64rem;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
