/* ==========================================================================
   K Exercise Engine — Shared Styles
   All interactive exercises share this CSS. Per-exercise overrides go in
   exercises/{slug}/styles.css.
   ========================================================================== */

#game { max-width: var(--max-width); margin: 0 auto; padding: var(--space-xl); }

/* ---------- Header / Intro ---------- */

.intro { max-width: 860px; margin: 0 auto; text-align: center; }
.intro-kicker { font-family: var(--font-headline); text-transform: uppercase; letter-spacing: 1px; font-size: 0.75rem; color: var(--accent-red); margin-bottom: var(--space-xs); }
.intro h1 { font-family: var(--font-headline); color: var(--accent); font-size: clamp(1.9rem, 1.2rem + 2.8vw, 3rem); margin: 0 0 var(--space-xs); }
.intro-doctrine { font-family: var(--font-accent); color: var(--muted); margin: 0 0 var(--space-lg); font-size: 1.1rem; }
.intro-art { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin: 0 auto var(--space-xl); max-width: 700px; }
.intro-art img { width: 100%; display: block; }

/* ---------- Progress Bar ---------- */

.progress-wrap { margin-bottom: var(--space-md); }
.progress-bar { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.25s ease; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* ---------- Layout: Stage + Tome ---------- */

.exercise-layout { display: grid; grid-template-columns: 1fr 320px; gap: var(--space-lg); align-items: start; }

.stage { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-lg); }
.stage-header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-sm); margin-bottom: var(--space-md); }
.stage-module { font-family: var(--font-headline); text-transform: uppercase; letter-spacing: 1px; font-size: 0.75rem; color: var(--accent-red); }
.stage-title { margin: 4px 0 0; font-family: var(--font-headline); color: var(--accent); font-size: 1.35rem; }
.stage-irac { font-family: var(--font-mono); font-size: 0.75rem; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 3px; padding: 2px 8px; color: var(--accent); white-space: nowrap; }
.story { color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-md); margin-bottom: var(--space-md); font-size: 0.95rem; }

/* ---------- Tome Sidebar ---------- */

.tome { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); position: sticky; top: 60px; }
.tome-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding: var(--space-sm) var(--space-md); }
.tome-title { font-family: var(--font-headline); color: var(--accent); font-size: 0.95rem; margin: 0; }
.tome-body { padding: var(--space-md); }
.tome-body p { margin: 0 0 var(--space-sm); font-size: 0.9rem; color: var(--muted); line-height: 1.6; }
.tome-body p:last-child { margin-bottom: 0; }

/* ---------- Artifact Cards ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-sm); }
.artifact-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-md); cursor: pointer; text-align: left; color: var(--text); transition: border-color 0.2s; }
.artifact-card:hover { border-color: var(--accent); }
.artifact-name { display: block; font-family: var(--font-headline); color: var(--accent); margin-bottom: 4px; font-size: 0.9rem; }
.artifact-note { color: var(--muted); font-size: 0.85rem; }

/* ---------- Prompt & Choices (MCQ) ---------- */

.prompt { font-size: 1rem; margin-bottom: var(--space-md); }
.choices { display: grid; gap: var(--space-sm); }
.choice { text-align: left; padding: var(--space-md); border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--bg-soft); color: var(--text); cursor: pointer; font-size: 0.95rem; transition: border-color 0.2s; }
.choice:hover { border-color: var(--accent); }
.choice.correct { border-color: #4ade80; background: color-mix(in srgb, #4ade80 10%, var(--bg-soft)); }
.choice.wrong { border-color: var(--red-bright); background: color-mix(in srgb, var(--red-bright) 10%, var(--bg-soft)); }
.choice.dim { opacity: 0.45; cursor: default; }

/* ---------- Feedback ---------- */

.feedback { margin-top: var(--space-md); padding: var(--space-md); border-radius: var(--radius-md); font-size: 0.95rem; line-height: 1.6; }
.feedback.ok { border-left: 4px solid #4ade80; background: color-mix(in srgb, #4ade80 10%, var(--bg-soft)); }
.feedback.bad { border-left: 4px solid var(--red-bright); background: color-mix(in srgb, var(--red-bright) 10%, var(--bg-soft)); }

/* ---------- Buttons ---------- */

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-md); }
.btn-primary, .btn-secondary { border-radius: var(--radius-sm); padding: 0.6rem 1.3rem; font-family: var(--font-headline); font-size: 0.9rem; cursor: pointer; transition: background 0.2s; }
.btn-primary { border: none; background: var(--red-deep); color: #fff; }
.btn-primary:hover { background: var(--red-bright); }
.btn-secondary { border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Modal ---------- */

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center; z-index: 60; }
.modal-card { width: min(680px, calc(100vw - 2rem)); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-lg); }
.modal-title { font-family: var(--font-headline); color: var(--accent-red); margin: 0 0 var(--space-xs); }

/* ---------- Redline ---------- */

.redline-doc { font-family: var(--font-accent); font-size: 1.1rem; line-height: 1.8; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-md); margin-bottom: var(--space-md); }
.redline-target { border-bottom: 2px dashed var(--accent); cursor: pointer; padding: 0 2px; transition: background 0.2s; }
.redline-target:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.redline-target.hit { background: color-mix(in srgb, #4ade80 20%, transparent); border-bottom-color: #4ade80; }

/* ---------- Drag & Drop ---------- */

.bucket-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-sm); }
.draggable { padding: var(--space-sm); border-radius: var(--radius-sm); border: 1px dashed var(--accent); background: var(--bg-soft); cursor: grab; font-size: 0.9rem; transition: border-color 0.2s; }
.draggable:hover { border-color: var(--yellow); }
.bucket { border: 2px dashed var(--border); border-radius: var(--radius-md); min-height: 130px; padding: var(--space-sm); background: var(--bg-soft); transition: border-color 0.2s; }
.bucket.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--bg-soft)); }
.bucket h4 { margin: 0 0 var(--space-xs); font-family: var(--font-headline); color: var(--accent); font-size: 0.85rem; }
.drop-item { margin-top: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 3px; font-size: 0.85rem; }
.drop-message { margin-top: var(--space-xs); color: var(--accent-red); font-size: 0.85rem; min-height: 1.2em; }

/* ---------- Scales (Balancing Test) ---------- */

.scale-wrap { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-md); }
.scale-meter { position: relative; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--red-bright) 28%, var(--bg-soft)); overflow: hidden; margin: var(--space-md) 0; }
.scale-meter .fill { height: 100%; background: color-mix(in srgb, #4ade80 58%, var(--bg-soft)); width: 50%; transition: width 0.2s ease; }
.scale-labels { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--muted); }
.factor-list label { display: block; margin: 0 0 var(--space-xs); font-size: 0.95rem; }

/* ---------- Mad-Libs ---------- */

.madlibs { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-md); line-height: 1.8; font-size: 0.95rem; }
.madlibs select { border: 1px solid var(--border); border-radius: 3px; background: var(--bg-secondary); color: var(--text); padding: 4px 8px; font: inherit; }

/* ---------- Summary ---------- */

.summary { max-width: 760px; margin: 0 auto; text-align: center; padding: var(--space-xl) 0; }
.summary h2 { color: var(--accent); font-family: var(--font-headline); margin: 0 0 var(--space-xs); }
.summary p { color: var(--muted); font-size: 1rem; }
.summary-score { font-size: 2rem; font-weight: 700; color: var(--accent); font-family: var(--font-headline); display: block; margin: var(--space-md) 0; }
.summary-nav { display: flex; gap: var(--space-md); justify-content: center; margin-top: var(--space-lg); flex-wrap: wrap; }

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
  .exercise-layout { grid-template-columns: 1fr; }
  .tome { position: static; }
}
@media (max-width: 760px) {
  #game { padding: var(--space-md); }
  .bucket-wrap { grid-template-columns: 1fr; }
}
