/* Game UI. Desktop defaults, then compact layouts. */
* {
  box-sizing: border-box;
}
[hidden] {
  display: none!important;
}
:root {
  font-family: Arial,Helvetica,sans-serif;
  color: #123944;
  background: #eff7f5;
  font-synthesis: none;
  --blue: #168bb7;
  --gold: #c18821;
  --ink: #183b41;
}
body {
  margin: 0;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  touch-action: manipulation;
}
button:disabled {
  cursor: default;
}
button:focus-visible {
  outline: 3px solid #074f75;
  outline-offset: 4px;
}
summary:focus-visible {
  outline: 3px solid #074f75;
  outline-offset: 4px;
}
.topbar {
  height: 78px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #c3d9d3;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand-mark {
  background: #183b41;
  color: #f9e7b8;
  width: 40px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 30px;
  border-radius: 8px;
}
.brand strong {
  font-size: 18px;
  letter-spacing: 1px;
  display: block;
}
.brand small {
  display: block;
  font-size: 12px;
  letter-spacing: 1.3px;
  margin-top: 7px;
  color: #597477;
}
.brand small span {
  padding: 0 8px;
  color: #b3c5bf;
}
.tools {
  display: flex;
  gap: 7px;
}
.tool {
  background: transparent;
  border: 1px solid #c4d7d1;
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 14px;
  color: #234d58;
  min-height: 42px;
}
.tool:hover:not(:disabled) {
  background: #dcece7;
}
.tool[aria-pressed=true] {
  background: #dcece7;
}
.tool:disabled {
  opacity: .4;
}
#game {
  height: calc(100svh - 78px);
  min-height: 610px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
#arena {
  position: absolute;
  inset: 0;
}
#arena canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.hud {
  position: absolute;
  top: 22px;
  left: 32px;
  right: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}
.fighter {
  width: 290px;
  background: #f8fffcf2;
  border: 1px solid #ecfffb;
  border-radius: 22px;
  padding: 14px 16px 10px;
  box-shadow: 0 5px 18px #2d787b10;
}
.fighter-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.emblem {
  width: 36px;
  height: 38px;
  background: #d6f1f9;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: var(--blue);
}
.gold .emblem {
  color: var(--gold);
  background: #fff1cf;
}
.fighter small {
  font-size: 11px;
  letter-spacing: 1px;
  color: #4a6667;
}
.fighter strong {
  display: block;
  font-size: 19px;
  margin-top: 3px;
}
.fighter em {
  font-style: normal;
  font-size: 10px;
  vertical-align: middle;
  border: 1px solid #d8cca8;
  border-radius: 3px;
  padding: 2px 4px;
  margin-left: 3px;
  color: #7c621e;
  letter-spacing: 0;
}
.fighter b {
  margin-left: auto;
  font-size: 24px;
  letter-spacing: -1px;
  font-weight: 700;
}
.fighter b span {
  font-size: 11px;
  letter-spacing: 0;
  color: #617b7a;
}
.hp-track {
  height: 6px;
  background: #dfeae5;
  overflow: hidden;
  border-radius: 3px;
  margin-top: 12px;
}
.hp-track div {
  height: 100%;
  width: 100%;
  background: #2998c1;
  transition: width .18s;
}
.gold .hp-track div {
  background: #e4ac3e;
}
.fighter .fighter-state {
  display: block;
  letter-spacing: 0;
  margin-top: 8px;
  min-height: 17px;
  font-size: 14px;
  color: #385a5b;
}
.clock {
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
#timer {
  height: 66px;
  width: 66px;
  border: 3px solid #ffffffa6;
  border-radius: 50%;
  background: #164d62;
  color: white;
  display: grid;
  place-items: center;
  font-size: 30px;
  box-shadow: 0 0 0 5px #ffffff25;
  font-variant-numeric: tabular-nums;
}
.clock small {
  display: block;
  font-size: 13px;
  letter-spacing: 1px;
  margin-top: 14px;
  font-weight: bold;
  white-space: nowrap;
}
#timer.urgent {
  background: #b44330;
}
.question-panel {
  position: absolute;
  bottom: auto;
  left: 32px;
  right: 32px;
  max-width: 1150px;
  margin: auto;
  background: #f7fcf9f7;
  border: 1px solid #fff;
  border-radius: 22px;
  padding: 22px 24px 12px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  column-gap: 28px;
  box-shadow: 0 10px 35px #2d696a1a;
  top: 50%;
  transform: translateY(-50%);
  max-height: calc(100% - 165px);
  overflow: auto;
}
.eyebrow {
  font-size: 13px;
  font-weight: bold;
  letter-spacing: .8px;
  color: #537270;
  margin-bottom: 12px;
}
.question-copy h1 {
  font-size: 27px;
  line-height: 1.35;
  margin: 0;
  font-weight: 600;
  max-width: 490px;
}
.question-copy p {
  font-size: 15px;
  color: #305860;
  margin: 12px 0 0;
}
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.answer {
  min-height: 82px;
  background: #e4f1f2;
  color: #143f50;
  border: 1px solid #cedfda;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 10px 14px;
  font-size: 20px;
  font-weight: 600;
  transition: background .13s;
  line-height: 1.35;
}
.answer .key {
  font-size: 16px;
  font-weight: bold;
  border: 1px solid #b6cfca;
  border-radius: 4px;
  min-width: 30px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #f8fcfa;
  width: 30px;
}
.answer:hover:not(:disabled) {
  background: #d9ece7;
  border-color: #5c9d9a;
}
.answer.selected {
  background: #235d70;
  border-color: #235d70;
  color: white;
}
.answer.selected .key {
  background: #386e7f;
  color: white;
}
.answer:disabled:not(.selected) {
  opacity: .65;
}
.question-footer {
  grid-column: 1/-1;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #dbe8e3;
  padding-top: 10px;
  margin-top: 15px;
  font-size: 13px;
  color: #355e65;
  gap: 12px;
}
.combat-banner {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(600px,90%);
  text-align: center;
  background: #f7fcf9f5;
  border: 1px solid white;
  padding: 18px 25px;
  border-radius: 12px;
  box-shadow: 0 10px 30px #22545615;
}
.combat-banner small {
  font-size: 10px;
  letter-spacing: 3px;
  color: #597b7a;
}
.combat-banner strong {
  font-size: 27px;
  display: block;
  margin: 9px 0;
  color: #204c54;
}
.combat-banner div {
  font-size: 16px;
  color: #516f71;
}
.review-panel {
  position: absolute;
  bottom: 24px;
  left: 32px;
  right: 32px;
  max-width: 1000px;
  margin: auto;
  border: 1px solid white;
  background: #f7fcf9fa;
  padding: 18px 22px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 30px;
  justify-content: space-between;
  box-shadow: 0 10px 30px #22545615;
}
.review-panel .eyebrow {
  margin-bottom: 8px;
}
.review-panel h2 {
  font-size: 25px;
  margin: 0 0 9px;
}
.review-panel p {
  font-size: 19px;
  line-height: 1.45;
  max-width: 750px;
  margin: 0 0 10px;
}
.review-panel small {
  font-size: 14px;
  color: #587775;
  line-height: 1.5;
}
.primary {
  background: #087caa;
  color: white;
  border-radius: 14px;
  padding: 16px 21px;
  min-height: 58px;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 35px;
  white-space: nowrap;
}
.primary:hover {
  background: #06648c;
}
.primary span {
  font-size: 20px;
}
.overlay {
  position: absolute;
  inset: 0;
  background: #86bbc04d;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  padding: 25px;
}
.dialog {
  width: 480px;
  background: #f5fbf7f7;
  border: 1px solid white;
  border-radius: 22px;
  padding: 34px;
  box-shadow: 0 20px 70px #1f5e6330;
}
.dialog .eyebrow {
  color: #53847b;
}
.dialog h1 {
  font-size: 35px;
  letter-spacing: -1.1px;
  line-height: 1.16;
  margin: 0 0 20px;
}
.dialog p {
  font-size: 17px;
  line-height: 1.6;
  color: #355963;
}
.rules {
  border-block: 1px solid #d4e5de;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 17px 0;
  margin: 22px 0;
}
.rules span {
  font-size: 13px;
  color: #53716d;
}
.rules b {
  font-size: 26px;
  display: block;
  margin-bottom: 6px;
  color: #255b62;
}
.dialog>.primary {
  width: 100%;
}
.dialog>small {
  display: block;
  font-size: 13px;
  color: #56746f;
  line-height: 1.6;
  margin-top: 13px;
}
.arena-label {
  position: absolute;
  left: 33px;
  bottom: 7px;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: #2c6f74;
  pointer-events: none;
}
.result-score {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #e6f0e9;
  padding: 18px;
  margin: 15px 0;
  border-radius: 8px;
}
.result-score div {
  text-align: center;
}
.result-score b {
  display: block;
  font-size: 43px;
}
.result-score small {
  font-size: 9px;
  letter-spacing: 1px;
}
.blue-text {
  color: #197ca2;
}
.gold-text {
  color: #a57219;
}
.result-dialog {
  max-height: calc(100% - 20px);
  overflow: auto;
  width: 530px;
}
.result-dialog h1 {
  margin-bottom: 8px;
}
.result-dialog details {
  margin: 15px 0;
  font-size: 16px;
}
.result-dialog summary {
  cursor: pointer;
  color: #38645f;
  padding: 8px 0;
}
.history-round {
  border-top: 1px solid #d7e5de;
  padding: 10px 0;
  line-height: 1.6;
  font-size: 16px;
}
.history-round small {
  display: block;
  color: #53706d;
}
.compact {
  width: 390px;
}
#fatal {
  position: absolute;
  inset: 30%;
  margin: 0;
  padding: 25px;
  background: #fff4e9;
  color: #8b3621;
  z-index: 8;
  border-radius: 8px;
  line-height: 1.6;
}
#start-dialog {
  width: 520px;
  max-height: calc(100% - 12px);
  overflow: auto;
}
#start-dialog h1 {
  margin-bottom: 20px;
}
.menu-face {
  position: relative;
  float: right;
  color: #e3ac60;
  font-size: 54px;
  line-height: 45px;
}
.menu-face span {
  position: absolute;
  left: 11px;
  top: 4px;
  font-size: 16px;
  color: #385961;
}
.grade-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}
.grade-button {
  padding: 13px 4px;
  border: 1px solid #bdd6d1;
  border-radius: 12px;
  background: #e4eeea;
  color: #365f64;
  font-size: 17px;
  font-weight: bold;
  min-height: 52px;
}
.grade-button[aria-pressed=true] {
  background: #087caa;
  color: white;
  border-color: #056a92;
  box-shadow: 0 3px 0 #b3cfc6;
}
.grade-button:hover {
  border-color: #3f7980;
}
#grade-description {
  min-height: 58px;
  font-size: 17px;
  margin-bottom: 6px;
  color: #355963;
}
#start-dialog .difficulty-note {
  font-size: 14px;
  color: #55776f;
  margin: 0;
  line-height: 1.5;
}
.secondary {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #bdd6d1;
  border-radius: 12px;
  background: #e3ede7;
  color: #305d62;
  font-size: 17px;
  min-height: 48px;
}
.bot-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
#bot-description {
  font-size: 14px;
  margin: 7px 0 0;
}
.waiting-banner {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px,90%);
  padding: 18px 22px;
  border: 1px solid white;
  border-radius: 18px;
  background: #f7fcf9f5;
  text-align: center;
  color: #184a59;
}
.waiting-banner strong {
  display: block;
  font-size: 20px;
  margin-bottom: 7px;
}
.waiting-banner span {
  font-size: 15px;
}
.review-panel .primary {
  min-height: 50px;
  padding: 12px 16px;
}
.round-details {
  font-size: 14px;
  color: #345f69;
  line-height: 1.5;
}
.round-details summary {
  cursor: pointer;
}

@media (max-width: 850px) {
  .topbar {
    height: 68px;
    padding: 0 17px;
  }
  .brand-mark {
    display: none;
  }
  .brand strong {
    font-size: 14px;
  }
  .brand small {
    letter-spacing: .6px;
  }
  .tools {
    gap: 4px;
  }
  .tool {
    padding: 8px;
    font-size: 12px;
  }
  #game {
    height: calc(100svh - 68px);
    min-height: 570px;
  }
  .hud {
    top: 16px;
    left: 18px;
    right: 18px;
  }
  .fighter {
    width: 240px;
    padding: 10px;
  }
  .fighter b {
    font-size: 20px;
  }
  .question-panel {
    left: 18px;
    right: 18px;
    padding: 18px;
    column-gap: 16px;
  }
  .question-copy h1 {
    font-size: 23px;
  }
  .answer {
    min-height: 76px;
    gap: 8px;
    padding: 9px;
    font-size: 18px;
  }
  .review-panel {
    bottom: 20px;
    left: 18px;
    right: 18px;
    column-gap: 16px;
  }
  .arena-label {
    left: 20px;
  }
  .clock #timer {
    width: 56px;
    height: 56px;
    font-size: 26px;
  }
}

@media (max-width: 580px) {
  .topbar {
    height: 102px;
    padding: 12px 15px;
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }
  .brand strong {
    font-size: 16px;
  }
  .brand small {
    display: none;
  }
  .tools {
    width: 100%;
    justify-content: space-between;
  }
  .tool {
    min-height: 34px;
  }
  #game {
    height: calc(100svh - 102px);
    min-height: 720px;
  }
  #arena {
    bottom: 210px;
  }
  .hud {
    top: 12px;
    left: 10px;
    right: 10px;
  }
  .fighter {
    width: 38%;
    padding: 9px;
  }
  .fighter-top {
    gap: 3px;
  }
  .emblem {
    display: none;
  }
  .fighter small {
    font-size: 9px;
    letter-spacing: .6px;
  }
  .fighter strong {
    font-size: 12px;
  }
  .fighter em {
    font-size: 8px;
    display: inline;
  }
  .fighter b {
    font-size: 19px;
  }
  .fighter b span {
    font-size: 9px;
  }
  .hp-track {
    height: 4px;
    margin-top: 8px;
  }
  .fighter .fighter-state {
    margin-top: 6px;
    font-size: 11px;
  }
  #timer {
    height: 48px!important;
    width: 48px!important;
    font-size: 24px!important;
  }
  .clock small {
    font-size: 10px;
    margin-top: 10px;
  }
  .question-panel {
    left: 10px;
    right: 10px;
    padding: 15px;
    grid-template-columns: 1fr;
    row-gap: 12px;
    top: 53%;
    max-height: calc(100% - 160px);
  }
  .eyebrow {
    font-size: 11px;
    margin-bottom: 7px;
  }
  .question-copy h1 {
    font-size: 21px;
    max-width: none;
  }
  .question-copy p {
    font-size: 14px;
    margin-top: 7px;
  }
  .answer {
    gap: 7px;
    padding: 10px;
  }
  .answer .key {
    font-size: 14px;
    min-width: 24px;
    height: 28px;
    width: 24px;
  }
  .question-footer {
    padding-top: 9px;
    margin-top: 0;
    font-size: 11px;
    gap: 5px;
    flex-wrap: wrap;
  }
  .combat-banner strong {
    font-size: 23px;
  }
  .combat-banner div {
    font-size: 15px;
  }
  .review-panel {
    bottom: 18px;
    left: 10px;
    right: 10px;
    padding: 16px;
    display: block;
  }
  .review-panel h2 {
    font-size: 21px;
  }
  .review-panel p {
    font-size: 18px;
    margin-bottom: 6px;
  }
  .review-panel small {
    font-size: 13px;
  }
  .overlay {
    padding: 15px;
  }
  .dialog {
    padding: 21px;
  }
  .dialog h1 {
    font-size: 29px;
  }
  .dialog p {
    font-size: 16px;
  }
  .rules {
    gap: 10px;
    margin: 12px 0;
  }
  .rules span {
    font-size: 12px;
  }
  .dialog>small {
    font-size: 12px;
  }
  .arena-label {
    left: 12px;
    font-size: 7px;
  }
  .result-dialog {
    padding: 24px;
  }
  .review-panel .primary {
    margin-top: 13px;
    width: 100%;
  }
  #start-dialog {
    padding: 18px;
  }
  #start-dialog h1 {
    font-size: 28px;
  }
  .menu-face {
    font-size: 45px;
  }
  .grade-options {
    gap: 5px;
  }
  .grade-button {
    padding: 10px 2px;
    font-size: 15px;
  }
  #grade-description {
    font-size: 16px;
  }
  #start-dialog .difficulty-note {
    font-size: 12px;
  }
  .bot-options .grade-button {
    min-height: 44px;
  }
  .waiting-banner strong {
    font-size: 18px;
  }
  .waiting-banner span {
    font-size: 14px;
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    transition:none!important;
  }
}
