/* Ciorcal Comhrá - Stylesheet */
:root {
  --navy: #1f3a5f;
  --emerald: #10b981;
  --shamrock: #059669;
  --amber: #f59e0b;
  --coral: #ef4444;
  --sky: #0284c7;
  --purple: #8b5cf6;
  --bg: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --muted: #64748b;
  --text: #1e293b;
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Lexend', system-ui, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 10px 25px -5px rgba(31, 58, 95, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  padding: 0.8rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.back-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  transition: all 0.2s;
}
.back-link:hover { color: var(--navy); background: #e2e8f0; }
.logo-icon {
  font-size: 2rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}
.subtitle {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Header Stats */
.header-stats {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.stat-pill {
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stat-label { color: var(--muted); font-weight: 600; }
.stat-val { color: var(--navy); font-weight: 800; }
.ctrl-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  transition: all 0.2s;
}
.ctrl-btn:hover { background: #f8fafc; border-color: var(--muted); }

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

/* Mode Navigation Tabs */
.mode-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  background: #e2e8f0;
  padding: 0.35rem;
  border-radius: 16px;
  overflow-x: auto;
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border: none;
  background: transparent;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--navy); }
.mode-tab.active {
  background: var(--surface);
  color: var(--shamrock);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* 10 Themes Scroll Bar */
.themes-scroll-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.6rem;
  margin-bottom: 1.5rem;
}
.theme-pill-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}
.theme-pill-btn:hover { border-color: var(--shamrock); color: var(--shamrock); }
.theme-pill-btn.active {
  background: var(--shamrock);
  color: #fff;
  border-color: var(--shamrock);
}

/* Views */
.game-view { display: none; }
.game-view.active { display: block; animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.view-intro {
  margin-bottom: 1.5rem;
}
.view-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--shamrock);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}
.view-intro h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
}
.view-intro p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* VIEW 1: THEATRE STAGE CARD */
.theatre-stage-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.theatre-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--line);
  padding-bottom: 1.2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.theme-badge {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--navy);
}
.action-btn-sm {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn-sm:hover { background: #d1fae5; }

.characters-stage {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 1.5rem;
  align-items: center;
  min-height: 380px;
}
@media (max-width: 750px) {
  .characters-stage { grid-template-columns: 1fr; }
  .char-actor { display: none; }
}

.char-actor {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.actor-avatar {
  font-size: 4.5rem;
  width: 95px;
  height: 95px;
  background: #f1f5f9;
  border-radius: 50%;
  border: 3px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.actor-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--navy);
  margin-top: 0.5rem;
}

.dialogue-bubbles-stream {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.bubble-row {
  display: flex;
  width: 100%;
}
.bubble-row.left { justify-content: flex-start; }
.bubble-row.right { justify-content: flex-end; }

.speech-bubble {
  max-width: 82%;
  padding: 1.1rem 1.4rem;
  border-radius: 18px;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.speech-bubble:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.bubble-row.left .speech-bubble {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-bottom-left-radius: 4px;
}
.bubble-row.right .speech-bubble {
  background: #eff6ff;
  border: 2px solid #93c5fd;
  border-bottom-right-radius: 4px;
}

.bubble-speaker {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.bubble-text-ga {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.3;
}
.bubble-text-en {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 0.3rem;
}
.bubble-play-hint {
  font-size: 0.72rem;
  color: var(--shamrock);
  font-weight: 700;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.theatre-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.roleplay-prompt { flex: 1; }
.rp-tag { font-size: 0.78rem; font-weight: 800; color: #b45309; text-transform: uppercase; }
#roleplay-text { font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }
.secondary-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  transition: all 0.2s;
}
.secondary-btn:hover { background: #e2e8f0; }

/* VIEW 2: CEIST & FREAGRA */
.qa-game-layout {
  max-width: 720px;
  margin: 0 auto;
}
.qa-question-card {
  background: var(--surface);
  border: 2px solid var(--shamrock);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.qa-badge {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--shamrock);
  background: #ecfdf5;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 0.5rem;
}
#qa-question-text {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.4rem;
}
.qa-sub { font-size: 0.95rem; color: var(--muted); font-style: italic; margin-bottom: 1.2rem; }
.speak-btn {
  background: #ecfdf5;
  border: 1px solid #86efac;
  color: #065f46;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

.qa-choices-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}
.qa-choice-btn {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.4rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}
.qa-choice-btn:hover { border-color: var(--navy); background: #f8fafc; }
.qa-choice-ga { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; color: var(--navy); }
.qa-choice-en { font-size: 0.85rem; color: var(--muted); font-style: italic; margin-top: 0.2rem; }
.qa-choice-btn.correct { background: #ecfdf5; border-color: #10b981; }
.qa-choice-btn.wrong { background: #fef2f2; border-color: #ef4444; }

.qa-feedback {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 1.2rem;
  min-height: 28px;
}
.action-btn {
  background: var(--navy);
  color: #fff;
  border: none;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.8rem 2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover { background: var(--shamrock); }

/* VIEW 3: PRINTABLE COMIC SHEET */
.printable-comic-sheet {
  background: #fff;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 2rem;
  max-width: 880px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}
.comic-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.sheet-title { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.sheet-meta { display: flex; gap: 1.5rem; font-size: 0.88rem; font-weight: 600; }

.comic-panels-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}
@media (max-width: 600px) {
  .comic-panels-grid { grid-template-columns: 1fr; }
}
.comic-panel {
  border: 3px solid #000;
  border-radius: 8px;
  padding: 1.2rem;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fafafa;
}
.panel-num { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; color: #555; }
.panel-drawing-space {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0.5rem 0;
}
.panel-caption-box {
  border-top: 1px dashed #777;
  padding-top: 0.5rem;
}
.panel-ga-line { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; color: #000; }
.panel-en-line { font-size: 0.8rem; color: #555; font-style: italic; }

@media print {
  .app-header, .mode-tabs, .themes-scroll-bar, .action-btn { display: none !important; }
  .game-view { display: none !important; }
  #view-comic { display: block !important; }
  .printable-comic-sheet { border: 2px solid #000; box-shadow: none; width: 100%; max-width: 100%; padding: 0.5in; }
}
