/* Shared page rhythm and viewport-aware play areas. */
html {
  min-height: 100%;
}
body {
  min-width: 280px;
}
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.app-shell > main:not([hidden]) {
  flex: 1 0 auto;
  min-width: 0;
}
.site-header {
  height: 88px;
  flex-shrink: 0;
  gap: 20px;
}
.site-footer {
  margin: 24px 0 16px;
  padding: 14px 18px;
  flex-shrink: 0;
}
.header-actions {
  flex-shrink: 0;
}
.brand {
  min-width: 0;
}
.hero {
  min-height: 470px;
}
.hero-art {
  max-width: 100%;
}
.play-mode-actions {
  align-items: center;
  gap: 12px;
}
.explorer-door,
.progress-hub,
.adventure {
  margin-bottom: 28px;
}
.section-heading {
  align-items: center;
  gap: 18px;
}
html:has(dialog[open]) {
  overflow: hidden;
}
dialog {
  overscroll-behavior: contain;
  max-height: calc(100dvh - 24px);
}
#playerDialog {
  padding: 24px;
}
#playerClose {
  position: sticky;
  top: 0;
  right: 0;
  float: right;
  margin: -8px -8px 0 8px;
  z-index: 5;
  background: #fffaf3;
}
.player-portable {
  padding-top: 8px;
}
.player-tools {
  gap: 10px;
  align-items: stretch;
}
.player-tools > * {
  min-height: 44px;
}
.restore-consent {
  align-items: flex-start;
}
.restore-consent input {
  flex: 0 0 auto;
  margin-top: 3px;
}

/* In a live game the game toolbar owns navigation and sound settings. */
body:has(#gameScreen:not([hidden])) .site-header,
body:has(#gameScreen:not([hidden])) .site-footer,
body:has(#duelScreen[data-view="match"]:not([hidden])) .site-header,
body:has(#duelScreen[data-view="match"]:not([hidden])) .site-footer,
body:has(#explorerScreen[data-tab="lab"]:not([hidden])) .site-header,
body:has(#explorerScreen[data-tab="lab"]:not([hidden])) .site-footer,
body:has(#duelScreen[data-view="waiting"]:not([hidden])) .site-footer,
body:has(#duelScreen[data-view="result"]:not([hidden])) .site-footer {
  display: none !important;
}

/* Consistent highlights for every campaign level name. */
.level-details > strong,
.modal-level-name,
.game-heading > #levelName {
  color: #49374d;
  background: #fbe4ed;
  box-shadow: inset 0 -2px 0 #e9588e66;
  border-radius: 6px;
  padding: 3px 7px;
  width: fit-content;
  max-width: 100%;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.level-details > strong {
  font-size: 16px;
}
.modal-level-name {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}
.game-heading > #levelName {
  justify-self: center;
  padding: 4px 10px;
}

/* Campaign: symmetric side panels, a centered title and a square board. */
.app-shell:has(> #gameScreen:not([hidden])) {
  max-width: 1450px;
  padding: 0 24px 12px;
}
#gameScreen:not([hidden]) {
  flex: 0 0 auto;
}
.game-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  height: 56px;
  gap: 12px;
}
.game-heading > span {
  text-align: center;
  font-size: 21px;
  color: #715271;
}
.game-heading > .text-button {
  justify-self: start;
  margin: 0;
}
.game-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-self: end;
}
.game-controls .icon-button {
  width: 36px;
  height: 36px;
}
.game-layout {
  --campaign-board: min(640px, calc(100dvh - 170px));
  grid-template-columns: 210px minmax(0, var(--campaign-board)) 210px;
  gap: 22px;
  padding: 8px 0 0;
  align-items: start;
  margin: 0 auto;
}
.score-panel {
  grid-column: 1;
  grid-row: 1;
  padding: 18px;
  border-radius: 18px;
}
.level-summary .level-label {
  margin-bottom: 8px;
}
.level-summary h2 {
  font-size: 22px;
  line-height: 1.2;
}
.level-summary .goal-copy {
  margin-top: 10px;
  line-height: 1.6;
}
.score-box {
  margin-top: 16px;
  padding-top: 14px;
}
.score-box > strong {
  font-size: 38px;
}
.score-stars {
  margin: 5px 0 10px;
  gap: 6px;
}
.score-stars svg,
.score-stars svg:nth-child(2) {
  width: 23px;
  height: 23px;
  margin: 0;
}
.record-status {
  min-height: 18px;
  margin-top: 10px;
}
.moves-box {
  margin-top: 14px;
  padding: 12px 8px;
  gap: 10px;
}
.moves-box > strong {
  font-size: 36px;
}
.tools {
  margin-top: 14px;
  gap: 8px;
}
.tool-button {
  min-height: 38px;
  padding: 8px;
}
.board-section {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-width: 0;
}
.board-topline {
  margin-bottom: 7px;
  padding: 0 4px;
  gap: 8px;
  line-height: 1.3;
}
.board-frame {
  width: 100%;
  padding: 8px;
  border-width: 5px;
  border-radius: 20px;
}
.board-instruction {
  font-size: 12px;
  line-height: 1.4;
  margin: 10px 0 4px;
  text-align: center;
}
.board-utilities {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
  min-height: 34px;
}
.board-guide-link {
  margin: 0;
  min-height: 32px;
  font-size: 12px;
}
.campaign-discovery {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
  border: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
}
.campaign-discovery > .text-button {
  margin: 0;
  min-height: 32px;
  font-size: 12px;
}
.discovery-clue > summary {
  line-height: 1.4;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid #dec9a5;
  border-radius: 9px;
  background: #fff7e7;
  color: #825c30;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.discovery-clue > summary::-webkit-details-marker {
  display: none;
}
.discovery-clue > summary > svg {
  width: 15px;
  height: 15px;
}
.discovery-body {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: min(340px, calc(100vw - 40px));
  max-height: min(350px, 65dvh);
  overflow: auto;
  background: #fffaf3;
  border: 1px solid #dcc3a3;
  border-radius: 14px;
  box-shadow: 0 12px 36px #49374d30;
  padding: 18px;
  z-index: 22;
}
.discovery-body strong {
  font-family: var(--display);
  font-size: 19px;
}
.discovery-body p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.65;
}
.mission-panel {
  grid-column: 3;
  grid-row: 1;
  padding: 0;
}
.mission-panel summary {
  padding: 12px;
}
.mission-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.mission-body {
  max-height: calc(100dvh - 130px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 12px 14px;
}
.mission-body > .text-button {
  display: flex;
  margin: 14px 0 0;
}
.mission-note {
  margin-bottom: 14px;
  font-size: 12px;
  line-height: 1.6;
}

/* Arena pages keep a consistent width and avoid stretched empty cards. */
#duelScreen:not([data-view="match"]) {
  width: 100%;
  margin: 0;
  padding-bottom: 8px;
}
.arena-header {
  min-height: 72px;
  padding: 16px 0;
  gap: 16px;
}
.arena-lobby {
  padding-top: 24px;
  gap: 24px 36px;
  align-items: start;
}
.arena-welcome {
  min-width: 0;
}
.arena-welcome h3 {
  margin-top: 18px;
}
.arena-setup {
  gap: 18px;
  margin: 20px 0;
}
.arena-opponent-preview {
  align-self: center;
  padding: 32px 24px;
  min-height: 0;
}
.arena-how {
  margin: 0;
  padding: 20px;
  gap: 24px;
  align-items: start;
}
.arena-how article {
  align-items: start;
}
.arena-how h4 {
  margin-bottom: 7px;
}
.arena-room-panel {
  margin: 0;
  padding: 24px;
}
.arena-room-panel > p {
  max-width: 75ch;
  font-size: 14px;
  line-height: 1.65;
}
.room-controls {
  gap: 12px;
  align-items: end;
}
.room-controls > button,
.room-controls input {
  min-height: 46px;
  height: 46px;
  padding: 10px 16px;
  font-size: 14px;
}
.room-server-input {
  min-width: 0;
}
#duelScreen[data-view="waiting"] {
  display: flex;
  flex-direction: column;
}
#duelScreen[data-view="waiting"] #duelContent {
  flex: 1;
}
.room-share {
  width: min(100%, 600px);
  margin: 24px auto;
  padding: 24px;
  gap: 12px;
}
.room-share > input {
  width: 100%;
}
.room-share > button {
  justify-self: center;
  min-height: 40px;
}
.room-share p {
  margin: 0;
}
.arena-ranking {
  max-width: 1000px;
  margin: 24px auto;
  padding: 24px;
  border: 1px solid #e5d5df;
  border-radius: 20px;
  background: #fffaf3ed;
}
.arena-ranking h3 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
}
.arena-ranking > p {
  max-width: 70ch;
}
.ranking-tabs {
  gap: 8px;
}
.ranking-scroll {
  max-width: 100%;
}
.ranking-scroll th,
.ranking-scroll td {
  padding: 13px 16px;
}
.ranking-empty {
  padding: 28px 12px;
}
.duel-result-card {
  max-width: 820px;
  padding: 24px;
  margin: 18px auto;
}
#duelResult {
  padding: 0;
  display: block;
}
.duel-result-medal {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
}
.duel-result-card h3 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 8px 0;
}
.duel-result-card > p {
  margin: 8px 0;
  line-height: 1.5;
}
.duel-result-score {
  margin: 20px 0;
  gap: 12px;
}
.duel-result-player {
  padding: 16px 12px;
}
.duel-result-player > strong {
  font-size: 38px;
}
.duel-result-player-name {
  margin: 6px 0;
}
.duel-result-streak {
  margin: 18px 0;
}
.duel-result-actions {
  gap: 10px;
  margin-top: 18px;
}
.duel-result-source {
  margin-top: 14px;
}

/* Live duel: the clock and skills share the viewport with both boards. */
.app-shell:has(> #duelScreen[data-view="match"]:not([hidden])) {
  max-width: 1560px;
  padding: 10px 20px;
}
#duelScreen[data-view="match"] {
  width: 100%;
  margin: 0;
  padding: 0;
}
.duel-live {
  padding: 0;
}
.duel-live-header {
  position: relative;
  top: 0;
  grid-template-columns: minmax(100px, 1fr) auto minmax(260px, 1.35fr) 36px auto;
  gap: 12px;
  padding: 10px 12px;
}
.duel-live-header .duel-clock-wrap {
  min-width: 0;
}
.arena-settings {
  width: 36px;
  height: 36px;
}
.duel-score-race {
  margin: 10px 0;
}
.duel-arena {
  gap: 20px;
}
.duel-side {
  padding: 12px;
  border-radius: 18px;
  min-width: 0;
}
.duel-player-heading {
  min-height: 60px;
  margin-bottom: 0;
  align-items: center;
}
.duel-player-heading h3 {
  margin: 2px 0;
  line-height: 1.2;
}
.duel-player-heading small {
  min-height: 0;
  line-height: 1.4;
}
.duel-board-label {
  min-height: 0;
  margin: 5px 0 8px;
  line-height: 1.3;
  align-items: center;
}
.duel-board-frame {
  width: 100%;
  max-width: min(640px, calc(100dvh - 312px));
  padding: 6px;
  margin: 0 auto;
  border-radius: 12px;
}
.duel-energy-label {
  min-height: 0;
  margin-top: 8px;
  line-height: 1.2;
  flex-direction: row;
  align-items: center;
}
.duel-energy-track {
  margin-top: 4px;
}
.duel-ai-note {
  display: none;
}
.duel-live-footer {
  display: none;
  margin-top: 10px;
  padding: 8px 12px;
  min-height: 0;
  font-size: 12px;
  line-height: 1.4;
}

/* Candy Lab: editing controls stay close to the board. */
.app-shell:has(> #explorerScreen[data-tab="lab"]:not([hidden])) {
  max-width: 1450px;
  padding: 0 24px 12px;
}
#explorerScreen[data-tab="lab"] {
  padding: 0;
}
.explorer-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 18px;
  padding: 16px 0;
}
.explorer-header > .explorer-back {
  justify-self: end;
  grid-column: 3;
  grid-row: 1;
}
.explorer-header nav {
  grid-column: 2;
  grid-row: 1;
  width: auto;
}
.explorer-header nav button {
  min-height: 40px;
}
.lab-intro {
  display: none;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fffaf3d9;
}
.lab-intro h3 {
  font-size: 22px;
  margin: 0 0 5px;
}
.lab-intro .eyebrow {
  display: none;
}
.lab-intro p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}
.lab-layout {
  grid-template-columns: 210px minmax(0, min(600px, calc(100dvh - 275px))) 210px;
  gap: 20px;
  justify-content: center;
  align-items: start;
}
.lab-experiment {
  min-width: 0;
}
.lab-workbench,
.lab-notebook {
  padding: 14px;
  border-radius: 16px;
}
.lab-workbench > h4 {
  font-size: 20px;
  margin-bottom: 6px;
}
.lab-workbench > p {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.5;
}
#labPalette {
  margin: 12px 0;
}
#labPalette legend,
.lab-legend {
  margin-bottom: 7px;
}
.lab-legend {
  padding-top: 10px;
}
.lab-specials {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lab-specials .lab-tool {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 3px;
  font-size: 12px;
  line-height: 1.3;
  min-height: 0;
  text-align: center;
}
.lab-room-label {
  margin: 12px 0 7px;
}
.lab-room-note {
  font-size: 12px;
  line-height: 1.5;
}
.lab-board-top {
  padding: 0 2px 8px;
  line-height: 1.4;
}
.lab-board-frame {
  padding: 7px;
  border-radius: 15px;
}
.lab-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 12px 0 0;
  gap: 8px;
}
.lab-actions button,
.lab-actions .primary-button {
  grid-column: auto;
  min-height: 38px;
  padding: 8px 6px;
  font-size: 12px;
  justify-content: center;
}
.lab-actions button svg {
  flex-shrink: 0;
}
.lab-help {
  margin-top: 10px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.5;
}
.lab-notebook {
  position: relative;
}
.lab-notebook > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  gap: 8px;
}
.lab-notebook > summary::-webkit-details-marker {
  display: none;
}
.lab-notebook > summary:after {
  content: "+";
  font-size: 18px;
}
.lab-notebook[open] > summary:after {
  content: "\2212";
}
#labFindingCount:not(:empty) {
  color: #426347;
  background: #e0edda;
  padding: 3px 6px;
  border-radius: 6px;
  margin-left: auto;
}
.lab-notebook-body {
  padding-top: 14px;
  max-height: calc(100dvh - 225px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lab-notebook-body h4 {
  font-size: 20px;
}
.lab-notebook-body p {
  font-size: 13px;
  line-height: 1.6;
  margin: 8px 0;
}
.lab-note-rule {
  margin: 16px 0;
}
.journal-grid {
  align-items: stretch;
}
.journal-entry {
  padding: 22px;
}
.journal-entry-bottom {
  margin-top: auto;
}
.journal-filters {
  gap: 8px;
}

@media (min-width: 1101px) and (min-height: 720px) {
  .lab-workbench {
    max-height: calc(100dvh - 190px);
    overflow-y: auto;
  }
}
@media (max-width: 1100px) {
  .game-layout {
    grid-template-columns: 180px minmax(0, min(600px, calc(100dvh - 225px)));
    gap: 16px;
  }
  .score-panel {
    grid-row: 1 / 3;
  }
  .mission-panel {
    grid-column: 2;
    grid-row: 2;
    position: relative;
  }
  .mission-panel details {
    overflow: visible;
  }
  .mission-panel .mission-body {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 100%;
    max-height: min(460px, 65dvh);
    z-index: 25;
    padding: 16px;
    border: 1px solid #d7c2d7;
    border-radius: 14px;
    background: #fffaf3;
    box-shadow: 0 10px 30px #49374d30;
  }
  .mission-panel summary {
    padding: 9px 12px;
  }
  .mission-panel summary:after {
    content: "+";
    margin-left: auto;
  }
  .mission-panel details[open] summary:after {
    content: "\2212";
  }
  .lab-layout {
    grid-template-columns: 190px minmax(0, min(600px, calc(100dvh - 300px)));
    gap: 14px;
  }
  .lab-workbench {
    grid-column: 1;
    grid-row: 1 / 3;
  }
  .lab-notebook {
    grid-column: 2;
    padding: 10px 14px;
  }
  .lab-notebook-body {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: min(400px, calc(100vw - 32px));
    max-height: min(500px, 65dvh);
    padding: 18px;
    border: 1px solid #c5d2bd;
    background: #fffaf3;
    border-radius: 14px;
    box-shadow: 0 10px 30px #49374d30;
    z-index: 25;
  }
  .duel-live-header {
    grid-template-columns: auto minmax(250px, 1fr) 36px auto;
  }
  .duel-live-header .arena-brand {
    display: none;
  }
}
@media (max-width: 760px) {
  .site-header {
    height: 72px;
    padding-block: 0;
  }
  .site-footer {
    padding: 12px 14px;
    margin-top: 20px;
  }
  .app-shell:has(> #gameScreen:not([hidden])) {
    padding-inline: 16px;
  }
  .game-heading > span {
    font-size: 18px;
  }
  .game-heading > .text-button {
    max-width: 130px;
    font-size: 12px;
    line-height: 1.3;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    width: min(100%, 540px);
    gap: 10px;
    padding: 0;
  }
  .score-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    gap: 6px 10px;
    padding: 10px 12px;
    width: 100%;
    order: 0;
  }
  .level-summary {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  .level-summary .level-label {
    margin: 0;
    font-size: 12px;
  }
  .level-summary h2 {
    display: none;
  }
  .level-summary .goal-copy {
    margin: 0;
    font-size: 12px;
    text-align: right;
    line-height: 1.4;
  }
  .goal-copy br {
    display: none;
  }
  .goal-copy strong {
    margin-left: 4px;
  }
  .score-box {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
    padding: 6px 8px;
    border: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 8px;
    text-align: left;
  }
  .score-box > span {
    grid-column: 1;
    font-size: 12px;
    letter-spacing: 0;
  }
  .score-box > strong {
    grid-column: 1;
    font-size: 30px;
    line-height: 1.1;
  }
  .score-stars {
    grid-column: 2;
    grid-row: 1 / 3;
    margin: 0;
    gap: 2px;
  }
  .score-stars svg,
  .score-stars svg:nth-child(2) {
    width: 15px;
    height: 15px;
  }
  .score-box .progress-track {
    grid-column: 1 / -1;
    height: 4px;
    margin-top: 4px;
  }
  .record-status {
    display: none;
  }
  .moves-box {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    padding: 7px;
    gap: 8px;
    flex-direction: row;
  }
  .moves-box > strong {
    font-size: 32px;
  }
  .moves-box > span {
    font-size: 12px;
    letter-spacing: 0;
    line-height: 1.3;
  }
  .moves-box small {
    display: none;
  }
  .moves-box br {
    display: none;
  }
  .tools {
    grid-column: 1 / -1;
    grid-row: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    gap: 8px;
  }
  .tool-button {
    min-height: 34px;
    display: flex;
    padding: 6px 8px;
    font-size: 12px;
    gap: 6px;
  }
  .tool-button svg {
    width: 16px;
    height: 16px;
  }
  .mission-panel {
    order: 1;
    width: 100%;
  }
  .mission-panel summary {
    padding: 7px 12px;
    min-height: 34px;
  }
  .board-section {
    order: 2;
    width: min(100%, calc(100dvh - 295px));
    align-self: center;
  }
  .board-topline {
    font-size: 12px;
    gap: 6px;
    margin-bottom: 6px;
  }
  .board-instruction {
    display: none;
  }
  .board-utilities {
    margin-top: 8px;
    min-height: 32px;
    gap: 8px;
    justify-content: space-between;
  }
  .board-guide-link {
    font-size: 12px;
    line-height: 1.3;
    text-align: left;
    gap: 3px;
  }
  .board-guide-link svg {
    display: none;
  }
  .campaign-discovery {
    gap: 8px;
  }
  .discovery-clue > summary {
    font-size: 12px;
  }
  .campaign-discovery > .text-button {
    font-size: 12px;
  }
  .arena-header {
    padding-block: 14px;
  }
  .arena-lobby {
    padding-top: 16px;
    gap: 24px;
  }
  .arena-welcome h3 {
    font-size: 36px;
    line-height: 1.12;
  }
  .arena-setup {
    margin: 20px 0;
  }
  .arena-opponent-preview {
    padding: 20px;
  }
  .arena-room-panel {
    padding: 20px;
  }
  .arena-how {
    padding: 18px;
    gap: 18px;
  }
  .room-share {
    margin: 18px auto;
    padding: 20px;
  }
  .room-share-code {
    font-size: 40px;
    letter-spacing: 6px;
  }
  .room-share h3 {
    font-size: 27px;
  }
  .arena-ranking {
    padding: 18px;
    margin-top: 18px;
  }
  .arena-ranking > p {
    font-size: 13px;
    line-height: 1.6;
  }
  .ranking-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ranking-tabs button {
    font-size: 12px;
    padding: 10px 5px;
  }
  .ranking-scroll th,
  .ranking-scroll td {
    padding: 12px 10px;
    font-size: 12px;
  }
  .duel-live-header {
    grid-template-columns: auto minmax(0, 1fr) 34px auto;
    gap: 8px;
    padding: 8px;
  }
  .duel-live-header > .duel-clock-wrap {
    grid-column: 1 / 3;
    grid-row: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 3px 10px;
  }
  .duel-live-header .duel-clock-wrap > strong {
    font-size: 28px;
    margin: 0;
    order: 0;
  }
  .duel-live-header .duel-clock-wrap > span {
    font-size: 12px;
    letter-spacing: 0;
    order: 1;
  }
  .duel-live-header .duel-clock-wrap > small {
    display: none;
  }
  .duel-live-header > .arena-settings {
    grid-column: 3;
    grid-row: 1;
  }
  .duel-live-header > .arena-leave {
    grid-column: 4;
    grid-row: 1;
    padding: 8px;
    min-height: 34px;
    font-size: 12px;
  }
  .duel-live-header > .duel-skills {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .duel-live-header .duel-skills button {
    min-height: 40px;
    padding: 6px 8px;
    grid-template-columns: 20px minmax(0, 1fr) auto;
  }
  .duel-live-header .duel-skills small {
    display: none;
  }
  .duel-live-header .duel-skills strong {
    font-size: 12px;
  }
  .duel-live-header .duel-skills b {
    font-size: 14px;
  }
  .duel-board-frame {
    max-width: min(100%, calc(100dvh - 260px));
  }
  .duel-live-footer {
    display: none;
  }
  .explorer-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 0;
  }
  .explorer-header > .explorer-back {
    grid-column: 2;
    grid-row: 1;
  }
  .explorer-header nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .explorer-header nav button {
    flex-direction: row;
    gap: 7px;
    min-height: 36px;
    padding: 8px;
    font-size: 12px;
  }
  .explorer-header .eyebrow {
    display: none;
  }
  .explorer-header h2 {
    font-size: 24px;
  }
  .lab-intro {
    display: none;
  }
  .lab-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 540px;
    margin: 0 auto;
  }
  .lab-workbench {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
    padding: 10px;
  }
  .lab-workbench > h4,
  .lab-workbench > p,
  #labPalette legend,
  .lab-legend {
    display: none;
  }
  .lab-workbench > .lab-tool {
    grid-column: 1;
    grid-row: 1;
    min-height: 34px;
    justify-content: center;
    font-size: 12px;
    padding: 5px;
  }
  .lab-workbench .lab-room-label {
    display: none;
  }
  #labRoom {
    grid-column: 2;
    grid-row: 1;
    padding: 5px;
    min-height: 34px;
    font-size: 12px;
  }
  #labPalette {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin: 0;
    display: grid;
    gap: 8px;
  }
  .lab-colors {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .lab-colors button {
    min-height: 34px;
    padding: 3px;
  }
  .lab-colors img {
    width: 26px;
    height: 26px;
  }
  .lab-specials {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .lab-specials .lab-tool {
    min-height: 46px;
    padding: 4px 2px;
    font-size: 12px;
  }
  .lab-specials .special-sample {
    width: 21px;
    height: 21px;
  }
  .lab-experiment {
    width: min(100%, calc(100dvh - 365px));
    align-self: center;
  }
  .lab-board-top {
    padding-bottom: 6px;
    font-size: 12px;
  }
  .lab-actions {
    gap: 6px;
    margin-top: 10px;
  }
  .lab-actions button,
  .lab-actions .primary-button {
    min-height: 38px;
    padding: 7px 3px;
    font-size: 12px;
    line-height: 1.3;
  }
  .lab-actions button svg {
    display: none;
  }
  .lab-help {
    display: none;
  }
  .lab-notebook {
    width: 100%;
    padding: 9px 12px;
  }
  .lab-notebook-body {
    width: 100%;
    max-height: min(500px, 65dvh);
  }
  .journal-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .journal-filters button,
  .journal-filters button:first-child {
    grid-column: auto;
    padding: 9px 5px;
    font-size: 12px;
  }
  .journal-entry {
    padding: 20px;
  }
}
@media (max-width: 540px) {
  .app-shell {
    padding-inline: 18px;
  }
  .site-header {
    height: 72px;
    gap: 8px;
  }
  .site-header .brand {
    font-size: 25px;
    gap: 5px;
  }
  .site-header .brand small {
    font-size: 8px;
    letter-spacing: 0.5px;
  }
  .site-header .header-actions {
    gap: 5px;
  }
  .hero {
    padding-top: 28px;
    gap: 16px;
  }
  .hero h1 {
    font-size: clamp(44px, 14vw, 58px);
  }
  .hero-copy > p {
    font-size: 14px;
    line-height: 1.7;
  }
  .hero-note {
    font-size: 12px;
    line-height: 1.5;
  }
  .progress-hub {
    padding: 18px;
  }
  .hub-heading {
    align-items: flex-start;
  }
  .explorer-door {
    padding: 20px;
    gap: 16px;
  }
  .explorer-door h2 {
    font-size: 23px;
  }
  .adventure .section-heading {
    align-items: flex-start;
  }
  .adventure-progress {
    font-size: 12px;
    line-height: 1.5;
  }
  .app-shell:has(> #gameScreen:not([hidden])) {
    padding: 0 12px 10px;
  }
  .game-heading {
    height: 48px;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  .game-heading > .text-button {
    font-size: 0;
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
  }
  .game-heading > .text-button svg {
    width: 20px;
    height: 20px;
  }
  .game-heading > span {
    font-size: 17px;
  }
  .game-controls {
    gap: 4px;
  }
  .game-controls .icon-button {
    width: 32px;
    height: 32px;
  }
  .game-layout {
    gap: 8px;
  }
  .board-section {
    width: min(100%, calc(100dvh - 365px));
  }
  .board-frame {
    padding: 5px;
    border-width: 4px;
    border-radius: 16px;
  }
  .board-topline {
    font-size: 12px;
    letter-spacing: 0;
  }
  .board-utilities {
    gap: 6px;
  }
  .campaign-discovery {
    gap: 6px;
  }
  .discovery-clue > summary {
    padding: 5px;
  }
  .board-guide-link {
    max-width: 40%;
    font-size: 12px;
  }
  .app-shell:has(> #duelScreen[data-view="match"]:not([hidden])) {
    padding: 8px 12px;
  }
  .duel-score-race {
    margin: 9px 0;
  }
  .duel-arena {
    display: block;
  }
  .duel-side.player {
    padding: 10px;
  }
  .player .duel-player-heading {
    padding-right: 120px;
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: flex-start;
    gap: 8px;
  }
  .player .duel-player-heading .arena-avatar {
    width: 32px;
    height: 32px;
  }
  .player .duel-player-heading > div {
    flex: 1;
    min-width: 70px;
  }
  .player .duel-player-heading h3 {
    font-size: 24px;
  }
  .player .duel-player-heading .duel-score {
    width: 100%;
    text-align: left;
    margin: 0;
    font-size: 32px;
  }
  .duel-side-label {
    font-size: 12px;
    line-height: 1.35;
  }
  .duel-player-heading small {
    font-size: 12px;
  }
  .player .duel-board-label {
    min-height: 0;
    font-size: 12px;
    margin: 5px 0 7px;
  }
  .player .duel-board-label b {
    font-size: 12px;
  }
  .player .duel-board-frame {
    max-width: min(100%, calc(100dvh - 334px));
    padding: 5px;
  }
  .duel-side.opponent {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 112px;
    padding: 7px;
    border-radius: 12px;
  }
  .opponent .duel-player-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 0;
    gap: 4px;
    margin-bottom: 5px;
  }
  .opponent .arena-avatar,
  .opponent .duel-side-label,
  .opponent .duel-player-heading small,
  .opponent .duel-board-label,
  .opponent .duel-energy-label {
    display: none;
  }
  .opponent .duel-player-heading h3 {
    font-size: 15px;
    margin: 0;
  }
  .opponent .duel-score {
    font-size: 16px;
    margin: 0;
  }
  .opponent .duel-board-frame {
    max-width: none;
    padding: 2px;
    border-radius: 7px;
  }
  .opponent .duel-energy-track {
    margin-top: 5px;
    height: 4px;
  }
  .opponent .duel-guard-ring span {
    display: none;
  }
  .duel-energy-label {
    font-size: 12px;
  }
  .duel-result-card {
    padding: 20px 16px;
    margin: 16px auto;
  }
  .duel-result-card > .eyebrow {
    font-size: 12px;
  }
  .duel-result-card h3 {
    font-size: 30px;
  }
  .duel-result-medal {
    width: 38px;
    height: 38px;
    margin-bottom: 6px;
  }
  .duel-result-medal svg {
    width: 23px;
    height: 23px;
  }
  .duel-result-score {
    margin: 16px 0;
    gap: 8px;
  }
  .duel-result-player {
    padding: 14px 8px;
  }
  .duel-result-player > strong {
    font-size: 29px;
  }
  .duel-result-streak {
    margin: 14px 0;
    padding: 12px;
  }
  .duel-result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .duel-result-actions > button {
    min-height: 44px;
    padding: 10px;
    font-size: 13px;
    justify-content: center;
  }
  .room-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
  }
  .room-controls > button:first-child {
    grid-column: 1 / -1;
  }
  .room-controls > div {
    min-width: 0;
  }
  .room-controls input {
    width: 100%;
  }
  .room-controls > button:last-child {
    width: 100%;
  }
  .player-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .player-tools > :last-child {
    grid-column: 1 / -1;
  }
  #playerDialog {
    padding: 20px 16px;
  }
  #playerContent h2 {
    font-size: 30px;
  }
  .lab-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-height: 650px) and (min-width: 761px) {
  .app-shell:has(> #gameScreen:not([hidden])) {
    padding-inline: 16px;
  }
  .game-heading {
    height: 42px;
  }
  .game-layout {
    --campaign-board: min(520px, calc(100dvh - 130px));
    grid-template-columns: 165px minmax(0, var(--campaign-board)) 165px;
    gap: 14px;
  }
  .score-panel {
    grid-row: 1;
    padding: 10px;
  }
  .level-summary h2,
  .record-status,
  .moves-box small {
    display: none;
  }
  .level-summary .goal-copy {
    margin-top: 5px;
    font-size: 12px;
  }
  .level-summary .goal-copy br {
    display: none;
  }
  .score-box {
    margin-top: 8px;
    padding-top: 8px;
  }
  .score-box > strong {
    font-size: 30px;
  }
  .score-stars {
    margin: 3px 0 7px;
  }
  .moves-box {
    margin-top: 8px;
    padding: 7px;
  }
  .moves-box > strong {
    font-size: 30px;
  }
  .tools {
    margin-top: 8px;
    gap: 5px;
  }
  .tool-button {
    min-height: 32px;
    padding: 5px;
  }
  .mission-panel {
    grid-column: 3;
    grid-row: 1;
  }
  .mission-panel .mission-body {
    bottom: auto;
    top: calc(100% + 8px);
    max-height: calc(100dvh - 100px);
  }
  .board-instruction {
    display: none;
  }
  .board-topline {
    margin-bottom: 5px;
  }
  .board-utilities {
    margin-top: 6px;
  }
  .board-guide-link {
    max-width: 40%;
    text-align: left;
  }
  .duel-live-header {
    grid-template-columns: minmax(150px, 1fr) minmax(250px, 1.4fr) 32px auto;
    padding: 6px 10px;
    gap: 8px;
  }
  .duel-live-header .duel-clock-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .duel-live-header .duel-clock-wrap strong {
    font-size: 27px;
  }
  .duel-live-header .duel-clock-wrap small {
    display: none;
  }
  .duel-live-header .duel-skills button {
    min-height: 34px;
    padding: 4px 8px;
  }
  .duel-live-header .duel-skills small {
    display: none;
  }
  .duel-player-heading {
    min-height: 38px;
  }
  .duel-player-heading small,
  .duel-side-label {
    display: none;
  }
  .duel-player-heading h3 {
    font-size: 18px;
  }
  .duel-player-heading .arena-avatar {
    width: 30px;
    height: 30px;
  }
  .duel-score {
    font-size: 25px;
  }
  .duel-board-frame {
    max-width: min(520px, calc(100dvh - 155px));
  }
  .duel-board-label {
    margin-block: 4px;
  }
  .duel-live-footer {
    display: none;
  }
  .duel-side {
    padding: 8px;
  }
  .room-share {
    gap: 7px;
    padding: 14px;
    margin: 12px auto;
  }
  .room-share > .eyebrow,
  .room-share > p:first-of-type {
    display: none;
  }
  .room-share h3 {
    font-size: 24px;
  }
  .room-share-code {
    font-size: 34px;
  }
  .room-share > button,
  .room-share > input {
    padding: 7px 12px;
    min-height: 32px;
  }
}
@media (max-width: 360px) {
  .site-header .brand {
    font-size: 23px;
    gap: 3px;
  }
  .site-header .header-actions {
    gap: 4px;
  }
  .score-panel {
    padding: 8px;
    gap: 5px 7px;
  }
  .score-box {
    padding: 5px;
    column-gap: 3px;
  }
  .score-stars svg,
  .score-stars svg:nth-child(2) {
    width: 13px;
    height: 13px;
  }
  .board-guide-link {
    max-width: 33%;
  }
  .discovery-clue > summary {
    padding: 4px;
    gap: 3px;
  }
  .discovery-clue > summary svg {
    display: none;
  }
  .duel-side.opponent {
    width: 102px;
  }
  .player .duel-player-heading {
    padding-right: 108px;
    min-height: 140px;
  }
  .duel-live-header .duel-clock-wrap > span {
    max-width: 90px;
    line-height: 1.2;
  }
  .duel-live-header .duel-clock-wrap > strong {
    font-size: 25px;
  }
}

/* Single-purpose room/result views already have their own back navigation. */
body:has(#duelScreen[data-view="waiting"]:not([hidden])) .site-header,
body:has(#duelScreen[data-view="result"]:not([hidden])) .site-header {
  display: none !important;
}
.lab-actions .primary-button {
  grid-column: auto;
}
.lab-board-top {
  margin-top: 0;
}
.lab-notebook-body > .lab-help {
  display: block;
  margin: 0 0 14px;
  padding: 10px;
}

@media (min-width: 761px) {
  .duel-result-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 10px 24px;
    align-items: center;
    text-align: left;
  }
  .duel-result-medal {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }
  .duel-result-card > .eyebrow {
    grid-column: 1;
    grid-row: 2;
  }
  .duel-result-card > h3 {
    grid-column: 1;
    grid-row: 3;
    margin: 0;
  }
  .duel-result-card > .duel-result-winner {
    grid-column: 1;
    grid-row: 4;
    margin: 0;
  }
  .duel-result-card > .duel-result-reason {
    grid-column: 1;
    grid-row: 5;
    margin: 0;
  }
  .duel-result-score {
    grid-column: 2;
    grid-row: 1 / 6;
    text-align: center;
    margin: 0;
  }
  .duel-result-streak {
    grid-column: 1 / -1;
    grid-row: 6;
    margin: 4px 0;
    padding: 12px;
    border-radius: 12px;
    background: #f6ecf4;
    text-align: center;
  }
  .room-reactions {
    grid-column: 1 / -1;
    grid-row: 7;
    margin: 0;
  }
  .duel-result-actions {
    grid-column: 1 / -1;
    grid-row: 8;
    margin: 4px 0;
  }
  .duel-result-card > .text-button {
    grid-column: 1 / -1;
    grid-row: 9;
    justify-self: center;
  }
  .duel-result-source {
    grid-column: 1 / -1;
    grid-row: 10;
    margin: 0;
    text-align: center;
  }
}
@media (max-width: 540px) {
  .arena-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 0;
  }
  .arena-header > .arena-brand {
    grid-column: 1;
    grid-row: 1;
  }
  .arena-header > .arena-back {
    grid-column: 2;
    grid-row: 1;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 8px;
    font-size: 0;
    justify-self: end;
  }
  .arena-header > .arena-back svg {
    width: 16px;
    height: 16px;
  }
  .arena-header nav {
    grid-row: 2;
    grid-column: 1 / -1;
  }
  .arena-header nav button {
    min-height: 36px;
    padding: 8px;
  }
  .duel-result-medal {
    display: inline-flex;
    width: 30px;
    height: 30px;
    margin: 0 8px 0 0;
    vertical-align: middle;
  }
  .duel-result-card > .eyebrow {
    display: inline-block;
    vertical-align: middle;
  }
  .duel-result-card > h3 {
    font-size: 26px;
    margin: 10px 0 6px;
  }
  .duel-result-score {
    margin: 14px 0;
  }
  .duel-result-player {
    padding: 10px 7px;
  }
  .duel-result-score .duel-result-placement {
    letter-spacing: 0;
    padding: 4px;
    margin-bottom: 8px;
  }
  .duel-result-player-name {
    line-height: 1.3;
  }
  .duel-result-player > strong {
    margin: 5px 0;
  }
  .duel-result-streak {
    padding: 0;
    margin: 12px 0;
  }
  .duel-result-streak b {
    font-size: 24px;
    line-height: 1.2;
    margin-bottom: 4px;
  }
  .duel-result-actions {
    margin: 14px 0;
  }
  .duel-result-actions > .primary-button {
    min-height: 44px;
    padding: 10px;
    font-size: 13px;
    gap: 6px;
    line-height: 1.3;
  }
  .duel-result-source {
    display: none;
  }
  .room-share {
    gap: 10px;
    padding: 18px;
    margin: 16px auto;
  }
}
@media (max-height: 650px) and (min-width: 761px) {
  .tools .tool-button {
    min-height: 32px;
  }
  .level-summary .goal-copy {
    margin-top: 0;
    line-height: 1.3;
  }
  .score-stars svg,
  .score-stars svg:nth-child(2) {
    width: 18px;
    height: 18px;
  }
  .score-box .progress-track {
    height: 5px;
  }
  .duel-player-heading {
    gap: 6px;
  }
  .duel-player-heading > div {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .duel-player-heading .duel-score {
    font-size: 24px;
  }
  .duel-board-label {
    font-size: 12px;
  }
  .duel-board-label b {
    font-size: 12px;
  }
  .duel-energy-label {
    margin-top: 5px;
  }
  .explorer-header {
    min-height: 52px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    padding: 8px 0;
    gap: 14px;
  }
  .explorer-header .eyebrow {
    display: none;
  }
  .explorer-header h2 {
    font-size: 22px;
    margin: 0;
  }
  .explorer-header nav {
    grid-column: 2;
    grid-row: 1;
    width: auto;
  }
  .explorer-header nav button {
    padding: 7px 10px;
    min-height: 34px;
  }
  .explorer-header > .explorer-back {
    grid-column: 3;
    grid-row: 1;
    min-height: 34px;
    padding: 7px 10px;
  }
  .lab-layout {
    grid-template-columns: 190px minmax(0, min(480px, calc(100dvh - 140px)));
    gap: 8px 16px;
  }
  .lab-workbench {
    grid-column: 1;
    grid-row: 1;
    padding: 10px;
  }
  .lab-workbench > h4,
  .lab-workbench > p,
  .lab-room-note,
  #labPalette legend,
  .lab-legend {
    display: none;
  }
  .lab-workbench > .lab-tool {
    padding: 7px;
    min-height: 34px;
    font-size: 12px;
  }
  #labPalette {
    margin: 8px 0;
  }
  .lab-colors {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 3px;
  }
  .lab-colors button {
    padding: 3px 0;
  }
  .lab-colors img {
    width: 23px;
    height: 23px;
  }
  .lab-specials {
    margin-top: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lab-specials .lab-tool {
    flex-direction: row;
    padding: 5px 3px;
    font-size: 12px;
  }
  .lab-specials .special-sample {
    width: 18px;
    height: 18px;
  }
  .lab-room-label {
    display: none;
  }
  #labRoom {
    padding: 6px 3px;
  }
  .lab-experiment {
    grid-column: 2;
    grid-row: 1 / 3;
  }
  .lab-notebook {
    grid-column: 1;
    grid-row: 2;
    padding: 8px 10px;
  }
  .lab-help {
    display: none;
  }
  .lab-notebook-body {
    left: 0;
    right: auto;
  }
  .lab-actions .primary-button {
    grid-column: auto;
  }
}

/* Short landscape screens trade decorative space for usable candy cells. */
@media (max-width: 760px) {
  .mission-panel .mission-body {
    top: calc(100% + 8px);
    bottom: auto;
    max-height: min(420px, calc(100dvh - 270px));
  }
}
@media (max-height: 650px) and (min-width: 761px) {
  .score-panel {
    padding: 8px;
  }
  .moves-box {
    padding: 6px;
  }
  .tools {
    margin-top: 6px;
    gap: 4px;
  }
  .game-layout {
    --campaign-board: min(520px, calc(100dvh - 150px));
  }
  .board-utilities {
    gap: 6px;
  }
  .board-guide-link {
    line-height: 1.3;
  }
  .board-guide-link svg {
    display: none;
  }
  .campaign-discovery {
    gap: 6px;
  }
  .mission-panel summary svg {
    display: none;
  }
  .mission-panel .mission-body {
    max-height: calc(100dvh - 140px);
  }
  .app-shell:has(> #duelScreen[data-view="match"]:not([hidden])) {
    padding: 6px 12px;
  }
  .duel-live-header {
    height: 42px;
    padding: 4px 8px;
    grid-template-columns: minmax(150px, 1fr) minmax(250px, 1.4fr) 30px auto;
  }
  .duel-live-header .duel-skills button {
    min-height: 32px;
  }
  .duel-live-header .arena-settings {
    height: 30px;
    width: 30px;
  }
  .duel-live-header .arena-leave {
    min-height: 30px;
    padding: 6px 8px;
  }
  .duel-score-race {
    height: 5px;
    margin: 6px 0;
  }
  .duel-side {
    padding: 6px;
  }
  .duel-side .duel-player-heading {
    height: 30px;
    min-height: 30px;
  }
  .duel-side .duel-player-heading small,
  .duel-side .duel-side-label,
  .duel-side .duel-board-label {
    display: none;
  }
  .duel-side .arena-avatar {
    width: 28px;
    height: 28px;
  }
  .duel-board-frame {
    max-width: min(520px, calc(100dvh - 164px));
  }
  .duel-energy-label {
    margin: 5px 0 3px;
  }
  .duel-energy-track {
    height: 5px;
    margin-top: 3px;
  }
  .lab-actions button,
  .lab-actions .primary-button {
    min-height: 34px;
    padding: 4px 2px;
    line-height: 1.2;
  }
}

/* Short portrait phones keep readable controls and give the remaining space to the board. */
@media (max-width: 540px) and (max-height: 700px) {
  .game-heading {
    height: 44px;
  }
  .score-panel {
    padding: 8px;
    gap: 4px 8px;
  }
  .score-box {
    padding: 4px;
  }
  .tools .tool-button {
    min-height: 34px;
    padding: 5px;
  }
  .board-section {
    width: min(100%, calc(100dvh - 345px));
  }
  .app-shell:has(> #duelScreen[data-view="match"]:not([hidden])) {
    padding-block: 6px;
  }
  .duel-live-header {
    padding: 6px;
    gap: 6px;
  }
  .duel-live-header .duel-skills button {
    min-height: 34px;
    padding: 4px 6px;
  }
  .duel-side.opponent {
    width: 90px;
    padding: 5px;
  }
  .opponent .duel-player-heading h3 {
    font-size: 13px;
  }
  .player .duel-player-heading {
    min-height: 110px;
    padding-right: 98px;
    gap: 5px;
  }
  .player .duel-player-heading small {
    display: none;
  }
  .player .duel-board-label {
    margin-block: 4px;
  }
  .player .duel-board-frame {
    max-width: min(100%, calc(100dvh - 355px));
  }
  .player .duel-energy-label {
    margin-bottom: 5px;
  }
  .explorer-header {
    padding-block: 6px;
    gap: 6px;
  }
  .explorer-header h2 {
    font-size: 20px;
    white-space: nowrap;
  }
  .explorer-header nav button {
    min-height: 34px;
    padding-block: 6px;
  }
  .lab-layout {
    gap: 6px;
  }
  .lab-workbench {
    padding: 6px;
    gap: 4px 8px;
  }
  #labPalette {
    gap: 4px;
  }
  .lab-colors button {
    min-height: 30px;
    padding: 1px;
  }
  .lab-specials .lab-tool {
    min-height: 40px;
    padding: 3px 1px;
    gap: 2px;
  }
  .lab-specials .special-sample {
    width: 18px;
    height: 18px;
  }
  .lab-experiment {
    width: 100%;
  }
  .lab-board-frame {
    width: min(100%, calc(100dvh - 349px));
    margin-inline: auto;
  }
  .lab-actions {
    margin-top: 6px;
  }
  .lab-actions button,
  .lab-actions .primary-button {
    min-height: 38px;
    padding: 4px 2px;
    line-height: 1.1;
  }
  .lab-notebook {
    padding: 5px 10px;
    min-height: 34px;
  }
}
@media (max-width: 360px) and (max-height: 700px) {
  .explorer-header nav button svg {
    display: none;
  }
}
