@font-face {
  font-family: "Obcoro Pixel";
  src: url("../../assets/fusion-pixel-12px-monospaced-zh_tw.ttf.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #030909;
  --panel: #040b09f7;
  --ink: #70f995;
  --bright: #9affb1;
  --muted: #599d72;
  --line: #2a6940;
  --accent: #fa785c;
  color-scheme: dark;
  font: 16px/1.5 "Obcoro Pixel", monospace;
  font-synthesis: none;
  color: var(--ink);
  background: var(--bg);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  height: 100dvh;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  touch-action: manipulation;
  padding: max(.5rem, env(safe-area-inset-top)) env(safe-area-inset-right)
           max(.5rem, env(safe-area-inset-bottom)) env(safe-area-inset-left);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
main {
  grid-area: 1 / 1;
  display: grid;
  grid-template: auto minmax(0, 1fr) auto / minmax(0, 1fr);
  width: min(100%, 47rem);
  height: 100%;
  min-width: 0;
  min-height: 0;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 3rem;
  margin-inline: .75rem;
  padding-bottom: .375rem;
}
h1 { margin: 0; color: var(--bright); font-size: 1.5rem; font-weight: 400; line-height: 1.2; white-space: nowrap; }
.readout { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
#level { white-space: nowrap; }
#status { min-height: 1rem; margin: 0; color: var(--muted); font-size: .75rem; line-height: 1rem; text-align: right; }
#status[data-warning="true"] { color: var(--accent); }
footer { margin: .375rem .75rem 0; color: var(--muted); font-size: .75rem; text-align: center; }
body > .gp-quip {
  position: static;
  grid-area: 1 / 1;
  place-self: end center;
  max-width: 100%;
  padding: 0 .5rem;
  font-size: .75rem;
  line-height: 1.5;
  text-align: center;
}
body:has(> .gp-quip) footer > span { visibility: hidden; }

.stage {
  display: grid;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}
.hud {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  min-height: 2.75rem;
  padding-inline: .75rem;
  background: #0a1911;
  font-size: .75rem;
  line-height: 1.5rem;
}
.metric { display: flex; align-items: baseline; gap: .35em; color: var(--muted); white-space: nowrap; }
.metric b { color: var(--bright); font-weight: 400; font-size: 1.125rem; }
.depth { justify-self: center; }
.chain { justify-self: end; }
.chain b {
  padding-inline: .22em;
  color: var(--muted);
  line-height: 1.2;
}
.chain[data-heat="1"] b { color: var(--ink); }
.chain[data-heat="2"], .chain[data-heat="3"] { color: var(--ink); }
.chain[data-heat="2"] b { color: var(--bright); }
.chain[data-heat="3"] b { background: var(--bright); color: var(--bg); }
.progress { position: absolute; inset: auto 0 0; height: 2px; border-bottom: 1px solid var(--line); }
.progress i {
  display: block;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 115ms cubic-bezier(.2,.8,.3,1);
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
  background: var(--bg);
  touch-action: none;
  image-rendering: pixelated;
  cursor: grab;
}
#board:active { cursor: grabbing; }
#board[aria-disabled="true"] { cursor: default; }
#board:focus-visible { outline: 2px solid var(--bright); outline-offset: -3px; }
@media (min-width: 35rem) {
  body {
    grid-template-rows: minmax(0, min(100%, 46rem));
    align-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
             max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }
  header { min-height: 3.375rem; margin-inline: 0; padding-bottom: .5rem; }
  h1 { font-size: 2.25rem; }
  .readout { flex-direction: row; align-items: baseline; gap: .875rem; }
  #status { font-size: .875rem; }
  .hud { padding-inline: 1.375rem; font-size: .875rem; }
  .metric { gap: .5em; }
  footer { margin: .75rem 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .progress i { transition: none; }
}
