/* ============================================================
   ANGOFF SIMULATOR – STYLESHEET
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #1a56db;
  --primary-dark: #1341b0;
  --primary-light: #e8f0fe;
  --secondary: #0e9f6e;
  --secondary-light: #d5f5e3;
  --warning: #e3a008;
  --warning-light: #fef3c7;
  --danger: #e02424;
  --danger-light: #fde8e8;
  --info: #3f83f8;
  --info-light: #ebf5fb;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --transition: 0.2s ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}
h1,h2,h3,h4,h5 { line-height: 1.3; }
p { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: .35rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------- Header ---------- */
.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.header-icon { font-size: 2rem; }
.header-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}
.header-brand p {
  font-size: .75rem;
  color: var(--gray-500);
  margin: 0;
}
.header-nav { display: flex; gap: .5rem; }
.nav-btn {
  padding: .45rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: transparent;
  color: var(--gray-600);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.nav-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* Progress bar */
.progress-bar-wrap {
  background: var(--gray-100);
  padding: .4rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.progress-bar-track {
  flex: 1;
  height: 6px;
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-label {
  font-size: .75rem;
  color: var(--gray-500);
  white-space: nowrap;
}

/* ---------- Main / Screens ---------- */
#appMain { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.screen { display: none; }
.screen.active { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; }
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-secondary {
  background: var(--secondary);
  color: var(--white);
  border-color: var(--secondary);
}
.btn-secondary:hover { background: #0b8a5e; }
.btn-warning {
  background: var(--warning);
  color: var(--white);
  border-color: var(--warning);
}
.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ---------- Info Boxes ---------- */
.info-box {
  background: var(--warning-light);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}
.info-box h4 { margin-bottom: .5rem; color: var(--gray-800); }
.info-box--blue {
  background: var(--info-light);
  border-color: var(--info);
}
.info-box--green {
  background: var(--secondary-light);
  border-color: var(--secondary);
}
.info-box--red {
  background: var(--danger-light);
  border-color: var(--danger);
}

/* ---------- HOME SCREEN ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0 2rem;
}
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
}
.hero-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 700;
  padding: .3rem .8rem;
  border-radius: 999px;
  margin-bottom: 1rem;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 1rem;
  line-height: 1.2;
}
@media (max-width: 768px) { .hero-title { font-size: 1.8rem; } }
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--gray-600);
  margin-bottom: 2rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-visual { display: flex; justify-content: center; }
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.hero-card-icon { font-size: 3rem; margin-bottom: 1rem; }
.hero-card h3 { font-size: 1.2rem; margin-bottom: .75rem; }
.hero-card p { opacity: .9; font-size: .95rem; margin: 0; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.feature-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.feature-icon { font-size: 2rem; margin-bottom: .75rem; }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; }
.feature-card p { font-size: .875rem; color: var(--gray-600); margin: 0; }

/* ---------- TUTORIAL SCREEN ---------- */
.tutorial-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  min-height: 60vh;
}
@media (max-width: 768px) {
  .tutorial-layout { grid-template-columns: 1fr; }
}
.tutorial-sidebar {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 100px;
  box-shadow: var(--shadow);
}
.tutorial-sidebar h3 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-500);
  margin-bottom: 1rem;
}
.tutorial-steps-nav { list-style: none; padding: 0; }
.tutorial-steps-nav li {
  margin-bottom: .25rem;
}
.tutorial-steps-nav button {
  width: 100%;
  text-align: left;
  padding: .6rem .85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-600);
  font-size: .875rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.tutorial-steps-nav button:hover { background: var(--gray-100); color: var(--gray-900); }
.tutorial-steps-nav button.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.tutorial-steps-nav .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tutorial-steps-nav button.active .step-num {
  background: var(--primary);
  color: var(--white);
}
.tutorial-steps-nav button.done .step-num {
  background: var(--secondary);
  color: var(--white);
}

.tutorial-content {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  min-height: 400px;
}
.tutorial-content h2 {
  font-size: 1.6rem;
  color: var(--gray-900);
  margin-bottom: .5rem;
}
.tutorial-content .tut-subtitle {
  color: var(--gray-500);
  font-size: .95rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-200);
}
.tutorial-content h3 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; color: var(--gray-800); }
.tutorial-content p { color: var(--gray-700); }

.tut-highlight {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.25rem 0;
  text-align: center;
}
.tut-highlight .big-number {
  font-size: 3rem;
  font-weight: 800;
  display: block;
}
.tut-highlight p { opacity: .9; margin: 0; }

.tut-formula {
  background: var(--gray-900);
  color: #a5f3fc;
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  font-family: 'Courier New', monospace;
  font-size: .95rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.tut-example-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .875rem;
}
.tut-example-table th {
  background: var(--gray-100);
  padding: .6rem .85rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--gray-200);
}
.tut-example-table td {
  padding: .6rem .85rem;
  border: 1px solid var(--gray-200);
}
.tut-example-table tr:nth-child(even) td { background: var(--gray-50); }
.tut-example-table .highlight-row td { background: var(--primary-light); font-weight: 600; }

.workflow-steps {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin: 1rem 0;
}
.workflow-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: .85rem 1rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}
.workflow-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-weight: 700;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workflow-step-body h4 { font-size: .95rem; margin-bottom: .2rem; }
.workflow-step-body p { font-size: .85rem; color: var(--gray-600); margin: 0; }

.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1rem;
}
.tutorial-step-indicator {
  font-size: .875rem;
  color: var(--gray-500);
}

/* ---------- SIMULATION SCREEN ---------- */
.sim-phase { display: none; }
.sim-phase.active { display: block; }

.phase-header {
  margin-bottom: 1.5rem;
}
.phase-badge {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  font-size: .75rem;
  font-weight: 700;
  padding: .25rem .75rem;
  border-radius: 999px;
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.phase-header h2 { font-size: 1.75rem; color: var(--gray-900); margin-bottom: .35rem; }
.phase-header p { color: var(--gray-600); }

.phase-content { }
.phase-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
}

/* Item cards */
.items-container { display: flex; flex-direction: column; gap: 1.5rem; }
.item-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.item-card.flagged { border-color: var(--warning); }
.item-card.flagged .item-header { background: var(--warning-light); }

.item-header {
  background: var(--gray-50);
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}
.item-number {
  font-size: .8rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.item-topic {
  font-size: .8rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: .2rem .65rem;
  border-radius: 999px;
  font-weight: 600;
}
.item-body { padding: 1.25rem; }
.item-vignette {
  font-size: .95rem;
  color: var(--gray-700);
  margin-bottom: 1rem;
  line-height: 1.7;
}
.item-options { list-style: none; padding: 0; margin-bottom: 1.25rem; }
.item-options li {
  padding: .5rem .85rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: .4rem;
  font-size: .9rem;
  color: var(--gray-700);
  display: flex;
  gap: .6rem;
}
.item-options li .opt-label {
  font-weight: 700;
  color: var(--gray-500);
  min-width: 20px;
}
.item-options li.correct {
  background: var(--secondary-light);
  border-color: var(--secondary);
  color: var(--gray-800);
}
.item-options li.correct .opt-label { color: var(--secondary); }

.item-rating-section {
  border-top: 1px solid var(--gray-200);
  padding-top: 1rem;
}
.item-rating-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.rating-input-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.rating-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  background: var(--gray-200);
  outline: none;
  cursor: pointer;
}
.rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.rating-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}
.rating-number-input {
  width: 70px;
  padding: .4rem .6rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
}
.rating-number-input:focus { outline: none; border-color: var(--primary); }
.rating-pct { font-size: .85rem; color: var(--gray-500); }

/* Analysis / Stats */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}
.stat-label {
  font-size: .8rem;
  color: var(--gray-500);
  margin-top: .25rem;
}

.chart-wrap {
  margin-bottom: 1.5rem;
}
.chart-wrap h3 { margin-bottom: 1rem; font-size: 1rem; }

.flagged-items-section { margin-bottom: 1.5rem; }
.flagged-items-section h3 {
  font-size: 1rem;
  margin-bottom: .75rem;
  color: var(--warning);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.flagged-item-row {
  background: var(--white);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: .85rem 1.25rem;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.flagged-item-info { flex: 1; }
.flagged-item-info strong { display: block; font-size: .9rem; }
.flagged-item-info span { font-size: .8rem; color: var(--gray-500); }
.flagged-badges { display: flex; gap: .5rem; flex-wrap: wrap; }
.badge {
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 999px;
}
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: #1e40af; }

/* Discussion */
.discussion-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.discussion-item-header {
  background: var(--warning-light);
  border-bottom: 1px solid var(--warning);
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.discussion-item-header h4 { font-size: .95rem; color: var(--gray-800); }
.discussion-item-body { padding: 1.25rem; }
.discussion-vignette {
  font-size: .875rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
  font-style: italic;
  border-left: 3px solid var(--gray-300);
  padding-left: .85rem;
}
.judge-ratings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.judge-rating-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: .75rem;
  text-align: center;
}
.judge-rating-card.you {
  background: var(--primary-light);
  border-color: var(--primary);
}
.judge-name { font-size: .75rem; color: var(--gray-500); margin-bottom: .25rem; }
.judge-score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-800);
}
.judge-rating-card.you .judge-score { color: var(--primary); }
.judge-name-label { font-size: .7rem; font-weight: 600; color: var(--gray-400); }

.discussion-comment {
  background: var(--info-light);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-size: .875rem;
  color: var(--gray-700);
  margin-bottom: 1rem;
}
.discussion-comment strong { color: var(--primary); }

/* Round 2 item */
.round2-item {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.round2-item.flagged { border-color: var(--warning); }
.round2-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.round2-item-title { font-size: .95rem; font-weight: 600; }
.round2-prev-score {
  font-size: .8rem;
  color: var(--gray-500);
}
.round2-prev-score span { font-weight: 700; color: var(--gray-700); }

/* Results */
.results-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  margin-bottom: 2rem;
}
.results-hero h3 { font-size: 1.1rem; opacity: .85; margin-bottom: .5rem; }
.cutoff-display {
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  margin: .5rem 0;
}
.cutoff-display .cutoff-unit { font-size: 2rem; opacity: .7; }
.results-hero p { opacity: .85; font-size: 1rem; margin: 0; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.results-section {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.results-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.item-score-row {
  display: flex;
  align-items: center;
  gap .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: .875rem;
}
.item-score-row:last-child { border-bottom: none; }
.item-score-name { flex: 1; color: var(--gray-700); }
.item-score-bar-wrap { width: 100px; height: 8px; background: var(--gray-200); border-radius: 999px; overflow: hidden; }
.item-score-bar { height: 100%; background: var(--primary); border-radius: 999px; }
.item-score-val { width: 40px; text-align: right; font-weight: 700; color: var(--gray-800); }

.impact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.impact-table th {
  background: var(--gray-100);
  padding: .6rem .85rem;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--gray-200);
}
.impact-table td {
  padding: .6rem .85rem;
  border: 1px solid var(--gray-200);
}
.impact-table tr:nth-child(even) td { background: var(--gray-50); }

.derivation-steps {
  font-size: .875rem;
  color: var(--gray-700);
}
.derivation-step {
  display: flex;
  gap: .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.derivation-step:last-child { border-bottom: none; }
.derivation-step-icon { font-size: 1.1rem; flex-shrink: 0; }
.derivation-step-text strong { display: block; }

.learning-summary {
  background: var(--secondary-light);
  border: 1px solid var(--secondary);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 2rem;
}
.learning-summary h3 {
  color: var(--secondary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.learning-summary ul { color: var(--gray-700); }
.learning-summary li { margin-bottom: .5rem; }

.restart-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
}
.modal-close:hover { background: var(--gray-200); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--gray-900);
  color: var(--white);
  padding: .85rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  #appMain { padding: 1rem; }
  .header-inner { padding: .6rem 1rem; }
  .header-brand h1 { font-size: .95rem; }
  .header-brand p { display: none; }
  .tutorial-sidebar { position: static; }
  .phase-header h2 { font-size: 1.3rem; }
  .cutoff-display { font-size: 3.5rem; }
}

/* ---------- Print ---------- */
@media print {
  .app-header, .phase-actions, .restart-actions, .print-hidden { display: none !important; }
  .screen { display: block !important; }
  .sim-phase { display: block !important; }
}

/* ---------- Custom Footer ---------- */
.custom-footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  margin-top: 3rem;
  margin-bottom: 2rem;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background-color: #0f172a;
  padding: 0.625rem 1rem;
  border-radius: 1rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  border: 1px solid #1e293b;
  text-decoration: none;
  transition: background-color 0.2s;
}

.footer-badge span {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  color: #f1f5f9;
}

.upr-badge img {
  height: 2rem;
  width: auto;
  object-fit: contain;
}

.github-badge:hover {
  background-color: #1e293b;
}

.github-badge svg {
  height: 1.5rem;
  width: 1.5rem;
  color: white;
}
