:root {
  color-scheme: light;
  --ink: #292339;
  --muted: #696278;
  --purple: #6547ba;
  --stroke: #d9d4e4;
  --paper: #fff;
  --page: #f7f6fb;
  font-family: "Malgun Gothic","Apple SD Gothic Neo",Inter,system-ui,sans-serif;
  color: var(--ink);
  background: var(--page);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .57;
}

button:focus-visible,input:focus-visible {
  outline: 3px solid #895feb;
  outline-offset: 3px;
}

[hidden] {
  display: none!important;
}

.wrap {
  width: min(1220px,calc(100% - 80px));
  margin: auto;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--stroke);
}

.nav {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 900;
  letter-spacing: -1.2px;
  font-size: 20px;
}

.brand-mark {
  height: 36px;
  width: 36px;
  display: grid;
  place-items: center;
  background: #eee8ff;
  border: 1px solid #cec1eb;
  border-radius: 11px;
  transform: rotate(-4deg);
}

.brand-mark img {
  height: 30px;
}

.quiet,.primary,.secondary {
  border-radius: 10px;
  font-weight: 750;
  transition: filter .15s,transform .15s;
}

.quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--stroke);
  padding: 8px 13px;
  font-size: 13px;
}

.quiet span {
  margin-left: 5px;
}

.quiet:hover,.secondary:hover {
  background: #eeebf5;
}

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 34px 4px 27px;
}

.phase {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--purple);
  font-weight: 750;
  font-size: 13px;
}

.phase i,.live-dot {
  width: 8px;
  height: 8px;
  background: #8c65d2;
  display: inline-block;
  border-radius: 50%;
}

h1 {
  font-size: clamp(38px,5vw,64px);
  line-height: 1.12;
  letter-spacing: -.085em;
  margin: 9px 0 8px;
  font-weight: 900;
}

h1 span {
  color: #9463da;
}

.intro p,.panel p {
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
  font-size: 14px;
}

.mascot {
  margin-right: 27px;
  position: relative;
  transform: rotate(6deg);
}

.mascot img {
  width: 80px;
  filter: drop-shadow(0 5px 0 #d8cfe5);
}

.mascot span {
  font-size: 62px;
}

.mascot b,.mascot i {
  position: absolute;
  color: #aa82df;
  font-style: normal;
}

.mascot b {
  left: -19px;
  top: 18px;
  font-size: 21px;
}

.mascot i {
  right: -16px;
  bottom: 14px;
  font-size: 28px;
}

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

.arena-panel,.panel {
  background: var(--paper);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: 0 4px 0 #31233b09;
}

.arena-panel {
  overflow: hidden;
}

.arena-head,.arena-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
}

.arena-head strong {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: 15px;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: #70bc93;
}

.meter,.timer {
  font-size: 13px;
  white-space: nowrap;
}

.meter span,.meter small {
  color: var(--muted);
  font-size: 12px;
}

.meter b,.timer b {
  font-variant-numeric: tabular-nums;
}

.timer {
  background: #f4f1fa;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 7px;
  padding: 5px 8px;
}

.clock-icon {
  width: 12px;
  height: 12px;
  border: 1.5px solid #74658b;
  border-radius: 100%;
  position: relative;
}

.clock-icon:after {
  content: "";
  position: absolute;
  left: 4px;
  top: 2px;
  width: 3px;
  height: 4px;
  border-left: 1px solid #74658b;
  border-bottom: 1px solid #74658b;
}

.stage {
  aspect-ratio: 5/3;
  background: #eee8f7;
  border-block: 1px solid var(--stroke);
  position: relative;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage.interactive canvas {
  cursor: crosshair;
}

.arena-foot {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  min-height: 44px;
}

.panel {
  padding: 21px;
}

.panel section+section:not([hidden]) {
  margin-top: 14px;
}

.panel section[hidden]+section {
  margin-top: 0!important;
}

h2 {
  font-size: 17px;
  letter-spacing: -.055em;
  margin: 0 0 15px;
}

.weapon-list,.actions,#card-list {
  display: grid;
  gap: 9px;
}

.weapon {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--stroke);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 10px;
  width: 100%;
}

.weapon[aria-pressed=true] {
  background: #f3edff;
  border-color: #9b7bce;
  box-shadow: inset 0 0 0 1px #ac8edb;
}

.weapon-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  position: relative;
  flex: none;
}

.hammer-art {
  background: #e6d8ff;
}

.hammer-art i,.hammer-art b {
  position: absolute;
  display: block;
  transform: rotate(37deg);
  border: 1.5px solid #5e3b78;
}

.hammer-art i {
  background: #f2b46c;
  width: 7px;
  height: 23px;
  left: 15px;
  top: 13px;
  border-radius: 4px;
}

.hammer-art b {
  width: 25px;
  height: 13px;
  left: 11px;
  top: 8px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg,#ad72cc 0 3px,#e2b1eb 3px 6px);
}

.fire-art {
  background: #fff0d9;
  font-size: 23px;
}

.weapon strong,.weapon small {
  display: block;
}

.weapon strong {
  font-size: 15px;
  letter-spacing: -.04em;
}

.weapon small {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
}

.weapon em {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #cfc8d9;
  margin-left: auto;
}

.weapon[aria-pressed=true] em {
  background: var(--purple);
  border-color: var(--purple);
}

.weapon[aria-pressed=true] em:after {
  content: "";
  width: 6px;
  height: 3px;
  transform: rotate(-45deg);
  border-left: 1.5px solid white;
  border-bottom: 1.5px solid white;
}

.actions {
  margin-top: 20px;
}

.actions:has(>button:not([hidden])) {
  padding-top: 16px;
  border-top: 1px solid #e6e2ec;
}

.actions:not(:has(>button:not([hidden]))) {
  display: none;
}

.primary,.secondary {
  padding: 11px 14px;
  font-size: 14px;
}

.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  border: 1px solid #583e9a;
  background: var(--purple);
  box-shadow: 0 2px 0 #493082;
}

.primary:hover {
  filter: brightness(1.08);
}

.primary:active {
  transform: translateY(1px);
}

.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--stroke);
}

.panel progress {
  accent-color: #8863d2;
  width: 100%;
  height: 10px;
}

.caught-number {
  margin-bottom: 6px;
  color: #777080;
  font-size: 13px;
}

.caught-number b {
  font-size: 32px;
  color: var(--ink);
}

#card-tip,#peers,#status {
  font-size: 12px;
  margin-top: 8px;
}

.room-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.room-code b {
  font-family: ui-monospace,monospace;
  font-size: 20px;
  letter-spacing: 2px;
}

.card-option {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  border: 1px solid #bba1dd;
  border-radius: 9px;
  color: #36244e;
  background: #f3ecff;
  padding: 10px;
  font-weight: 750;
}

.card-option kbd {
  border: 1px solid #bba1dd;
  background: white;
  border-radius: 4px;
  padding: 2px 5px;
}

.card-option:hover {
  background: #e7daff;
}

.panel #status {
  color: #664a81;
  overflow-wrap: anywhere;
}

footer {
  color: #746b83;
  font-size: 12px;
  margin: 18px 3px 26px;
}

.round-info {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.round-info i {
  color: #b0a6bf;
  font-style: normal;
}

.round-info span {
  padding-left: 9px;
  border-left: 1px solid var(--stroke);
}

.credits {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  line-height: 1.6;
}

.credits h2, .credits p {
  margin: 2px 0;
  font-size: inherit;
}

.credits a {
  color: var(--purple);
  text-underline-offset: 2px;
}

dialog {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 24px;
  color: var(--ink);
  width: min(360px,90vw);
}

dialog::backdrop {
  background: #25193266;
}

dialog label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

dialog input {
  width: 100%;
  border: 1px solid #b6a7c6;
  border-radius: 8px;
  padding: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

@media(max-width:900px) {
  .wrap {
    width: calc(100% - 36px);
  }
  .layout {
    grid-template-columns: minmax(0,1fr) 240px;
    gap: 12px;
  }
  .panel {
    padding: 15px;
  }
  .intro {
    padding: 24px 0;
  }
  .arena-head,.arena-foot {
    padding: 11px;
  }
  .weapon {
    gap: 7px;
  }
  .mascot {
    margin-right: 10px;
  }
}

@media(max-width:700px) {
  .wrap {
    width: calc(100% - 24px);
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .intro {
    padding: 19px 3px;
  }
  .mascot img {
    width: 59px;
  }
  .nav {
    height: 56px;
  }
  .weapon-list {
    grid-template-columns: 1fr 1fr;
  }
  .panel .actions {
    grid-template-columns: repeat(auto-fit,minmax(130px,1fr));
  }
  .arena-head {
    gap: 8px;
  }
  .arena-foot {
    font-size: 10px;
  }
  .intro p {
    font-size: 12px;
  }
}

@media(max-width:390px) {
  .mascot {
    display: none;
  }
  .weapon-icon {
    width: 32px;
  }
  .weapon {
    padding: 8px;
  }
  .weapon em {
    display: none;
  }
}
