:root {
  --ink: #11203a;
  --muted: #5d6b82;
  --panel: #ffffff;
  --line: #d8e1ef;
  --sky: #dff6ff;
  --mint: #5ee0b5;
  --coral: #ff6b6b;
  --gold: #ffd166;
  --violet: #7c6ee6;
  --navy: #13294b;
  --bg: #f6fbff;
  --shadow: 0 18px 45px rgba(24, 48, 88, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(45, 212, 191, 0.28), transparent 26rem),
    radial-gradient(circle at 86% 14%, rgba(14, 165, 233, 0.2), transparent 24rem),
    linear-gradient(180deg, #f7fdff 0%, #e8fbff 54%, #f2fffb 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(216, 225, 239, 0.75);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 900;
}

.brand-text {
  display: grid;
  line-height: 1.05;
}

.brand-owner {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand img {
  width: 42px;
  height: 42px;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.page {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.site-footer {
  width: min(1180px, calc(100% - 2rem));
  margin: auto auto 0;
  padding: 1.25rem 0 1.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid rgba(216, 225, 239, 0.9);
}

.site-footer a {
  color: var(--navy);
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  min-height: calc(100vh - 92px);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero p {
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-visual {
  position: relative;
  min-height: 460px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(247, 254, 255, 0.98), rgba(210, 247, 249, 0.9)),
    linear-gradient(180deg, #ffffff, #e8fbff);
  border: 1px solid rgba(200, 238, 244, 0.9);
  box-shadow: var(--shadow);
}

.reef-scene {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(45,212,191,0.12) 100%);
}

.reef-eye {
  position: absolute;
  width: 260px;
  min-height: 240px;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 44px rgba(15, 79, 103, 0.16);
  display: grid;
  gap: 0.9rem;
  place-items: center;
  padding: 1.4rem;
}

.reef-eye img {
  width: 138px;
  height: 138px;
}

.reef-eye strong {
  font-size: 1.35rem;
  color: var(--navy);
  font-weight: 800;
  text-align: center;
}

.reef-wave {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 90px;
  border: 3px solid rgba(14, 165, 198, 0.2);
  border-color: rgba(14, 165, 198, 0.2) transparent transparent transparent;
  border-radius: 50%;
}

.reef-wave.one {
  bottom: 18%;
}

.reef-wave.two {
  bottom: 7%;
  transform: scaleX(0.82);
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(94, 224, 209, 0.32);
  border: 1px solid rgba(14, 165, 198, 0.3);
}

.bubble.b1 {
  width: 28px;
  height: 28px;
  left: 17%;
  bottom: 34%;
}

.bubble.b2 {
  width: 18px;
  height: 18px;
  right: 25%;
  top: 21%;
}

.bubble.b3 {
  width: 38px;
  height: 38px;
  right: 14%;
  top: 34%;
}

.auth-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.panel,
.game-card,
.metric-tile {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(30, 58, 99, 0.08);
}

.panel {
  padding: 1.25rem;
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.form-stack {
  display: grid;
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
}

.field.compact {
  min-width: min(100%, 260px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.72rem 1rem;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(19, 41, 75, 0.18);
}

.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.coral {
  background: var(--coral);
}

.btn.mint {
  background: #0d9f7a;
}

.notice {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  color: #20405f;
  background: #e8f7ff;
  border: 1px solid #bce8ff;
}

.error {
  color: #9b1c31;
  background: #ffe8ec;
  border-color: #ffc2cd;
}

.game-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.game-list {
  display: grid;
  gap: 0.75rem;
}

.module-group {
  display: grid;
  gap: 0.65rem;
  padding-bottom: 0.75rem;
}

.module-group h2 {
  margin: 0.4rem 0 0;
  font-size: 1rem;
  color: var(--navy);
}

.prep-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.prep-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.game-card {
  padding: 1rem;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.game-card:hover,
.game-card.active {
  transform: translateY(-2px);
  border-color: var(--violet);
}

.game-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.game-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.game-stage {
  min-height: 640px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.metric-tile {
  padding: 0.75rem;
}

.metric-tile small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.metric-tile strong {
  font-size: 1.35rem;
}

.canvas-wrap {
  position: relative;
  min-height: 470px;
  background: #f8fcff;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.letter-stage {
  height: 100%;
  min-height: 470px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fdfefe, #dff6ff);
}

.focus-letter {
  width: min(78vw, 620px);
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--navy);
  font-weight: 1000;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.control-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  margin: 0.85rem 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fcff;
}

.doctor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
}

.chart-panel {
  margin-top: 1rem;
  height: 420px;
}

.patient-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.patient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 860px) {
  .hero,
  .auth-grid,
  .dashboard-grid,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    min-height: 320px;
  }

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

  .game-stage {
    min-height: 560px;
  }
}
