
/* =========================================================
   SCIENCE DETECTIVE
   Games to Literacy
   ========================================================= */

:root {
  --background: #f3f7f5;
  --surface: #ffffff;
  --primary: #087f65;
  --primary-dark: #075e4c;
  --primary-light: #e5f5ef;
  --hero: #103e36;
  --text: #19352e;
  --muted: #5d726b;
  --border: #dce7e2;
  --gold: #f4c95d;
  --success: #087443;
  --error: #b33b35;
  --radius: 18px;
  --shadow: 0 8px 28px rgba(16, 62, 54, 0.07);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h2 {
  line-height: 1.3;
  font-size: 1.55rem;
}

h3 {
  font-size: 1.1rem;
}

:focus-visible {
  outline: 3px solid #168fca;
  outline-offset: 4px;
}


/* HEADER */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1240px;
  margin: auto;
  padding: 17px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-icon {
  background: var(--hero);
  color: white;
  padding: 9px;
  border-radius: 13px;
  font-size: 27px;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.4;
}

.brand strong {
  font-size: 19px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.header-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stat-pill,
.mode-pill {
  padding: 7px 12px;
  border-radius: 30px;
  background: var(--primary-light);
  font-size: 12px;
  font-weight: 700;
}

.mode-pill {
  background: #eef1ef;
  color: var(--muted);
}

.mode-pill.live {
  background: #d7f4e4;
  color: var(--success);
}


/* MAIN LAYOUT */

.page-container {
  width: min(1200px, calc(100% - 40px));
  margin: 28px auto;
}

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(125deg, #103e36, #087f65);
  border-radius: 25px;
  color: white;
  padding: 45px;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 740px;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.15;
  margin-bottom: 18px;
  letter-spacing: -1.5px;
}

.hero p {
  color: #d8eee6;
}

.eyebrow {
  color: #b4e7d4 !important;
  letter-spacing: 2px;
  font-size: 11px;
  font-weight: 800;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-tags span {
  padding: 6px 11px;
  color: white;
  border: 1px solid #ffffff35;
  background: #ffffff12;
  border-radius: 20px;
  font-size: 12px;
}

.hero-art {
  position: relative;
  width: 190px;
  height: 190px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.hero-symbol {
  font-size: 95px;
  position: relative;
  z-index: 1;
}

.orbit {
  position: absolute;
  inset: 0;
  border: 2px solid #ffffff30;
  border-radius: 50%;
}

.orbit-one {
  transform: rotate(35deg) scaleY(0.45);
}

.orbit-two {
  transform: rotate(-35deg) scaleY(0.45);
}

.game-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.section-number {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: var(--primary-dark);
  margin-bottom: 10px;
}


/* FORM CONTROLS */

form > label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 14px;
}

select,
textarea {
  width: 100%;
  border: 1px solid #cbdad3;
  border-radius: 10px;
  background: #fcfefd;
  color: var(--text);
  padding: 12px;
}

select {
  margin-bottom: 20px;
}

textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
}

fieldset {
  padding: 0;
  border: 0;
  margin: 0;
  min-width: 0;
}

.difficulty-fieldset legend {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 23px;
}

.difficulty-options label {
  position: relative;
  cursor: pointer;
}

.difficulty-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.difficulty-options span {
  display: block;
  text-align: center;
  padding: 9px 4px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f7faf8;
}

.difficulty-options input:checked + span {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.difficulty-options input:focus-visible + span {
  outline: 3px solid #168fca;
  outline-offset: 2px;
}


/* BUTTONS */

.button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 19px;
  font-weight: 750;
  font-size: 14px;
  min-height: 46px;
  transition: background 0.18s;
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.secondary {
  background: #f3f8f5;
  border-color: var(--border);
  color: var(--primary-dark);
}

.secondary:hover:not(:disabled) {
  background: #e0eee5;
}

.full-width {
  width: 100%;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.text-button {
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  font-size: 13px;
}

.detective-tip {
  margin-top: 24px;
  background: var(--primary-light);
  border-radius: 12px;
  padding: 16px;
  font-size: 13px;
}

.detective-tip p {
  margin: 7px 0 0;
}

.small-note {
  color: var(--muted);
  font-size: 12px;
  margin: 12px 0;
}


/* CASE FILE */

.game-panel {
  min-height: 490px;
  scroll-margin-top: 20px;
}

.empty-state {
  min-height: 430px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-state p {
  max-width: 420px;
  color: var(--muted);
}

.empty-icon {
  font-size: 55px;
  padding: 10px 24px;
  background: var(--primary-light);
  border-radius: 50%;
  margin-bottom: 20px;
}

.case-header {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.case-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.case-topline .section-number {
  margin: 0;
}

.case-source {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 20px;
  background: #f0f4f1;
}

.case-header h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 15px 0;
}

.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.case-tags span {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.evidence-box {
  background: #f1f7f3;
  border-left: 4px solid var(--primary);
  border-radius: 9px;
  padding: 20px;
  margin-bottom: 24px;
}

.evidence-box h3 {
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.evidence-box p {
  margin-bottom: 0;
  font-size: 17px;
}


/* ANSWER OPTIONS */

.answer-fieldset legend {
  font-size: 18px;
  font-weight: 750;
  margin-bottom: 15px;
}

.answer-options {
  display: grid;
  gap: 10px;
}

.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  background: white;
}

.answer-option:hover {
  background: #f4f9f6;
}

.answer-option input {
  margin: 6px 0 0;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.answer-option:has(input:checked) {
  border: 2px solid var(--primary);
  padding: 13px;
  background: var(--primary-light);
}

.answer-option.correct-option {
  background: #e6f7eb;
  border-color: var(--success);
}

.answer-option.wrong-option {
  background: #fff0ef;
  border-color: var(--error);
}

.reasoning-label {
  display: block;
  font-weight: 750;
  margin-top: 24px;
  margin-bottom: 7px;
}

.optional {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.hint-panel {
  margin-top: 18px;
  padding: 17px;
  border: 1px solid #ebd48e;
  border-radius: 10px;
  background: #fff8df;
  color: #715415;
}

.hint-panel p {
  margin: 7px 0 0;
}

.message {
  font-size: 14px;
  color: var(--error);
  margin: 12px 0 0;
}

.message:empty {
  display: none;
}


/* CASE REVIEW */

.feedback-panel {
  border-top: 1px solid var(--border);
  margin-top: 28px;
  padding-top: 25px;
  scroll-margin-top: 20px;
}

.feedback-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 15px 0;
}

.feedback-heading h2 {
  margin-bottom: 0;
}

.feedback-status {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 5px;
}

.score-ring {
  width: 100px;
  height: 100px;
  border: 7px solid var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  line-height: 1.25;
}

.score-ring strong {
  font-size: 30px;
}

.score-ring span {
  color: var(--muted);
  font-size: 12px;
}

.score-ring.incorrect {
  border-color: #d8a45b;
}

.review-box {
  padding: 16px;
  background: #f5f8f6;
  border-radius: 10px;
  margin-top: 13px;
}

.review-box h3 {
  margin-bottom: 7px;
}

.review-box p {
  margin-bottom: 0;
}


/* PROGRESS */

.progress-panel,
.educational-content {
  margin-top: 24px;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.progress-item {
  background: #f4f8f5;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 10px;
  text-align: center;
}

.progress-item strong {
  display: block;
  font-size: 30px;
  color: var(--primary-dark);
  line-height: 1.5;
}

.progress-item span {
  font-size: 12px;
  color: var(--muted);
}

.rank-label {
  font-weight: 750;
  color: var(--primary-dark);
  margin: 18px 0 5px;
}


/* EDUCATIONAL SECTION */

.educational-content {
  line-height: 1.8;
}

.educational-content h3 {
  margin-top: 24px;
}

.educational-content li {
  margin-bottom: 5px;
}

.related-games {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.related-games a {
  background: var(--primary-light);
  border-radius: 9px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
}


/* FOOTER */

.site-footer {
  padding: 25px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.site-footer p {
  margin-bottom: 5px;
}


/* LOADING OVERLAY */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(10, 40, 31, 0.68);
  padding: 20px;
}

.loading-card {
  width: min(400px, 100%);
  background: white;
  padding: 35px;
  border-radius: 18px;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #e0eee7;
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 22px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


/* RESPONSIVE DESIGN */

@media (max-width: 850px) {

  .game-layout {
    grid-template-columns: 1fr;
  }

  .hero-art {
    width: 130px;
    height: 130px;
  }

  .hero-symbol {
    font-size: 70px;
  }

  .hero {
    padding: 32px;
  }

}

@media (max-width: 550px) {

  .page-container {
    width: calc(100% - 24px);
    margin-top: 15px;
  }

  .header-inner {
    padding: 14px;
  }

  .hero {
    padding: 25px;
  }

  .hero-art {
    display: none;
  }

  .panel {
    padding: 18px;
  }

  .progress-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-row > button {
    flex: 1 1 100%;
  }

  .hero h1 {
    letter-spacing: -0.6px;
  }

  .score-ring {
    width: 80px;
    height: 80px;
  }

  .score-ring strong {
    font-size: 24px;
  }

}

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

}
