:root {
  --ink: #172d43;
  --muted: #667c8b;
  --bg: #eff5f2;
  --line: #d7e4de;
  --teal: #0c8574;
  --gold: #ffd45f;
  --coral: #eb7968;
  --purple: #7769bd;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 12% 0, #d8eee5, transparent 39%), var(--bg);
  color: var(--ink);
  font:
    15px/1.45 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
button {
  font: inherit;
  cursor: pointer;
}
.top {
  height: 60px;
  padding: 0 max(14px, calc((100vw - 1300px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffffdf;
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--teal);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.13em;
}
.top a {
  color: #536e7f;
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
}
.wrap {
  width: min(1300px, calc(100% - 28px));
  margin: 14px auto 30px;
}
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 22px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(115deg, #152d48, #166b6e);
  box-shadow: 0 12px 28px #173d4a1c;
}
.eyebrow {
  color: #c3f0df;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.14em;
}
.hero h1 {
  margin: 4px 0;
  font-size: clamp(24px, 3vw, 35px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}
.hero p {
  margin: 5px 0 0;
  color: #e1efea;
  font-size: 11px;
}
.hero-icon {
  font-size: 42px;
}
.dashboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin: 9px 0;
}
.metric {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #ffffffdf;
}
.metric small {
  display: block;
  color: var(--muted);
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.07em;
}
.metric b {
  font-size: 14px;
}
.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 9px;
  align-items: start;
}
.arena,
.panel {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 16px #173b4d0a;
}
.arena {
  padding: 9px;
}
.arena-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 7px;
}
.arena-head strong {
  font-size: 12px;
}
.arena-head span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
}
.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid #cadfd6;
  border-radius: 10px;
  background: #193744;
}
.canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
}
.panel {
  padding: 12px;
}
.level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 99px;
  background: #e8f5ee;
  color: #147b65;
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.05em;
}
.level i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #37ac7f;
}
.panel h2 {
  margin: 8px 0 4px;
  font-size: 15px;
  line-height: 1.18;
}
.panel p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}
.objective {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  padding: 8px;
  border-radius: 10px;
  background: #eef6f2;
}
.objective .big {
  font-size: 22px;
}
.objective b {
  display: block;
  font-size: 10px;
}
.objective small {
  color: var(--muted);
  font-size: 8px;
}
.meter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  color: #566f7d;
  font-size: 9px;
  font-weight: 850;
}
.hearts {
  color: #e76e62;
  letter-spacing: 2px;
  font-size: 14px;
}
.bar {
  height: 7px;
  margin-top: 4px;
  border-radius: 99px;
  background: #e8efec;
  overflow: hidden;
}
.bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #37bb8e, #b3dd63);
  transition: width 0.2s;
}
.toast {
  min-height: 34px;
  margin-top: 9px;
  padding: 7px;
  border-radius: 9px;
  background: #f1f6f3;
  color: #466b5e;
  font-size: 9px;
  font-weight: 850;
}
.tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.btn {
  padding: 7px 6px;
  border: 1px solid #d6e3dd;
  border-radius: 8px;
  background: #f5f8f6;
  color: #3e5968;
  font-size: 9px;
  font-weight: 950;
}
.btn:hover {
  background: #e8f3ed;
}
.btn.gold {
  grid-column: 1/-1;
  border: 0;
  background: var(--gold);
  color: #263849;
  box-shadow: 0 3px #d3a83c;
}
.btn:disabled {
  opacity: 0.46;
  cursor: default;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  grid-template-rows: repeat(2, 31px);
  justify-content: center;
  gap: 3px;
  margin: 10px auto 5px;
}
.dpad button {
  border: 1px solid #cbdcd5;
  border-radius: 8px;
  background: #eaf3ee;
  color: #315d53;
  font-size: 14px;
  font-weight: 950;
  touch-action: none;
}
.dpad button:active {
  background: #cfe9dc;
}
.dpad [data-dir="up"] {
  grid-column: 2;
  grid-row: 1;
}
.dpad [data-dir="left"] {
  grid-column: 1;
  grid-row: 2;
}
.dpad [data-dir="down"] {
  grid-column: 2;
  grid-row: 2;
}
.dpad [data-dir="right"] {
  grid-column: 3;
  grid-row: 2;
}
.controls-note {
  text-align: center;
  color: #7a8d96;
  font-size: 8px;
}
.roles {
  margin-top: 9px;
  padding: 8px;
  border-radius: 9px;
  background: #f5f7f6;
  color: #607681;
  font-size: 8px;
}
.roles b {
  color: #234b5a;
}
.overlay {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: #10243bd1;
}
.overlay[hidden] {
  display: none;
}
.dialog {
  width: min(540px, 100%);
  padding: 22px;
  border: 1px solid #c9ddd5;
  border-radius: 20px;
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 75px #07172570;
}
.dialog-icon {
  font-size: 42px;
}
.dialog .eyebrow {
  color: var(--teal);
}
.dialog h2 {
  margin: 7px 0;
  font-size: 23px;
  line-height: 1.1;
}
.dialog p {
  color: #627987;
  font-size: 11px;
}
.goal-select {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 12px 0;
}
.goal {
  padding: 9px 6px;
  border: 1px solid #dce7e1;
  border-radius: 11px;
  background: #f7faf8;
  color: #274553;
}
.goal.selected {
  border-color: #159473;
  background: #e8f7ef;
  box-shadow: inset 0 0 0 1px #159473;
}
.goal span {
  display: block;
  font-size: 22px;
}
.goal strong {
  display: block;
  margin-top: 4px;
  font-size: 9px;
}
.dialog .startbtn {
  padding: 10px 18px;
  border: 0;
  border-radius: 9px;
  background: var(--gold);
  color: #283a4a;
  font-size: 10px;
  font-weight: 950;
}
.dialog .startbtn:disabled {
  opacity: 0.45;
  cursor: default;
}
.roles-line {
  margin: 10px 0;
  padding: 9px;
  border-radius: 10px;
  background: #f0f6f2;
  color: #527166;
  font-size: 9px;
}
.result-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px;
}
.result-stats span {
  padding: 5px 8px;
  border-radius: 99px;
  background: #edf5f1;
  color: #356657;
  font-size: 9px;
  font-weight: 900;
}
.hint-arrow {
  position: absolute;
  z-index: 3;
  display: none;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 99px;
  background: #ffdf7d;
  color: #31495a;
  font-size: 10px;
  font-weight: 950;
  box-shadow: 0 3px 8px #0003;
}
.hint-arrow.show {
  display: block;
  animation: pop 0.25s ease-out;
}
@keyframes pop {
  from {
    transform: translate(-50%, -10px);
  }
  to {
    transform: translate(-50%, 0);
  }
}
@media (max-width: 850px) {
  .game-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
  }
  .panel .level,
  .panel h2,
  .panel > p,
  .objective,
  .meter-row,
  .bar,
  .toast,
  .tools,
  .dpad,
  .controls-note,
  .roles {
    grid-column: 1/-1;
  }
  .arena {
    padding: 6px;
  }
}
@media (max-width: 520px) {
  .wrap {
    width: calc(100% - 14px);
    margin-top: 7px;
  }
  .hero {
    padding: 13px;
  }
  .hero-icon {
    display: none;
  }
  .dashboard {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }
  .metric {
    padding: 6px;
  }
  .metric small {
    font-size: 7px;
  }
  .metric b {
    font-size: 11px;
  }
  .arena-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .panel {
    display: block;
    padding: 10px;
  }
  .goal-select {
    grid-template-columns: 1fr;
  }
  .goal {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
  }
  .goal span {
    font-size: 21px;
  }
  .goal strong {
    margin: 0;
  }
  .dialog {
    padding: 17px;
  }
}
.dialog-icon {
  display: none !important;
}
.hero-icon {
  display: none !important;
}
