:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #142033;
  --muted: #617087;
  --line: #d9e0ea;
  --navy: #173a63;
  --navy-2: #0e2c50;
  --red: #b86262;
  --amber: #e4ac42;
  --orange: #d79a7d;
  --cyan: #2498c8;
  --green: #1f8a5b;
  --shadow: 0 18px 45px rgba(13, 35, 61, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(36, 152, 200, 0.22), transparent 34rem),
    linear-gradient(180deg, #eef5fc 0%, #f7f8fb 44%, #eef2f7 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

main,
.app-header,
.mode-nav,
.app-footer {
  width: min(1100px, calc(100% - 28px));
  margin-inline: auto;
}

.app-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
  padding: max(18px, env(safe-area-inset-top)) 0 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #54708e;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 8px;
  font-size: clamp(1.75rem, 7vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 4.5vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.08rem;
  line-height: 1.28;
}

.subline {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.header-card {
  display: grid;
  min-width: 82px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(16px);
}

.header-card span {
  color: var(--navy);
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.header-card small {
  color: var(--muted);
  font-weight: 700;
}

.mode-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(92px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  background: linear-gradient(180deg, rgba(243, 246, 251, 0.98), rgba(243, 246, 251, 0.82));
  scrollbar-width: none;
}

.mode-nav::-webkit-scrollbar {
  display: none;
}

.mode-button {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy-2);
  background: rgba(255, 255, 255, 0.8);
  font-weight: 800;
  white-space: nowrap;
}

.mode-button.active {
  color: #fff;
  border-color: var(--navy);
  background: var(--navy);
}

main {
  padding: 10px 0 26px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: rise 180ms ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 14px;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--navy);
  background: #e4edf7;
  font-size: 0.88rem;
  font-weight: 900;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  border-radius: 99px;
  background: #dbe4ee;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--navy), var(--cyan));
  transition: width 160ms ease;
}

.slide-card,
.role-card,
.case-card,
.flash-card,
.drill-box,
.sheet-box {
  border: 1px solid rgba(217, 224, 234, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.slide-card {
  padding: clamp(16px, 4vw, 28px);
}

.slide-top {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.slide-top strong {
  color: var(--navy);
  font-size: 0.92rem;
}

.block-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.info-block {
  display: flex;
  min-height: 124px;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  border: 2px solid rgba(10, 22, 36, 0.1);
  border-radius: 18px;
  color: #111827;
  text-align: center;
}

.info-block h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.info-block ul,
.role-card ul,
.sheet-box ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.info-block li,
.role-card li,
.sheet-box li {
  margin: 7px 0;
  line-height: 1.25;
}

.block-navy {
  color: #fff;
  background: linear-gradient(150deg, var(--navy), var(--navy-2));
}

.block-red {
  color: #2f1717;
  background: #d98585;
}

.block-amber {
  background: var(--amber);
}

.block-orange {
  background: var(--orange);
}

.block-cyan {
  background: var(--cyan);
}

.drill-box {
  margin-top: 14px;
  padding: 18px;
}

.hidden-answer {
  padding: 14px;
  border-left: 5px solid var(--green);
  border-radius: 14px;
  background: #eaf7f0;
  color: #163b2b;
  font-weight: 700;
}

.bottom-actions {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.bottom-actions.split {
  grid-template-columns: 1fr 1fr;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.success-button {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  font-weight: 900;
}

.primary-button {
  color: #fff;
  background: var(--navy);
}

.secondary-button {
  color: var(--navy);
  border: 1px solid #c9d5e5;
  background: #fff;
}

.ghost-button {
  color: var(--navy);
  border: 1px solid #c9d5e5;
  background: #ecf3fa;
}

.ghost-button.compact {
  min-height: 40px;
  padding: 9px 12px;
}

.danger-button {
  color: #781f1f;
  background: #fbe3e3;
}

.success-button {
  color: #135433;
  background: #dff5e9;
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.role-tab {
  min-height: 54px;
  padding: 12px;
  border: 2px solid transparent;
  border-radius: 18px;
  color: #fff;
  background: var(--navy);
  font-weight: 900;
}

.role-tab.active {
  border-color: #111827;
  box-shadow: 0 0 0 4px rgba(20, 32, 51, 0.12);
}

.role-tab.role-red {
  background: var(--red);
}

.role-tab.role-amber {
  color: #201407;
  background: var(--amber);
}

.role-tab.role-cyan {
  background: var(--cyan);
}

.role-card,
.case-card,
.flash-card {
  padding: 18px;
}

.role-card .mission {
  color: var(--muted);
  font-weight: 700;
}

.check-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f6;
}

.check-dot {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  font-size: 0.82rem;
  font-weight: 900;
}

.role-prompt,
.case-question {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: #eff5fb;
}

.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.choice-button {
  width: 100%;
  padding: 14px;
  border: 1px solid #d6e0ec;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  text-align: left;
}

.choice-button:disabled {
  cursor: default;
  opacity: 1;
}

.choice-button.correct {
  border-color: #3aa56f;
  background: #ddf6e9;
}

.choice-button.wrong {
  border-color: #d14c4c;
  background: #fde5e5;
}

.feedback-box {
  display: none;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: #172b46;
  color: #fff;
  font-weight: 700;
}

.feedback-box.show {
  display: block;
}

.case-action-row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.case-action-row.two {
  grid-template-columns: 1fr 1fr;
}

.case-result {
  padding: 2px 0 16px;
}

.case-result h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 12vw, 4rem);
}

.case-score {
  height: 12px;
  overflow: hidden;
  margin: 16px 0;
  border-radius: 999px;
  background: #dde7f1;
}

.case-score div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.case-review-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 6px 0 0;
  list-style: none;
}

.case-review-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #d9e0ea;
  border-radius: 16px;
  background: #f8fafc;
}

.case-review-item.correct {
  border-color: #9fd8bc;
  background: #eaf7f0;
}

.case-review-item.wrong {
  border-color: #efb0b0;
  background: #fff0f0;
}

.case-review-item span {
  color: var(--muted);
  font-weight: 700;
}

.case-meta,
.flash-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.mini-pill {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--navy);
  background: #e7eef7;
  font-size: 0.8rem;
  font-weight: 900;
}

.flash-card {
  min-height: 300px;
  display: grid;
  align-content: center;
}

.flash-question {
  font-size: clamp(1.35rem, 6vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.flash-answer {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: #eaf7f0;
  color: #143b2a;
  font-size: 1.04rem;
  font-weight: 800;
}

.search-label {
  display: block;
  margin: 8px 0;
  color: var(--muted);
  font-weight: 900;
}

.search-input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid #cbd7e5;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
  outline: none;
}

.search-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(36, 152, 200, 0.18);
}

.sheet-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.sheet-box {
  padding: 18px;
}

.sheet-box h3 {
  color: var(--navy);
}

.sheet-box li {
  position: relative;
  padding-left: 22px;
}

.sheet-box li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
}

.app-footer {
  padding: 0 0 max(22px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

@media (min-width: 760px) {
  .app-header {
    padding-top: 34px;
  }

  .slide-card,
  .role-card,
  .case-card,
  .flash-card,
  .drill-box,
  .sheet-box {
    padding: 26px;
  }

  .role-tabs {
    grid-template-columns: repeat(4, 1fr);
  }

  .sheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  main,
  .app-header,
  .mode-nav,
  .app-footer {
    width: min(100% - 18px, 1100px);
  }

  .app-header {
    grid-template-columns: 1fr;
  }

  .header-card {
    display: none;
  }

  .block-grid {
    grid-template-columns: 1fr;
  }

  .bottom-actions {
    grid-template-columns: 1fr;
  }
}
