:root {
  font-family:
    Arial Narrow,
    Franklin Gothic Condensed,
    Impact,
    sans-serif;
  color: #fff9e8;
  background: #132237;
  font-synthesis: none;
  --gold: #f0aa2e;
  --orange: #f07a25;
  --ink: #101820;
  --cream: #fff1cc;
  --safe-left: max(10px, env(safe-area-inset-left, 0px));
  --safe-right: max(10px, env(safe-area-inset-right, 0px));
  --safe-top: max(12px, env(safe-area-inset-top, 0px));
  --safe-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  --vvh: 100dvh;
  --vvt: 0px;
  --kb: 0px;
}
* {
  box-sizing: border-box;
}
html,
body,
#game-root {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  overflow: hidden;
}
html {
  background: #132237;
}
body {
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
input,
textarea {
  user-select: text;
  -webkit-user-select: text;
}
button,
input,
select {
  font: inherit;
}
button {
  color: inherit;
  touch-action: manipulation;
}
#game-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  isolation: isolate;
  overflow: hidden;
}
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 50% 45%,
    transparent 45%,
    rgba(8, 12, 20, 0.34) 130%
  );
}
.hidden,
html.touch-ui .key-hint {
  display: none !important;
}
html.touch-ui #action-prompt .action-hint,
html.touch-ui #action-prompt .action-dot {
  display: none;
}
#top-hud {
  position: absolute;
  z-index: 5;
  top: var(--safe-top);
  left: calc(var(--safe-left) + clamp(196px, 21vw, 268px));
  right: var(--safe-right);
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(5px, 1vw, 14px);
  pointer-events: none;
}
.hud-panel > * {
  border: 2px solid #e4a733;
  background: linear-gradient(180deg, #131b25f2, #080e15eb);
  box-shadow:
    0 5px #28180a8c,
    inset 0 0 0 2px #ffffff0f;
}
.brand-block {
  min-width: clamp(118px, 18vw, 260px);
  padding: 3px 15px 4px;
  transform: skew(-4deg);
  display: grid;
  align-content: center;
  line-height: 0.82;
}
.brand-block span {
  color: #f1c860;
  font-size: clamp(7px, 0.75vw, 11px);
  letter-spacing: 0.5em;
}
.brand-block strong {
  color: #f6d58a;
  font:
    900 clamp(16px, 2.2vw, 31px) / 0.9 Georgia,
    "Times New Roman",
    serif;
  letter-spacing: -0.055em;
  text-shadow: 0 3px #5b3218;
  white-space: nowrap;
}
.brand-block small {
  color: #e9a92f;
  font-size: clamp(7px, 0.7vw, 10px);
  font-weight: 900;
  letter-spacing: 0.42em;
}
.stat {
  min-width: clamp(82px, 11vw, 150px);
  padding: 4px 13px;
  text-align: center;
  display: grid;
  align-content: center;
  line-height: 1;
  transform: skew(-2deg);
}
.stat span {
  color: #d8e0e8;
  font-size: clamp(8px, 0.9vw, 13px);
  letter-spacing: 0.13em;
}
.stat strong {
  color: #ffe26b;
  font:
    900 clamp(18px, 2.25vw, 32px) / 1 "Archivo Black",
    sans-serif;
  text-shadow: 0 3px #73421b;
}
.level-stat {
  min-width: clamp(58px, 7vw, 100px);
}
.timer-stat {
  min-width: clamp(70px, 9vw, 120px);
}
.timer-stat.urgent strong {
  color: #ff685d;
  animation: pulse 0.35s ease-in-out infinite alternate;
}
#side-actions {
  position: absolute;
  z-index: 8;
  left: var(--safe-left);
  top: clamp(12px, 1.6vh, 18px);
  display: grid;
  justify-items: start;
  gap: clamp(6px, 1.2vh, 12px);
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 12px);
}
.side-button {
  width: clamp(168px, 16vw, 196px);
  min-height: 52px;
  padding: 10px 12px;
  border: 3px solid #f4c24e;
  border-radius: 6px;
  background: linear-gradient(160deg, #273443, #121b25);
  box-shadow:
    0 5px #5b3917,
    0 8px 18px #00000040;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow: visible;
  cursor: pointer;
  transform: skew(-2deg);
  transition:
    transform 0.12s,
    filter 0.12s;
}
.side-button:hover,
.side-button:focus-visible {
  filter: brightness(1.2);
  transform: skew(-2deg) translate(3px);
  outline: none;
}
.side-button:active {
  transform: skew(-2deg) translateY(3px);
  box-shadow: 0 2px #5b3917;
}
.leave-button .key-hint {
  margin-top: 2px;
  border: 2px solid #f2ac31;
  background: #252f3b;
  color: #fff2cb;
  border-radius: 3px;
  padding: 0.08em 0.35em;
  font:
    800 10px/1 Archivo Black,
    sans-serif;
}
.side-label {
  display: block;
  width: auto;
  max-width: none;
  font:
    800 13px/1 Arial Narrow,
    Franklin Gothic Condensed,
    sans-serif;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: visible;
}
.side-icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f5ae2d;
  color: #1c232d;
  display: grid;
  place-items: center;
  font: 800 14px/1 Arial;
  box-shadow: inset 0 -3px #6d370f40;
}
.week-top {
  width: clamp(176px, 18.5vw, 248px);
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 92px);
  padding: 8px 10px 9px;
  border: 3px solid #f4c24e;
  border-radius: 6px;
  background: linear-gradient(180deg, #131b25f5, #080e15f0);
  box-shadow:
    0 5px #5b3917,
    0 8px 18px #00000040,
    inset 0 0 0 2px #ffffff0f;
  display: grid;
  align-content: start;
  gap: 2px;
  overflow: auto;
  cursor: pointer;
  text-align: left;
  transform: skew(-1deg);
}
.week-top:hover,
.week-top:focus-visible {
  filter: brightness(1.12);
  outline: none;
}
.week-top-kicker {
  color: #d8e0e8;
  font-size: clamp(9px, 0.95vw, 12px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.week-top-title {
  color: #ffe26b;
  font:
    900 clamp(18px, 2.1vw, 28px) / 1 "Archivo Black",
    sans-serif;
  letter-spacing: -0.04em;
  text-shadow: 0 3px #73421b;
}
.week-top-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1px;
}
.week-top-list li {
  display: grid;
  grid-template-columns: 1.55rem minmax(0, 1fr) auto;
  gap: 6px;
  align-items: baseline;
  padding: 2px 0;
  font-size: clamp(11px, 1.15vw, 15px);
  font-weight: 800;
  line-height: 1.15;
}
.week-top-list b {
  color: #f3c45a;
  font:
    900 1em/1 Archivo Black,
    sans-serif;
}
.week-top-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.week-top-list strong {
  color: #ffe26b;
  font:
    900 1em/1 Archivo Black,
    sans-serif;
}
.week-top-list li.muted,
.week-top-list li.muted strong {
  color: #7f8c97;
}
.week-top-empty {
  grid-template-columns: 1fr !important;
  color: #c8d1d8;
  padding: 8px 0 !important;
}
.week-top-icon {
  display: none;
}
.week-top-more {
  display: none;
  margin-top: 4px;
  color: #f3c45a;
  font:
    800 12px/1 Archivo Black,
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#action-prompt {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 8%);
  transform: translate(-50%) skew(-4deg);
  border: 3px solid #f5bd45;
  border-radius: 4px;
  padding: clamp(9px, 1.5vh, 14px) clamp(18px, 3vw, 40px);
  background: #0d151eeb;
  box-shadow: 0 6px #533110cc;
  font:
    900 clamp(14px, 2vw, 26px) / 1 "Archivo Black",
    sans-serif;
  letter-spacing: -0.035em;
  white-space: nowrap;
  cursor: pointer;
}
#action-prompt .action-dot {
  color: #f4a52b;
  padding: 0 0.3em;
}
kbd,
.key-hint {
  border: 2px solid #f2ac31;
  background: #252f3b;
  color: #fff2cb;
  border-radius: 3px;
  padding: 0.1em 0.35em;
  box-shadow: 0 2px #6e451c;
  font: inherit;
}
#tutorial {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 18%;
  transform: translate(-50%) skew(-3deg);
  padding: 6px 13px;
  background: #0d131bcc;
  border: 2px solid rgba(241, 177, 55, 0.8);
  font:
    900 clamp(18px, 3vw, 42px) / 1 "Archivo Black",
    sans-serif;
  color: #ffe17c;
  letter-spacing: 0.08em;
  white-space: nowrap;
  pointer-events: none;
  animation: tutorial-in 4.2s both;
}
#damage-flash {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 42%;
  opacity: 0;
  pointer-events: none;
  color: #fff;
  font:
    900 clamp(30px, 5vw, 66px) / 1 "Archivo Black",
    sans-serif;
  text-shadow: 0 4px #b33025;
}
#damage-flash.pop {
  animation: damage-pop 0.34s both;
}
#performance-badge {
  position: absolute;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  z-index: 5;
  padding: 3px 7px;
  background: #0f171fc7;
  color: #b8c4cd;
  font-size: 10px;
  letter-spacing: 0.12em;
}
.modal-overlay {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  top: var(--vvt);
  width: 100%;
  height: var(--vvh);
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + 12px)
    calc(var(--safe-bottom) + 10px) calc(var(--safe-left) + 12px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #080f18b8;
  backdrop-filter: blur(5px);
  touch-action: pan-y;
}
.modal-shell {
  position: relative;
  width: min(760px, calc(100vw - var(--safe-left) - var(--safe-right) - 24px));
  max-height: calc(var(--vvh) - var(--safe-top) - var(--safe-bottom) - 20px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: clamp(16px, 3vw, 32px);
  background: linear-gradient(155deg, #263442, #101822 60%);
  border: 4px solid #dda031;
  box-shadow:
    0 12px #5a3518,
    0 20px 60px #00000080,
    inset 0 0 0 2px #ffffff0f;
}
.modal-close {
  position: sticky;
  float: right;
  z-index: 2;
  top: 0;
  margin: -6px -4px 0 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 2px solid #d99c31;
  background: #121b24;
  color: #ffd678;
  font: 900 28px/1 Arial;
  cursor: pointer;
}
.modal-heading {
  text-align: center;
  margin-bottom: 17px;
}
.modal-heading > span,
.results-heading > span {
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0.2em;
  font-size: 12px;
}
.modal-heading h2,
.results-heading h2 {
  margin: 2px 0 3px;
  font:
    900 clamp(28px, 5vw, 54px) / 0.95 "Archivo Black",
    sans-serif;
  letter-spacing: -0.06em;
  text-shadow: 0 4px #603516;
}
.modal-heading p {
  margin: 0;
  color: #c8d1d8;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.setting-row {
  min-height: 60px;
  padding: 9px 13px;
  border: 1px solid #607080;
  background: #080e1575;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-weight: 900;
}
.setting-row span {
  display: grid;
}
.setting-row small {
  color: #8fa1ae;
  font-weight: 600;
}
.setting-row input[type="range"] {
  width: 44%;
  accent-color: var(--orange);
}
.setting-row select {
  background: #18232e;
  color: #fff;
  border: 2px solid var(--gold);
  padding: 7px;
}
.toggle input {
  display: none;
}
.toggle i {
  width: 46px;
  height: 24px;
  flex: 0 0 46px;
  border-radius: 30px;
  background: #4b5864;
  position: relative;
}
.toggle i:after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: 0.18s;
}
.toggle input:checked + i {
  background: #e57d2b;
}
.toggle input:checked + i:after {
  transform: translate(22px);
}
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.modal-credit {
  margin: 14px 0 0;
  font-size: 0.8rem;
  text-align: center;
}
.modal-credit a {
  color: #ffd678;
}
.button {
  border: 2px solid #d99f35;
  padding: 10px 18px;
  min-height: 44px;
  background: #263441;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px #593617;
}
.button.primary {
  background: linear-gradient(#f3a832, #d76521);
  color: #1a2027;
  border-color: #ffe192;
}
.button.danger {
  border-color: #b5534c;
  color: #faa;
}
.button.wide {
  width: 100%;
  margin-top: 16px;
  font-size: 18px;
}
.results-heading {
  text-align: center;
}
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.results-grid div {
  padding: 12px 6px;
  border: 1px solid #586979;
  background: #070c1261;
  text-align: center;
  display: grid;
}
.results-grid span {
  color: #a9b8c3;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.results-grid strong {
  color: #ffdb70;
  font:
    900 clamp(18px, 3vw, 30px) / 1 "Archivo Black",
    sans-serif;
}
.stats-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 8px;
}
.stats-grid div:last-child {
  grid-column: 1 / -1;
}
.week-winner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 2px solid #efa92f;
  background: linear-gradient(90deg, #3a2818, #5a3a1c);
  color: #ffe08a;
  font-weight: 800;
}
.week-winner span {
  display: block;
  color: #c8d1d8;
  letter-spacing: 0.12em;
  font-size: 11px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.week-winner strong {
  color: #ffe26b;
  font:
    900 1.15em/1 Archivo Black,
    sans-serif;
}
.week-winner.empty {
  color: #c8d1d8;
  border-color: #586979;
  background: #070c1261;
}
.week-switcher {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
}
.week-chip {
  flex: 1 1 0;
  max-width: 220px;
  min-height: 40px;
  padding: 8px 14px;
  border: 2px solid #d99f35;
  background: #121b24;
  color: #ffe08a;
  font:
    800 13px/1 Arial Narrow,
    Franklin Gothic Condensed,
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.week-chip.active {
  background: linear-gradient(#f3a832, #d76521);
  color: #1a2027;
  border-color: #ffe192;
}
.lives-stat strong {
  letter-spacing: 0.08em;
  color: #ff6d62;
}
.board-title {
  margin: 18px 0 8px;
  color: #f3c45a;
  letter-spacing: 0.12em;
  font-size: 13px;
}
.board-empty {
  color: #b8c4cd;
  text-align: center;
  font-size: 20px;
}
.board-note {
  margin: 16px 0 0;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.board-note.good {
  color: #9ee08a;
}
.board-note.bad {
  color: #ffb087;
}
.board-prize {
  margin: 0 0 18px;
  padding: clamp(14px, 2.4vw, 22px) clamp(12px, 2vw, 20px);
  text-align: center;
  color: #ffe08a;
  background: linear-gradient(90deg, #6d351f, #8e4a25);
  border: 3px solid #efa92f;
  box-shadow: 0 6px #5a2e12;
  font:
    900 clamp(20px, 3.6vw, 38px) / 1.18 "Archivo Black",
    sans-serif;
  letter-spacing: -0.03em;
  text-shadow: 0 3px #4a2410;
}
.board-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.board-list li {
  display: grid;
  grid-template-columns: 2rem 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #586979;
  background: #070c1261;
}
.board-list b {
  color: #f3c45a;
}
.board-list small {
  color: #9eb0bc;
}
.modal-shell.board-shell {
  width: min(1040px, calc(100vw - var(--safe-left) - var(--safe-right) - 16px));
  max-height: calc(var(--vvh) - var(--safe-top) - var(--safe-bottom) - 12px);
  padding: clamp(18px, 2.6vw, 34px) clamp(18px, 3vw, 42px);
}
.modal-shell.board-shell .modal-heading {
  margin-bottom: 14px;
}
.modal-shell.board-shell .modal-heading h2 {
  font-size: clamp(32px, 5.4vw, 62px);
}
.modal-shell.board-shell .board-list {
  gap: 8px;
}
.modal-shell.board-shell .board-list li {
  grid-template-columns: 3.4rem minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 11px 14px;
  border-width: 2px;
}
.modal-shell.board-shell .board-list b {
  font:
    900 clamp(22px, 3vw, 36px) / 1 "Archivo Black",
    sans-serif;
}
.modal-shell.board-shell .board-list span {
  font-size: clamp(18px, 2.4vw, 28px);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-shell.board-shell .board-list strong {
  color: #ffdb70;
  font:
    900 clamp(22px, 3.2vw, 38px) / 1 "Archivo Black",
    sans-serif;
}
.modal-shell.board-shell .board-list small {
  font-size: clamp(13px, 1.6vw, 18px);
  font-weight: 800;
}
.score-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  width: 100%;
}
.score-form label {
  display: grid;
  gap: 6px;
  color: #dce4ea;
  font-weight: 800;
  width: 100%;
}
.score-form .name-error {
  margin: 0;
  text-align: left;
}
.score-form input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 2px solid #d99f35;
  background: #121b24;
  color: #fff9e8;
  font-weight: 800;
}
/* Account dialogs and the button that opens them. */
#account-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  /* A long player name is cut off here. The taller line keeps the dots of Ä, Ö and Ü inside the clipped box. */
  line-height: 1.5;
}
.account-form {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.account-form label {
  display: grid;
  gap: 6px;
  color: #dce4ea;
  font-weight: 800;
}
.account-form input[type="text"],
.account-form input[type="email"],
.account-form input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 2px solid #d99f35;
  background: #121b24;
  color: #fff9e8;
  /* Below 16px iOS zooms into a focused field. */
  font-size: 16px;
  font-weight: 800;
}
.account-form .check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}
.account-form .check-row input {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--orange);
}
.account-form a {
  color: #ffd678;
}
.form-message {
  margin: 0;
  color: #ffb087;
  font-weight: 800;
}
.link-button {
  display: block;
  min-height: 44px;
  margin: 6px auto 0;
  padding: 10px;
  border: 0;
  background: none;
  color: #ffd678;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}
#loading-screen {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: radial-gradient(circle at 50% 40%, #315c6c, #132137 70%);
  transition:
    opacity 0.55s,
    visibility 0.55s;
}
.loaded #loading-screen {
  opacity: 0;
  visibility: hidden;
}
.loading-logo {
  display: grid;
  transform: skew(-4deg);
}
.loading-logo span {
  color: #f5ad30;
  letter-spacing: 0.55em;
  font-weight: 900;
}
.loading-logo strong {
  color: #f7d690;
  font:
    900 clamp(38px, 8vw, 92px) / 0.84 Georgia,
    "Times New Roman",
    serif;
  letter-spacing: -0.07em;
  text-shadow: 0 6px #673918;
}
.loading-logo b {
  color: #efaf36;
  letter-spacing: 0.65em;
  font-size: clamp(12px, 2vw, 22px);
}
.loading-bar {
  width: min(360px, 70vw);
  height: 13px;
  margin: 25px auto 8px;
  padding: 2px;
  border: 2px solid #edb03b;
}
.loading-bar i {
  display: block;
  height: 100%;
  background: #f27d27;
  animation: load 1.3s ease both;
}
.loading-screen p {
  color: #b8c6d0;
  letter-spacing: 0.14em;
  font-weight: 900;
}
#toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: 17%;
  transform: translate(-50%, -20px);
  opacity: 0;
  visibility: hidden;
  padding: 9px 18px;
  background: #236e44;
  border: 2px solid #a8e56d;
  box-shadow: 0 5px #122f1c99;
  font-weight: 900;
  letter-spacing: 0.05em;
  transition: 0.2s;
  pointer-events: none;
}
#toast.bad {
  background: #8b322d;
  border-color: #ff8f7f;
}
#toast.show {
  transform: translate(-50%);
  opacity: 1;
  visibility: visible;
}
@keyframes load {
  0% {
    width: 4%;
  }
  to {
    width: 100%;
  }
}
@keyframes pulse {
  to {
    filter: brightness(1.7);
  }
}
@keyframes damage-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 10%) scale(0.4) rotate(-9deg);
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -35%) scale(1.2) rotate(3deg);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -90%) scale(0.8);
  }
}
@keyframes tutorial-in {
  0%,
  to {
    opacity: 0;
    transform: translate(-50%) translateY(15px);
  }
  12%,
  82% {
    opacity: 1;
    transform: translate(-50%) translateY(0);
  }
}
@media (max-width: 980px), (pointer: coarse) {
  :root {
    --safe-top: max(14px, env(safe-area-inset-top, 0px));
    --safe-bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }
  #top-hud {
    left: var(--safe-left);
    right: var(--safe-right);
    top: var(--safe-top);
    gap: 6px;
    align-items: stretch;
  }
  .brand-block {
    min-width: 0;
    padding: 6px 10px 5px;
  }
  .brand-block span {
    font-size: 8px;
    letter-spacing: 0.28em;
  }
  .brand-block strong {
    font-size: clamp(15px, 4.2vw, 22px);
  }
  .brand-block small {
    font-size: 8px;
    letter-spacing: 0.28em;
  }
  .stat {
    min-width: 0;
    flex: 1 1 0;
    padding: 6px 8px;
  }
  .stat span {
    font-size: 11px;
    letter-spacing: 0.1em;
  }
  .stat strong {
    font-size: clamp(22px, 5.6vw, 30px);
  }
  .level-stat,
  .timer-stat {
    min-width: 0;
  }
  #side-actions {
    top: calc(var(--safe-top) + 62px);
    left: var(--safe-left);
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    max-height: none;
    max-width: calc(100% - var(--safe-left) - var(--safe-right));
  }
  .side-button {
    width: auto;
    min-width: 48px;
    min-height: 48px;
    padding: 8px 10px;
    flex-direction: row;
    gap: 6px;
  }
  .side-icon {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
    font-size: 13px;
  }
  .side-label {
    font-size: 12px;
    letter-spacing: 0.04em;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }
  .leave-button .key-hint {
    display: none;
  }
  .week-top {
    width: auto;
    min-width: 96px;
    max-width: none;
    max-height: none;
    padding: 8px 10px;
    align-content: center;
  }
  .week-top-kicker {
    font-size: 10px;
  }
  .week-top-title {
    font-size: 15px;
  }
  .week-top-list {
    display: none;
  }
  .week-top-more {
    display: block;
    margin-top: 2px;
    font-size: 11px;
  }
  kbd.key-hint,
  .key-hint {
    display: none;
  }
  #action-prompt {
    left: var(--safe-left);
    right: var(--safe-right);
    width: auto;
    max-width: none;
    transform: none;
    bottom: calc(var(--safe-bottom) + 10px);
    min-height: 52px;
    padding: 12px 16px;
    white-space: normal;
    text-align: center;
    font-size: 18px;
  }
  #action-prompt .action-hint,
  #action-prompt .action-dot {
    display: none;
  }
  #tutorial {
    top: auto;
    bottom: calc(var(--safe-bottom) + 78px);
    max-width: calc(100% - 24px);
    white-space: normal;
    text-align: center;
    font-size: 20px;
  }
  .modal-overlay {
    padding: calc(var(--safe-top) + 8px) calc(var(--safe-left) + 8px)
      calc(var(--safe-bottom) + 8px) calc(var(--safe-right) + 8px);
    align-items: center;
    justify-items: stretch;
  }
  .modal-shell,
  .modal-shell.board-shell {
    width: 100%;
    max-width: 100%;
    max-height: calc(var(--vvh) - var(--safe-top) - var(--safe-bottom) - 16px);
    padding: 16px 14px 14px;
  }
  .modal-heading {
    margin-bottom: 12px;
  }
  .modal-heading h2,
  .results-heading h2 {
    font-size: clamp(28px, 9vw, 42px);
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .setting-row {
    min-height: 52px;
    padding: 10px 12px;
  }
  .modal-actions {
    flex-direction: column;
  }
  .modal-actions .button {
    width: 100%;
    min-height: 48px;
  }
  .button.wide {
    min-height: 52px;
    font-size: 17px;
    margin-top: 12px;
  }
  .results-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .results-grid div {
    padding: 10px 4px;
  }
  .results-grid strong {
    font-size: clamp(20px, 6vw, 28px);
  }
  .modal-shell.board-shell .board-list li {
    grid-template-columns: 2.4rem minmax(0, 1fr) auto auto;
    padding: 10px 8px;
  }
  .modal-shell.board-shell .board-list span {
    font-size: 16px;
  }
  .modal-shell.board-shell .board-list strong {
    font-size: 20px;
  }
}
@media (max-width: 980px) and (orientation: portrait),
  (pointer: coarse) and (orientation: portrait) {
  #top-hud {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }
  .brand-block {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 7px 10px 6px;
    text-align: center;
    justify-items: center;
  }
  .brand-block strong {
    font-size: 22px;
  }
  .stat {
    min-width: 0;
    padding: 8px 4px;
  }
  .stat span {
    font-size: 11px;
  }
  .stat strong {
    font-size: 22px;
  }
  #side-actions {
    top: auto;
    bottom: calc(var(--safe-bottom) + 74px);
    left: var(--safe-left);
    right: auto;
  }
  .side-button {
    min-height: 48px;
  }
  .week-top {
    min-width: 108px;
  }
  #action-prompt {
    bottom: calc(var(--safe-bottom) + 10px);
  }
  #tutorial {
    bottom: calc(var(--safe-bottom) + 136px);
  }
}
@media (max-width: 980px) and (orientation: landscape),
  (pointer: coarse) and (max-height: 500px) {
  #side-actions {
    top: auto;
    bottom: var(--safe-bottom);
    left: var(--safe-left);
    right: var(--safe-right);
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: stretch;
    gap: 8px;
    width: auto;
    max-width: none;
  }
  .side-button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    justify-content: center;
    gap: 8px;
  }
  .side-icon {
    width: 20px;
    height: 20px;
    flex-basis: 20px;
    font-size: 12px;
  }
  .side-label {
    font:
      800 13px/1 Arial Narrow,
      Franklin Gothic Condensed,
      sans-serif;
    letter-spacing: 0.08em;
    overflow: visible;
    white-space: nowrap;
  }
  .week-top {
    display: flex;
    flex: 1 1 0;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 0;
    max-width: none;
    min-height: 44px;
    padding: 8px 10px;
    overflow: visible;
  }
  .week-top-icon {
    display: grid;
  }
  .week-top-kicker,
  .week-top-more,
  .week-top-list {
    display: none;
  }
  .week-top-title {
    font:
      800 13px/1 Arial Narrow,
      Franklin Gothic Condensed,
      sans-serif;
    letter-spacing: 0.08em;
    text-shadow: none;
  }
  html.playing #side-actions {
    right: auto;
    width: auto;
    max-width: 200px;
  }
  html.playing .leave-button {
    width: auto;
    min-width: 132px;
    flex: 0 0 auto;
  }
  #tutorial {
    bottom: calc(var(--safe-bottom) + 108px);
    font-size: 16px;
  }
  #action-prompt {
    left: 50%;
    right: auto;
    width: auto;
    max-width: min(360px, calc(100vw - 24px));
    margin-inline: 0;
    transform: translate(-50%);
    bottom: calc(var(--safe-bottom) + 58px);
    min-height: 44px;
    font:
      800 16px/1 Arial Narrow,
      Franklin Gothic Condensed,
      sans-serif;
    letter-spacing: 0.08em;
    padding: 10px 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
