/* ==========================================================================
   DOCTORAJ STYLESHEET
   A premium, clinical editor aesthetic for the Guess the Diagnosis game.
   Supports both Standard Mode and NEJM Journal Mode.
   ========================================================================== */

:root {
  /* Standard Design System */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-light: #94a3b8;
  --primary-accent: #0f766e; /* Teal-green clinical accent */
  --primary-hover: #0d9488;
  --primary-light: #ccfbf1;
  --border-color: #e2e8f0;
  
  /* Status Colors */
  --color-success: #10b981;
  --color-error: #f43f5e;
  --color-warning: #f59e0b;
  --color-info: #06b6d4;
  --color-locked: #64748b;
  
  /* Typography */
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-display: 'Outfit', var(--font-family-sans);
  
  /* Transitions & Shadows */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 20px rgba(15, 118, 110, 0.06);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.08);
  --shadow-glass: 0 8px 32px 0 rgba(15, 118, 110, 0.08);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

[data-theme="nejm"] {
  --bg-primary: #faf8f5; /* Warm paper */
  --bg-secondary: #ffffff;
  --bg-card: #fdfcf9;
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-light: #a8a29e;
  --primary-accent: #7f1d1d; /* Crimson Red */
  --primary-hover: #991b1b;
  --primary-light: #fee2e2;
  --border-color: #e7e5e4;
  
  --font-family-sans: 'Inter', sans-serif;
  --font-family-display: 'Playfair Display', Georgia, serif;
  
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glass: none;
  --border-radius-sm: 0px;
  --border-radius-md: 0px;
  --border-radius-lg: 0px;
}

html {
  overflow-x: hidden;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease;
}

[data-theme="nejm"] body {
  border-top: 5px solid var(--primary-accent);
}

.app-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}

[data-theme="nejm"] .app-header {
  border-bottom: 3px double var(--border-color);
}

.header-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-text {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

[data-theme="nejm"] .logo-text {
  font-weight: 700;
  font-style: italic;
  font-size: 2rem;
}

.logo-text .highlight {
  color: var(--primary-accent);
}

.pulse-icon {
  width: 50px;
  height: 25px;
}

.pulse-icon path {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: heartbeat 3s linear infinite;
}

@keyframes heartbeat {
  0% { stroke-dashoffset: 200; }
  40% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -200; }
}

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

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.icon-btn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-accent);
  color: var(--primary-accent);
  transform: translateY(-2px);
}

.game-container {
  max-width: 680px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
  overflow-x: hidden;
}

.card-perspective {
  perspective: 1500px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 460px;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 460px;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-flip-inner.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

[data-theme="nejm"] .card-face {
  border: 1px solid var(--text-primary);
  outline: 4px solid var(--bg-card);
  outline-offset: -5px;
}

.card-front {
  z-index: 2;
  transform: rotateY(0deg);
}

.card-back {
  transform: rotateY(180deg);
  background: var(--bg-secondary);
}

.card-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
}

[data-theme="nejm"] .card-header-bar {
  border-bottom: 1px solid var(--text-primary);
}

.card-badge {
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--primary-accent);
  text-transform: uppercase;
}

.card-step-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

.clues-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.clue-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background-color: rgba(241, 245, 249, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

[data-theme="nejm"] .clue-item {
  border: 1px dashed var(--border-color);
  background-color: var(--bg-primary);
}

.clue-item::before {
  content: "Locked Clue";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-light);
  z-index: 10;
  transition: opacity 0.5s ease;
  border-radius: var(--border-radius-sm);
}

[data-theme="nejm"] .clue-item::before {
  background-color: var(--bg-card);
}

.clue-item:nth-child(2)::before { content: "Clue #2 - Unlock after Guess 1"; }
.clue-item:nth-child(3)::before { content: "Clue #3 - Unlock after Guess 2"; }
.clue-item:nth-child(4)::before { content: "Clue #4 - Unlock after Guess 3"; }
.clue-item:nth-child(5)::before { content: "Clue #5 - Unlock after Guess 4"; }
.clue-item:nth-child(6)::before { content: "Clue #6 - Unlock after Guess 5"; }

.clue-number {
  background-color: var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font-family-display);
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

[data-theme="nejm"] .clue-number {
  border-radius: 0;
  border: 1px solid var(--text-primary);
  background-color: transparent;
  color: var(--text-primary);
}

.clue-content {
  flex: 1;
}

.clue-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.clue-text {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.clue-item.revealed::before,
.clue-item.hints_shown::before,
.clue-item:has(.hints_shown)::before {
  opacity: 0;
  pointer-events: none;
}

.clue-item.revealed,
.clue-item.hints_shown,
.clue-item:has(.hints_shown) {
  background-color: var(--bg-secondary);
  border-left: 4px solid var(--primary-accent);
  box-shadow: var(--shadow-sm);
}

.clue-item.active-clue {
  border-color: var(--primary-accent);
  background-color: rgba(13, 148, 136, 0.03);
}

.flip_in {
  animation: flipIn 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes flipIn {
  0% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0deg); opacity: 1; }
}

.summary-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.5rem 0;
}

.summary-title {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 1.8rem;
  color: var(--primary-accent);
  text-align: center;
}

[data-theme="nejm"] .summary-title {
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.summary-divider {
  height: 2px;
  background-color: var(--border-color);
  width: 60px;
  margin: 0 auto;
}

[data-theme="nejm"] .summary-divider {
  border-bottom: 1px solid var(--text-primary);
  background-color: transparent;
}

.summary-details {
  background-color: var(--bg-primary);
  padding: 1.25rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

[data-theme="nejm"] .summary-details {
  border: 1px solid var(--text-primary);
}

.summary-subtitle {
  font-family: var(--font-family-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.summary-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.anki-btn-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.anki-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.anki-buttons {
  display: flex;
  gap: 0.75rem;
}

.anki-tag-btn {
  flex: 1;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.anki-tag-btn:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-accent);
  color: var(--primary-accent);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: var(--bg-secondary);
  padding: 1.5rem;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

[data-theme="nejm"] .controls-panel {
  border: 1px solid var(--text-primary);
}

.result-message {
  font-family: var(--font-family-display);
  font-weight: 700;
  text-align: center;
  font-size: 1.1rem;
  min-height: 24px;
}

.result-message.correct { color: var(--color-success); }
.result-message.incorrect { color: var(--color-error); }

.input-wrapper {
  position: relative;
  width: 100%;
}

#guess {
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  outline: none;
  font-family: var(--font-family-sans);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: var(--transition-smooth);
}

#guess:focus {
  border-color: var(--primary-accent);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.15);
}

#guess:disabled {
  background-color: var(--border-color);
  cursor: not-allowed;
  opacity: 0.7;
}

.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  animation: fadeIn 0.15s ease-out;
}

.suggestion-item {
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
  border-bottom: 1px solid var(--bg-primary);
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background-color: var(--primary-light); color: var(--primary-accent); }

.action-buttons-row {
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.btn_color {
  flex: 1;
  background-color: var(--primary-accent);
  color: #ffffff;
  border: none;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.btn_color:hover:not(:disabled) {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn_color:disabled {
  background-color: var(--text-light);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-summary { background-color: #0284c7; }
.btn-summary:hover { background-color: #0369a1; }

.skip-helper-text {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  margin-top: 0.25rem;
}

.history-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

[data-theme="nejm"] .history-panel {
  border: 1px solid var(--text-primary);
}

.history-title {
  font-family: var(--font-family-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

[data-theme="nejm"] .history-title {
  border-bottom: 1px solid var(--text-primary);
}

.guess-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-empty {
  font-size: 0.9rem;
  color: var(--text-light);
  text-align: center;
  font-style: italic;
  padding: 0.5rem 0;
}

.guess-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  animation: slideRight 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

.guess-history-badge {
  background-color: var(--border-color);
  color: var(--text-secondary);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guess-history-name {
  flex: 1;
  margin-left: 0.75rem;
  font-weight: 500;
}

.guess-history-icon { font-weight: bold; }

.guess-history-item.correct { border-left: 4px solid var(--color-success); background-color: rgba(16, 185, 129, 0.05); }
.guess-history-item.correct .guess-history-icon { color: var(--color-success); }
.guess-history-item.wrong { border-left: 4px solid var(--color-error); background-color: rgba(244, 63, 94, 0.05); }
.guess-history-item.wrong .guess-history-icon { color: var(--color-error); }
.guess-history-item.skip { border-left: 4px solid var(--color-locked); background-color: rgba(100, 116, 139, 0.05); }
.guess-history-item.skip .guess-history-icon { color: var(--color-locked); }

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
  padding: 1rem;
}

.modal-hidden { opacity: 0; pointer-events: none; }
.modal-visible { opacity: 1; pointer-events: auto; }

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  max-width: 480px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="nejm"] .modal-content {
  border: 2px solid var(--text-primary);
  outline: 4px solid var(--bg-secondary);
  outline-offset: -6px;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close:hover { color: var(--text-primary); }
.modal-title { font-family: var(--font-family-display); font-weight: 800; font-size: 1.4rem; color: var(--text-primary); text-align: center; }
.modal-divider { height: 1px; background-color: var(--border-color); margin: 1rem 0; }
.text-left { text-align: left; }

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
  margin-bottom: 1.5rem;
}

.rules-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.rules-step-num {
  background-color: var(--primary-light);
  color: var(--primary-accent);
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.full-width { width: 100%; }

.archive-cases-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.25rem;
}

.archive-card {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  background-color: var(--bg-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.archive-card:hover {
  border-color: var(--primary-accent);
  background-color: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.archive-card-header { display: flex; justify-content: space-between; align-items: center; }
.archive-card-number { font-weight: 700; font-family: var(--font-family-display); font-size: 0.95rem; color: var(--text-primary); }
.archive-card-clue { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4; }
.archive-card-action { font-size: 0.8rem; font-weight: 600; color: var(--primary-accent); align-self: flex-end; }

.badge { font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 12px; }
.badge-unplayed { background-color: var(--border-color); color: var(--text-secondary); }
.badge-solved { background-color: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.badge-failed { background-color: rgba(244, 63, 94, 0.15); color: var(--color-error); }

.stats-container { display: flex; flex-direction: column; gap: 1.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; text-align: center; }
.stat-item { background-color: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); padding: 0.75rem 0.25rem; }
.stat-number { font-family: var(--font-family-display); font-weight: 800; font-size: 1.5rem; color: var(--primary-accent); }
.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); font-weight: 600; margin-top: 0.1rem; }

.guess-distribution-chart { display: flex; flex-direction: column; gap: 0.4rem; }
.distribution-row { display: flex; align-items: center; gap: 0.5rem; }
.guess-number { font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); width: 14px; }
.guess-number.highlighted { color: var(--primary-accent); font-weight: bold; }
.distribution-bar-container { flex: 1; background-color: var(--bg-primary); height: 22px; border-radius: 4px; overflow: hidden; }
.distribution-bar { background-color: var(--text-light); height: 100%; border-radius: 4px; min-width: 24px; transition: width 1s ease-out; }
.guess-number.highlighted + .distribution-bar-container .distribution-bar { background-color: var(--primary-accent); }

.nejm-case-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--border-radius-sm);
  margin: 1rem 0;
  text-decoration: none;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition-smooth);
  text-align: left;
}

.nejm-case-card:hover { border-color: var(--primary-accent); background-color: var(--bg-secondary); }
.nejm-case-card-left { display: flex; gap: 0.75rem; align-items: center; }
.nejm-case-card-title { font-weight: 600; font-size: 0.9rem; color: var(--primary-accent); }
.nejm-case-card-sub { font-size: 0.75rem; color: var(--text-secondary); }

.cookie-banner-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.05);
  z-index: 999;
  padding: 1.25rem 1.5rem;
  transition: transform 0.4s ease-out;
}

[data-theme="nejm"] .cookie-banner-bottom { border-top: 2px solid var(--text-primary); }
.cookie-banner-bottom.hidden { transform: translateY(100%); }
.cookie-banner-bottom.show { transform: translateY(0); }

.cookie-container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.cookie-text { flex: 1; min-width: 250px; font-size: 0.9rem; color: var(--text-secondary); }
.cookie-buttons { display: flex; gap: 0.75rem; }
.cookie-btn { padding: 0.6rem 1.25rem; font-size: 0.85rem; font-weight: 600; border-radius: var(--border-radius-sm); cursor: pointer; transition: var(--transition-smooth); }
.cookie-btn.decline { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.cookie-btn.decline:hover { background-color: var(--bg-primary); color: var(--text-primary); }
.cookie-btn.accept { background-color: var(--primary-accent); border: none; color: #ffffff; }
.cookie-btn.accept:hover { background-color: var(--primary-hover); }

.game-disabled-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(248, 250, 252, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.game-disabled-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 2.5rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes slideRight { from { transform: translateX(-15px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ==========================================================================
   CASE NAVIGATION (CAROUSEL ARROWS)
   ========================================================================== */

.game-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.carousel-arrow {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
  flex-shrink: 0;
  z-index: 10;
}

.carousel-arrow svg {
  display: block;
}

.carousel-arrow:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-accent);
  color: var(--primary-accent);
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.carousel-arrow:active {
  transform: scale(0.95);
}

/* NEJM Theme Override */
[data-theme="nejm"] .carousel-arrow {
  background: var(--bg-card);
  border: 1px solid var(--text-primary);
  outline: 4px solid var(--bg-card);
  outline-offset: -5px;
  border-radius: 0;
  box-shadow: none;
}

[data-theme="nejm"] .carousel-arrow:hover {
  background-color: var(--primary-light);
  color: var(--primary-accent);
  border-color: var(--primary-accent);
  transform: none;
}

.mobile-nav-row {
  display: none;
}

@media (max-width: 768px) {
  .game-carousel-wrapper .carousel-arrow {
    display: none;
  }
  .mobile-nav-row {
    display: flex !important;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 0.75rem;
    margin-top: 0.25rem;
  }
  .mobile-nav-row .carousel-arrow {
    display: flex !important;
    flex: 1 1 0;
    width: auto;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius-sm);
    height: 44px;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 0;
    padding: 0 0.5rem;
    white-space: nowrap;
  }
}

@media (max-width: 600px) {
  html,
  body,
  .app-header,
  .landing-view,
  .game-view,
  .app-footer,
  .cookie-banner-bottom {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .app-header *,
  .game-view *,
  .cookie-banner-bottom * {
    min-width: 0;
  }
  .logo-text { font-size: 1.4rem; }
  .pulse-icon { width: 38px; height: 20px; }
  .header-container { padding: 0.6rem 0.85rem; }
  .header-actions {
    max-width: none;
    overflow: visible;
  }
  .game-view {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .game-container {
    width: calc(100vw - 1rem);
    max-width: 360px;
    min-width: 0;
    margin: 0.5rem auto;
    gap: 0.85rem;
    padding: 0;
    align-self: center;
  }
  .card-face { padding: 1rem; }
  .card-perspective, .card-flip-inner { min-height: 440px; }
  .card-header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .card-step-info {
    max-width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.25;
  }
  .clue-item { gap: 0.75rem; padding: 0.6rem 0.75rem; }
  .clue-text { font-size: 0.88rem; }
  .controls-panel,
  .history-panel {
    width: 100%;
    max-width: 100%;
    padding: 1rem;
    overflow-x: hidden;
  }
  .input-wrapper,
  .suggestions-dropdown,
  .guess-history-list {
    width: 100%;
    max-width: 100%;
  }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .cookie-container { flex-direction: column; align-items: stretch; gap: 1rem; }
  .cookie-buttons { justify-content: flex-end; }
  .action-buttons-row { gap: 0.5rem; }
  .btn_color { padding: 0.8rem 0.75rem; font-size: 0.9rem; }
  .modal-content { padding: 1.25rem; }
  .anki-buttons { flex-wrap: wrap; }
}

/* ==========================================================================
   LANDING PAGE STYLES
   ========================================================================== */

.landing-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 118, 110, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #f8fbfb 0%, #eef7f6 56%, #ffffff 100%);
  background-size: 44px 44px, 44px 44px, 100% 100%;
}

.landing-ambient-glows {
  display: none;
}

.glow-circle {
  display: none;
}

.glow-1 {
  top: -10%;
  right: -10%;
  width: 450px;
  height: 450px;
  background-color: var(--primary-accent);
}

.glow-2 {
  top: 40%;
  left: -15%;
  width: 400px;
  height: 400px;
  background-color: #0284c7; /* Sky blue */
}

.glow-3 {
  bottom: -5%;
  right: 5%;
  width: 350px;
  height: 350px;
  background-color: #8b5cf6; /* Purple */
}

[data-theme="nejm"] .landing-ambient-glows {
  display: none; /* Keep NEJM clean, paper-like and editorial */
}

.landing-view.hidden,
.game-view.hidden {
  display: none !important;
}

/* Hero Section */
.hero-section {
  width: 100%;
  max-width: 100vw;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68) 0%, rgba(255, 255, 255, 0) 88%),
    linear-gradient(115deg, rgba(15, 118, 110, 0.08), rgba(2, 132, 199, 0.04) 46%, rgba(255, 255, 255, 0));
  padding: 4.5rem 1.25rem 2.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(15, 118, 110, 0.08);
  position: relative;
  overflow: hidden;
}

[data-theme="nejm"] .hero-section {
  background: transparent;
  border-bottom: 3px double var(--border-color);
  padding: 4rem 1.5rem;
}

.hero-container {
  max-width: 1060px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  align-items: center;
}

.hero-kicker,
.section-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.hero-kicker-icon {
  flex: 0 0 auto;
}

.hero-title {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 3.55rem;
  letter-spacing: 0;
  line-height: 1.02;
  color: var(--text-primary);
  width: 100%;
  max-width: 850px;
  overflow-wrap: break-word;
}

[data-theme="nejm"] .hero-title {
  font-size: 3.2rem;
  font-weight: 700;
  font-style: italic;
}

.hero-title .highlight {
  background: linear-gradient(90deg, var(--primary-accent), var(--primary-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="nejm"] .hero-title .highlight {
  -webkit-text-fill-color: initial;
  color: var(--primary-accent);
  background: transparent;
}

.hero-subtitle {
  font-size: 1.12rem;
  color: #334155;
  max-width: 730px;
  line-height: 1.7;
}

[data-theme="nejm"] .hero-subtitle {
  font-family: var(--font-family-sans);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.hero-cta-btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.2);
}

.btn_secondary {
  background-color: rgba(255, 255, 255, 0.72);
  color: var(--text-primary);
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 1rem 1.65rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

[data-theme="nejm"] .btn_secondary {
  border: 1px solid var(--text-primary);
}

.btn_secondary:hover {
  background-color: var(--bg-secondary);
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--primary-accent);
  transform: translateY(-1px);
}

.hero-metrics {
  width: min(100%, 620px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.hero-metric {
  min-width: 0;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.hero-metric strong,
.hero-metric span {
  display: block;
}

.hero-metric strong {
  font-family: var(--font-family-display);
  font-size: 1.35rem;
  color: var(--text-primary);
  line-height: 1;
}

.hero-metric span {
  margin-top: 0.25rem;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-preview {
  width: min(100%, 980px);
  margin-top: 1.6rem;
  overflow: hidden;
  text-align: left;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

.preview-topbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.5rem;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(15, 118, 110, 0.12);
  background: rgba(248, 250, 252, 0.82);
}

.preview-topbar span {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 999px;
  background: #cbd5e1;
}

.preview-topbar span:nth-child(1) { background: #f43f5e; }
.preview-topbar span:nth-child(2) { background: #f59e0b; }
.preview-topbar span:nth-child(3) { background: #10b981; }

.preview-content {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 1rem;
  padding: 1rem;
}

.preview-card {
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.055);
}

.preview-case {
  padding: 1.35rem;
}

.preview-label {
  color: var(--primary-accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-case h3 {
  margin-top: 0.5rem;
  font-family: var(--font-family-display);
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--text-primary);
}

.preview-case p {
  margin-top: 0.65rem;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.55;
}

.preview-clue-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.preview-clue {
  display: flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0 0.85rem;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #f8fafc;
}

.preview-clue.active {
  color: var(--primary-accent);
  border-color: rgba(15, 118, 110, 0.24);
  background: #ecfdf5;
}

.preview-panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-search {
  display: flex;
  align-items: center;
  min-height: 2.6rem;
  padding: 0 0.8rem;
  color: var(--text-light);
  font-size: 0.86rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #f8fafc;
}

.preview-history {
  display: grid;
  gap: 0.55rem;
}

.preview-history span,
.preview-history strong {
  display: block;
  padding: 0.65rem 0.75rem;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 8px;
  background: #f1f5f9;
}

.preview-history strong {
  color: #065f46;
  background: #d1fae5;
}

/* How to Play Section */
.how-to-play-section {
  width: 100%;
  max-width: 1080px;
  margin: 3.25rem auto 4rem;
  padding: 0 1.5rem;
  text-align: center;
}

.section-title {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 2.15rem;
  color: var(--text-primary);
  max-width: 680px;
  margin: 0.55rem auto 2rem;
  line-height: 1.15;
  letter-spacing: 0;
}

[data-theme="nejm"] .section-title {
  font-size: 2.2rem;
  font-style: italic;
}

.landing-rules-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.landing-rule-card {
  background-color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 118, 110, 0.13);
  border-radius: 8px;
  padding: 1.45rem 1.25rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.055);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.85rem;
  transition: var(--transition-smooth);
  position: relative;
}

[data-theme="nejm"] .landing-rule-card {
  border: 1px solid var(--text-primary);
  outline: 4px solid var(--bg-card);
  outline-offset: -5px;
  background-color: var(--bg-card);
  border-radius: 0;
  box-shadow: none;
}

.landing-rule-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-accent);
  box-shadow: 0 18px 36px rgba(15, 118, 110, 0.1);
  background-color: rgba(255, 255, 255, 0.96);
}

[data-theme="nejm"] .landing-rule-card:hover {
  transform: none;
  background-color: var(--primary-light);
  border-color: var(--primary-accent);
}

.rule-card-icon-wrapper {
  background-color: var(--primary-light);
  color: var(--primary-accent);
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: var(--transition-smooth);
}

.rule-step-number {
  font-family: var(--font-family-display);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.landing-rule-card:hover .rule-card-icon-wrapper {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.14);
}

[data-theme="nejm"] .rule-card-icon-wrapper {
  border-radius: 0;
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--text-primary);
}

.rule-card-title {
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.rule-card-desc {
  font-size: 0.88rem;
  color: #475569;
  line-height: 1.55;
}

/* ==========================================================================
   AI CASE GENERATION SECTION (ARCHIVE MODAL)
   ========================================================================== */

.archive-ai-section {
  margin-top: 2rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1.5rem;
  text-align: left;
}

[data-theme="nejm"] .archive-ai-section {
  border-top: 1px solid var(--text-primary);
}

.archive-ai-section h3 {
  font-family: var(--font-family-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.ai-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.ai-input-group {
  display: flex;
  gap: 0.75rem;
}

.ai-input-group input {
  flex: 1;
  padding: 0.6rem 0.95rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  outline: none;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

[data-theme="nejm"] .ai-input-group input {
  border: 1px solid var(--text-primary);
}

.ai-input-group input:focus {
  border-color: var(--primary-accent);
}

.btn-generate {
  font-size: 0.9rem;
  padding: 0.6rem 1.25rem;
  flex: 0 0 auto;
}

.ai-loading {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.ai-status {
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-weight: 500;
}

.ai-status.success { color: var(--color-success); }
.ai-status.error { color: var(--color-error); }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   AI GUESS EXPLANATION BOX (RESULTS MODAL)
   ========================================================================== */

.ai-explain-btn-container {
  margin-top: 1.25rem;
  text-align: center;
}

.btn-explain-ai {
  background-color: var(--primary-light);
  color: var(--primary-accent);
  border: 1px solid var(--primary-accent);
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-explain-ai:hover:not(:disabled) {
  background-color: var(--primary-accent);
  color: #ffffff;
}

.ai-explain-box {
  background-color: rgba(6, 182, 212, 0.05);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--border-radius-sm);
  padding: 1.25rem;
  margin-top: 1.25rem;
  text-align: left;
  animation: fadeIn 0.4s ease-out;
}

[data-theme="nejm"] .ai-explain-box {
  background-color: var(--bg-primary);
  border: 1px solid var(--text-primary);
}

.ai-explain-title {
  font-family: var(--font-family-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-accent);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-explain-content {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.ai-explain-content ul {
  padding-left: 1.25rem;
  margin-bottom: 0;
}

.ai-explain-content li {
  margin-bottom: 0.6rem;
}

.ai-explain-content li:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   PREMIUM FOOTER
   ========================================================================== */

.app-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 3rem 1.5rem 1.5rem 1.5rem;
  margin-top: auto;
  width: 100%;
  transition: var(--transition-smooth);
}

[data-theme="nejm"] .app-footer {
  border-top: 3px double var(--border-color);
  background-color: var(--bg-card);
}

.footer-container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-brand {
  flex: 1;
  min-width: 250px;
}

.footer-brand h3 {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.footer-brand p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 320px;
}

.footer-links {
  display: flex;
  gap: 3rem;
}

.footer-col h4 {
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-smooth);
}

.footer-col a:hover {
  color: var(--primary-accent);
}

.footer-disclaimer {
  max-width: 900px;
  margin: 2rem auto 0 auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

[data-theme="nejm"] .footer-disclaimer {
  border-top: 1px dashed var(--text-primary);
}

.footer-disclaimer p {
  font-size: 0.8rem;
  color: var(--text-light);
  line-height: 1.4;
}

.footer-copy {
  font-weight: 500;
  color: var(--text-secondary) !important;
}

/* ==========================================================================
   MEDIA QUERIES FOR LANDING
   ========================================================================== */

@media (max-width: 768px) {
  .landing-rules-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .hero-section {
    padding: 3.25rem 1rem 2rem;
  }
  .hero-title {
    font-size: 2.45rem;
  }
  .hero-subtitle {
    font-size: 1rem;
  }
  .hero-metrics {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
  .hero-metric {
    padding: 0.8rem 0.9rem;
  }
  .preview-content {
    grid-template-columns: 1fr;
  }
  .how-to-play-section {
    margin: 2.5rem auto;
    padding: 0 1rem;
  }
  .section-title {
    font-size: 1.65rem;
    margin-bottom: 1.5rem;
  }
  .footer-container {
    flex-direction: column;
    gap: 1.5rem;
  }
  .footer-links {
    gap: 1.5rem;
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   PWA INSTALL UI
   ========================================================================== */

/* Install button pulse on first appearance */
@keyframes pwa-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(15, 118, 110, 0); }
}

.pwa-install-btn.pwa-install-pulse {
  animation: pwa-pulse 1s ease-in-out 2;
  border-color: var(--primary-accent);
  color: var(--primary-accent);
}

/* ── Bottom Install Banner ─────────────────────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 2px solid var(--primary-accent);
  box-shadow: 0 -4px 30px rgba(15, 118, 110, 0.12);
  z-index: 998;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-install-banner.show {
  transform: translateY(0);
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex: 1;
  min-width: 200px;
}

.pwa-banner-icon {
  color: var(--primary-accent);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pwa-banner-text strong {
  font-size: 0.95rem;
  font-family: var(--font-family-display);
  color: var(--text-primary);
}

.pwa-banner-text span {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.pwa-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.pwa-banner-btn {
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.pwa-banner-btn-primary {
  background-color: var(--primary-accent);
  color: #ffffff;
}

.pwa-banner-btn-primary:hover {
  background-color: var(--primary-hover);
}

.pwa-banner-btn-secondary {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.pwa-banner-btn-secondary:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

/* ── Update Available Toast ─────────────────────────────────────────────── */
.pwa-update-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--text-primary);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.pwa-update-toast.show {
  transform: translateX(-50%) translateY(0);
}

.pwa-update-toast button {
  background-color: var(--primary-accent);
  color: #ffffff;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.pwa-update-toast button:hover {
  background-color: var(--primary-hover);
}

@media (max-width: 480px) {
  .pwa-install-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .pwa-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .pwa-update-toast {
    white-space: normal;
    width: calc(100% - 2rem);
    left: 1rem;
    transform: translateX(0) translateY(120px);
  }
  .pwa-update-toast.show {
    transform: translateX(0) translateY(0);
  }
}
@media (max-width: 480px) {
  .hero-section {
    padding: 2.5rem 0.85rem 1.75rem;
  }
  .hero-title {
    max-width: 320px;
    margin: 0 auto;
    font-size: 1.82rem;
  }
  .hero-subtitle {
    max-width: 340px;
    margin: 0 auto;
    font-size: 0.95rem;
  }
  .hero-kicker,
  .section-kicker {
    font-size: 0.74rem;
  }
  .hero-actions {
    flex-direction: column;
    width: calc(100vw - 2rem);
    max-width: 300px;
  }
  .hero-cta-btn, .btn_secondary {
    width: 100%;
    justify-content: center;
  }
  .hero-metrics {
    width: calc(100vw - 2rem);
    max-width: 300px;
  }
  .landing-rules-grid {
    grid-template-columns: 1fr;
  }
  .landing-rule-card {
    padding: 1.5rem 1.25rem;
  }
  .hero-preview {
    width: calc(100vw - 2rem);
    max-width: 330px;
    margin-top: 1rem;
  }
  .preview-content {
    padding: 0.75rem;
  }
  .preview-case,
  .preview-panel {
    padding: 1rem;
  }
  .preview-case h3 {
    font-size: 1.18rem;
  }
  .footer-links {
    flex-direction: column;
    gap: 1.25rem;
  }
  .footer-brand {
    min-width: unset;
  }
  .cookie-banner-bottom {
    padding: 1rem;
  }
  .cookie-text {
    min-width: 0;
    width: 100%;
  }
  .cookie-buttons {
    width: 100%;
    gap: 0.5rem;
    flex-direction: column;
    justify-content: stretch;
  }
  .cookie-btn {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    white-space: nowrap;
  }
  .header-actions {
    gap: 0.4rem;
    max-width: none;
    overflow: visible;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
  }
}


