@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Caslon+Display&display=swap');

/* Local Norse Bold lettering for the game title. */
@font-face {
  font-family: 'Norse';
  src: url('../font/NorseBold-2Kge.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Norse-light';
  src: url('../font/Norse-KaWl.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #111815;
  --surface: #1b2420;
  --surface-raised: #29352c;
  --scene: #161e1a;
  --text: #e7e8dc;
  --muted: #adb6a7;
  --subtle: #a1ad9e;
  --border: #39453b;
  --border-strong: #52644e;
  --accent: #a7be96;
  --on-accent: #172014;
  --gold: #d4b77d;
  --gold-border: #87734f;
  font-family: 'Arial',sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
  font-weight: 400;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: 0.9em;
  background-color: #20160f;
  background-image:
    linear-gradient(rgb(16 12 9 / 64%), rgb(16 12 9 / 64%)),
    url('../assets/branding/oak-grain.webp');
  background-position: center top;
  background-size: auto, max(100%, 1500px) auto;
  background-repeat: no-repeat, repeat-y;
}

button,a,input {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  cursor: pointer;
}

button:focus-visible,a:focus-visible,input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}

header {
  max-width: 1500px;
  margin: auto;
}

.brand,
.brand picture,
.brand img {
  display: block;
}

.brand img {
  width: 100%;
  height: auto;
}

.brand:focus-visible {
  outline-offset: -5px;
}

/* The desktop image reaches 82px tall at about 954px wide. */
@media (max-width: 953px) {
  header {
    container-type: inline-size;
  }

  @container (min-width: 390px) {
    .brand {
      position: relative;
      height: 82px;
      border: 1px solid transparent;
      /* Only the carved trim crosses the transparent space between the two ends. */
      border-image: url('../assets/branding/carved-header-mobile-cutout.png')
        0 105 0 246 fill / 0 105px 0 246px / 0 repeat stretch;
    }

    /* Keep the image's text alternative available on the home link. */
    .brand picture {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      opacity: 0;
    }
  }
}

.header-end {
  font-size: 0.75em;
  letter-spacing: 1.6px;
}

.header-end {
  font-weight: 600;
}

.header-end span {
  margin-left: 16px;
  font-size: 1.57407409em;
}

main {
  max-width: 1500px;
  margin: auto;
}

.intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 0 10px;
}

.eyebrow {
  font-size: 0.75em;
  letter-spacing: 2px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
}

.eyebrow>span {
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 100%;
}

h1 {
  font-family: Norse, 'Libre Caslon Display',Georgia,serif;
  font-size: 4.58333334em;
  line-height: .99;
  font-weight: 400;
  letter-spacing: -1.8px;
  margin: 23px 0 20px;
}

h2 em {
  font-weight: 400;
  color: var(--gold);
}

.description {
  font-size: 1em;
  line-height: 1.9;
  color: var(--muted);
  margin: 0;
}

.board-facts {
  text-align: right;
  padding-bottom: 5px;
}

.board-facts>span {
  font-family: 'Norse', 'Libre Caslon Display',Georgia,serif;
  font-size: 3.33333334em;
  letter-spacing: -2px;
}

.board-facts small {
  display: block;
  font-size: 0.66666667em;
  letter-spacing: 1.6px;
  color: var(--subtle);
  margin-top: 7px;
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 258px;
  border: 1px solid var(--border);
  min-height: 530px;
}

.scene-wrap {
  position: relative;
  background: var(--scene);
  min-width: 0;
  overflow: hidden;
}

.scene-heading {
  position: absolute;
  top: 23px;
  left: 26px;
  right: 26px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 1;
  font-size: 0.66666667em;
  letter-spacing: 1.5px;
  color: var(--subtle);
}

.scene-heading>span:first-child {
  color: var(--muted);
}

.scene-heading i {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
}

#scene {
  height: 530px;
  position: relative;
}

#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  font-size: 1em;
  color: var(--muted);
}

.scene-footer {
  position: absolute;
  bottom: 18px;
  left: 26px;
  right: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.83333333em;
  color: var(--muted);
}

.scene-footer b {
  padding: 0 10px;
  font-weight: 400;
}

.mouse-icon {
  margin-right: 6px;
  font-size: 1.33333334em;
}

.text-button {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 6px 0;
  font-size: 1em;
}

.text-button span {
  font-size: 1.41666666em;
  margin-left: 10px;
}

aside {
  padding: 30px 25px;
  background: var(--surface);
}

aside>.eyebrow {
  font-size: 0.66666667em;
  color: var(--subtle);
  margin: 0 0 14px;
}

h2 {
  font-family: Norse, 'Libre Caslon Display',Georgia,serif;
  font-size: 2.43055556em;
  font-weight: 400;
  margin: 0 0 10px;
}

.aside-copy {
  font-size: 0.91666667em;
  color: var(--muted);
  line-height: 1.8;
}

.control-section {
  margin-top: 29px;
}

.control-section>label {
  font-size: 0.66666667em;
  letter-spacing: 1.5px;
  color: var(--subtle);
}

.segmented {
  display: flex;
  padding: 3px;
  background: var(--background);
  margin-top: 11px;
  border-radius: 4px;
}

.segmented button {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 0.75em;
  color: var(--muted);
  padding: 10px 3px;
  white-space: nowrap;
}

.segmented button.active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 2px 3px #0001;
}

.toggle-row {
  margin-top: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-row label {
  font-size: 0.91666667em;
  cursor: pointer;
}

.toggle-row small {
  display: block;
  font-size: 0.75em;
  color: var(--subtle);
  margin-top: 5px;
}

input[type=checkbox] {
  appearance: none;
  width: 29px;
  height: 17px;
  background: var(--border-strong);
  border-radius: 20px;
  cursor: pointer;
  position: relative;
  margin: 0;
}

input[type=checkbox]:checked {
  background: var(--accent);
}

input[type=checkbox]:before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #f3efdf;
  transition: transform .2s;
}

input[type=checkbox]:checked:before {
  transform: translateX(12px);
}

.legend {
  border-top: 1px solid var(--border);
  margin-top: 26px;
  padding-top: 22px;
  display: grid;
  gap: 16px;
}

.legend>div {
  display: flex;
  align-items: center;
  gap: 13px;
}

.legend-symbol {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold-border);
  color: var(--gold);
  font-size: 2.16666667em;
  line-height: 1;
}

.legend strong {
  display: block;
  font-size: 0.83333333em;
  font-weight: 500;
}

.legend small {
  display: block;
  margin-top: 4px;
  font-size: 0.75em;
  color: var(--subtle);
}

.note {
  margin-top: 27px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.note>span {
  font-size: 2.29166666em;
  color: var(--gold);
}

.note p {
  font-family: Georgia,serif;
  font-size: 1em;
  font-style: italic;
  line-height: 1.6;
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 30px;
  gap: 15px;
  color: var(--subtle);
  font-size: 0.66666667em;
  letter-spacing: 1.1px;
}

footer>span:nth-child(2) {
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 1.125em;
}

footer i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 10px;
}

.black-dot {
  background: #795234;
}

.white-dot {
  background: #e1d2ae;
  border: 1px solid #a99b78;
}

.gold-dot {
  background: var(--gold);
}

@media (min-width:1600px) {
  #scene {
    height: 600px;
  }

}

@media (max-width:850px) {
  .board-layout {
    grid-template-columns: minmax(0,1fr) 225px;
  }

  aside {
    padding: 25px 18px;
  }

  h1 {
    font-size: 3.95833334em;
  }

  .scene-footer b {
    padding: 0 4px;
  }

  footer>span:first-child {
    display: none;
  }

}

@media (max-width:600px) {
  .header-end {
    font-size: 0.66666667em;
  }

  .intro {
    padding: 30px 0 25px;
  }

  h1 {
    font-size: 3.61111111em;
  }

  .eyebrow {
    font-size: 0.58333333em;
    letter-spacing: 1.3px;
  }

  .description {
    font-size: 0.91666667em;
  }

  .board-facts>span {
    font-size: 2.3611111em;
  }

  .board-facts small {
    font-size: 0.5em;
  }

  .board-layout {
    grid-template-columns: 1fr;
  }

  #scene {
    height: 420px;
  }

  .scene-heading {
    left: 16px;
    right: 16px;
    font-size: 0.58333333em;
  }

  .scene-footer {
    left: 16px;
    right: 16px;
    font-size: 0.75em;
  }

  aside {
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 25px;
  }

  aside>.eyebrow,h2,.aside-copy,.note {
    display: none;
  }

  .control-section {
    grid-column: 1/-1;
    margin: 0 0 4px;
  }

  .toggle-row {
    margin-top: 15px;
  }

  .legend {
    grid-column: 1/-1;
    grid-template-columns: 1fr 1fr;
    padding-top: 18px;
    margin-top: 18px;
    margin-bottom: 3px;
  }

  footer {
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.58333333em;
    padding: 18px 0;
  }

  footer>span:nth-child(2) {
    font-size: 1.14285714em;
  }

}

/* Gameplay and accessible native overlays. */
.rules-button {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  border-radius: 3px;
  padding: 10px 15px;
  font-size: 0.91666667em;
}

.rules-button span {
  margin-left: 15px;
}

.game-panel {
  margin: 16px 0 22px;
}

.game-panel p {
  margin: 0;
}

#turn-status {
  font-size: 1.16666667em;
  font-weight: 600;
}

#game-message {
  font-size: 0.91666667em;
  line-height: 1.7;
  color: var(--muted);
  min-height: 57px;
  margin-top: 8px;
}

.game-actions {
  display: flex;
  gap: 8px;
  margin-top: 13px;
}

.game-actions button {
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  border-radius: 3px;
  padding: 8px 10px;
  font-size: 0.83333333em;
  flex: 1;
}

.game-actions button:disabled {
  opacity: .4;
  cursor: default;
}

#capture-count {
  font-size: 0.75em;
  color: var(--subtle);
  margin-top: 12px;
}

aside {
  padding-top: 25px;
}

aside .control-section {
  margin-top: 20px;
}

dialog {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 30px;
  max-width: 660px;
  width: calc(100% - 32px);
  max-height: 85dvh;
  overflow: auto;
  box-shadow: 0 20px 100px #00000080;
}

dialog::backdrop {
  background: #050a07cc;
  backdrop-filter: blur(4px);
}

body:has(dialog[open]) {
  overflow: hidden;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-heading h2 {
  font-size: 3.125em;
}

.dialog-heading .eyebrow {
  color: var(--gold);
}

.close-button {
  border: 0;
  background: var(--surface-raised);
  color: var(--text);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.66666666em;
}

.rules-intro,.rules-controls,.rules-source {
  font-size: 1em;
  line-height: 1.8;
  color: var(--muted);
}

.rules-list {
  padding-left: 22px;
  font-size: 1em;
  line-height: 1.85;
}

.rules-list li {
  padding-left: 7px;
  margin: 15px 0;
}

.rules-list strong {
  color: var(--text);
}

.rules-source a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.rules-controls {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

#draw-dialog {
  max-width: 410px;
}

#draw-dialog p {
  font-size: 1.08333333em;
  line-height: 1.8;
}

@media (max-width:600px) {
  .game-panel {
    grid-column: 1/-1;
    margin: 0 0 12px;
  }

  #game-message {
    min-height: 0;
  }

  .game-actions {
    max-width: 300px;
  }

  aside .control-section {
    margin-top: 0;
  }

  dialog {
    padding: 23px;
  }

  .rules-button {
    font-size: 0.83333333em;
    padding: 9px 11px;
  }

  .rules-button span {
    margin-left: 7px;
  }

}

/* Let the 3D viewport fill the taller game sidebar without an empty strip. */
.scene-wrap {
  min-height: 580px;
}

#scene {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
}

aside>.note {
  display: none;
}

@media (max-width:600px) {
  .scene-wrap {
    height: 440px;
    min-height: 0;
  }

}

/* Preserve nested icon sizes when their parents change at the mobile breakpoint. */
@media (max-width:600px) {
  .header-end span {
    font-size: 1.77083334em;
  }

  .mouse-icon {
    font-size: 1.48148149em;
  }

  .text-button {
    font-size: 1.11111111em;
  }
}

/* Clear interaction feedback on the dark surfaces. */
::selection {
  color: var(--on-accent);
  background: var(--gold);
}

.rules-button:hover,
.game-actions button:not(:disabled):hover,
.close-button:hover {
  background: var(--border);
  border-color: var(--accent);
}

.segmented button:not(.active):hover {
  background: var(--surface-raised);
  color: var(--text);
}

.text-button:hover,
.rules-source a:hover {
  color: var(--gold);
}

.black-dot {
  border: 1px solid #b18c5b;
}

/* Piece themes use the same dark palette as the board controls. */
.theme-control label {
  display: block;
}

#piece-theme {
  width: 100%;
  margin-top: 11px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-raised);
  font-family: inherit;
  font-size: 1em;
  cursor: pointer;
}

#piece-theme:hover {
  border-color: var(--accent);
}

#piece-theme:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}

/* Keep the disclosure control visible when the options panel is collapsed. */
.board-toolbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.options-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 1em;
}

.board-toolbar kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.12em 0.3em;
  border: 1px solid currentColor;
  border-radius: 4px;
  font: 0.85em / 1.1 monospace;
  text-align: center;
  vertical-align: baseline;
}

.options-toggle:hover {
  border-color: var(--accent);
}

#options-toggle-icon {
  font-size: 1.16666666em;
  line-height: 1;
}





/* Animate a fixed-width panel inside a shrinking, clipped grid track. */
.board-layout {
  --options-width: 250px;
  --options-track: var(--options-width);
  grid-template-columns: minmax(0, 1fr) var(--options-track);
  transition: grid-template-columns 320ms ease;
}

.board-layout.options-collapsed {
  --options-track: 0px;
}

#options-panel-shell {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
}

.options-panel-content {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#options-panel {
  width: var(--options-width);
  min-height: 100%;
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transition:
    transform 320ms ease,
    opacity 220ms ease,
    visibility 0s linear;
}

.options-collapsed #options-panel {
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition-delay: 0s, 0s, 320ms;
}

@media (max-width: 850px) {
  .board-layout {
    --options-width: 225px;
  }
}

@media (max-width: 600px) {
  .board-layout {
    --options-track: 0px;
  }

  #options-panel-shell {
    grid-column: 1 / -1;
    grid-row: 3;
    transition: grid-template-rows 320ms ease;
  }

  #options-panel {
    width: 100%;
    min-height: 0;
  }

  .options-collapsed #options-panel-shell {
    grid-template-rows: 0fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .board-layout,
  #options-panel-shell,
  #options-panel {
    transition: none;
  }
}

/* Keep the battlefield anchored while the options animate independently. */
.board-layout {
  grid-template-rows: auto clamp(530px, calc(70vh - 50px), 750px);
}

.board-layout > .scene-wrap {
  grid-column: 1;
  grid-row: 2;
  height: 100%;
  min-height: 0;
}

#options-panel-shell {
  min-height: 0;
}

.options-panel-content {
  overflow-x: hidden;
  overflow-y: auto;
}

/* Keep game controls available independently of the collapsible options. */
.board-game-controls {
  position: absolute;
  top: 42px;
  left: 26px;
  right: 26px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  pointer-events: none;
}

.board-turn-status {
  max-width: 100%;
  margin: 0;
  padding: 0.5em 0.8em;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.4;
}

.board-game-controls .game-actions {
  margin: 0;
  flex-shrink: 0;
  pointer-events: auto;
}

.board-game-controls .game-actions button {
  white-space: nowrap;
}

@media (max-width: 600px) {
  .board-game-controls {
    left: 16px;
    right: 16px;
  }
}

/* Give captured totals their own line below the persistent game controls. */
.board-game-controls #capture-count {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.875em;
  line-height: 1.5;
  color: var(--muted);
}

/* Keep move feedback visible below the status and captured totals. */
.board-game-controls #game-message {
  flex-basis: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Expand the entire game section, including its controls and options. */
.board-toolbar {
  gap: 8px;
  flex-wrap: wrap;
}

body.board-fullscreen {
  overflow: hidden;
}

.board-layout.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100%;
  height: 100dvh;
  max-width: none;
  margin: 0;
  border: 0;
  background: var(--scene);
  grid-template-rows: auto minmax(0, 1fr);
}

.board-layout.is-maximized > .scene-wrap {
  min-height: 0;
}

@media (max-width: 600px) {
  .board-layout.is-maximized {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .board-layout.is-maximized #options-panel-shell {
    max-height: 40dvh;
  }
}

/* View presets remain available when options are hidden or the board is full screen. */
.board-toolbar .view-controls {
  margin: 0 auto 0 0;
  align-self: center;
}

.board-toolbar .view-controls button {
  padding: 6px 10px;
  font-size: 1em;
}

/* Reuse the board decals as white icons on the dark options panel. */
.legend-symbol img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 2px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* Make the action required to begin play easy to find. */
.game-actions #start-game {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

/* Keep elapsed time readable without changing width as the seconds tick. */
.board-timer {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
}

#game-timer {
  margin-left: 0.4em;
  color: var(--text);
  font-size: 1.16666667em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Opponent selection is locked for a running game; New game unlocks it. */
#opponent-mode {
  width: 100%;
  margin-top: 11px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-raised);
  font: inherit;
}

#opponent-mode:disabled {
  opacity: 0.6;
}

.cpu-side-choices {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.cpu-side-choices button {
  display: grid;
  gap: 0.5em;
  padding: 1em;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
}

.cpu-side-choices button:hover {
  border-color: var(--accent);
}

.cpu-side-choices span {
  color: var(--muted);
  font-size: 0.91666667em;
}

/* Hold the loading overlay until the default GLB models and textures are ready. */
#loading {
  z-index: 2;
  gap: 1em;
  padding: 2em;
  background: var(--scene);
  text-align: center;
}

#webgl-help:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5em 1em;
}

#webgl-help a {
  color: var(--accent);
  text-decoration: underline;
}

#retry-loading {
  justify-self: center;
  padding: 0.6em 1em;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text);
}

/* End-of-game announcement stays in the full-screen board's dialog layer. */
#game-result-dialog {
  max-width: 36em;
  padding: 3em 2em;
  text-align: center;
}

#game-result-title {
  margin: 0;
  font-family: 'Norse', serif;
  font-size: 6.66666666em;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.03em;
}

#game-result-dialog[data-outcome='win'] #game-result-title {
  color: #fff1a8;
}

#game-result-dialog[data-outcome='lose'] #game-result-title {
  color: #ff4d4f;
}

#game-result-detail {
  margin: 1em 0 1.5em;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 600px) {
  #game-result-title {
    font-size: 5em;
  }
}

.intro > div {
  min-width: 0;
}

.board-facts {
  flex-shrink: 0;
}

.board-game-controls {
  top: 58px;
}

.board-game-controls .game-actions {
  max-width: 100%;
  flex-shrink: 1;
  flex-wrap: wrap;
}

.scene-footer {
  flex-wrap: wrap;
  gap: 8px 16px;
}

.scene-footer > span {
  min-width: 0;
  max-width: 100%;
}

.toggle-row {
  gap: 12px;
}

input[type=checkbox],
.legend-symbol,
.close-button {
  flex-shrink: 0;
}

footer {
  flex-wrap: wrap;
}

@media (max-width: 1000px) {
  .board-layout {
    --options-track: 0px;
    grid-template-rows: auto 650px auto;
  }

  #options-panel-shell {
    grid-column: 1 / -1;
    grid-row: 3;
    transition: grid-template-rows 320ms ease;
  }

  #options-panel {
    width: 100%;
    min-height: 0;
  }

  .options-collapsed #options-panel-shell {
    grid-template-rows: 0fr;
  }

  .board-layout.is-maximized {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .board-layout.is-maximized #options-panel-shell {
    max-height: 40dvh;
  }

  .intro {
    flex-wrap: wrap;
  }
}

@media (max-width: 600px) {
  .board-toolbar .view-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .board-toolbar .view-controls button {
    flex: 1 1 150px;
    min-width: 0;
    white-space: normal;
  }

  .scene-heading {
    flex-wrap: wrap;
    gap: 6px 12px;
  }

  .board-game-controls {
    top: 76px;
  }

  #options-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .legend {
    grid-template-columns: minmax(0, 1fr);
  }

  #game-result-dialog {
    padding: 1.5em 0.75em;
  }
}

/* Keep source attributions available at the end of the options panel. */
.acknowledgements-link {
  display: block;
  grid-column: 1 / -1;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-size: 1em;
  line-height: 1.6;
  text-underline-offset: 0.2em;
}

#acknowledgements-title {
  min-width: 0;
  font-size: 2em;
  overflow-wrap: anywhere;
}

#acknowledgements-content {
  margin-top: 20px;
}

#acknowledgements-content section + section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

#acknowledgements-content h3 {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 1.16666667em;
}

.credits-text {
  margin: 0;
  color: var(--muted);
  font: inherit;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
