:root {
  color-scheme: light;
  --forest: #163b35;
  --deep: #102d29;
  --cream: #fff2d2;
  --gold: #ffd781;
  --tomato: #ad3929;
  --ink: #203a32;
  --soft: #51695c;
  --line: #cebfa0;
  --mono: ui-monospace, "Courier New", monospace;
  font:
    16px/1.45 "Trebuchet MS",
    Arial,
    sans-serif;
  color: var(--cream);
  background: var(--deep);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background:
    repeating-linear-gradient(
      100deg,
      transparent 0 31px,
      #244a3c44 32px,
      transparent 33px
    ),
    var(--forest);
  min-height: 100svh;
}
main {
  max-width: 1080px;
  margin: auto;
  padding: 12px clamp(12px, 3vw, 36px) 22px;
}
header,
.board-head,
.legend,
.buttons,
footer,
.lobby-row,
.score-row,
label {
  display: flex;
  align-items: center;
  gap: 10px;
}
header {
  min-height: 48px;
  border-bottom: 1px solid #608276;
  margin-bottom: 14px;
}
.brand,
.edition,
.board-head,
.legend,
.kicker,
.sub,
footer,
.small,
output,
.score-row small {
  font-family: var(--mono);
}
.brand {
  font-size: 0.98rem;
  letter-spacing: 0.04em;
}
.brand span {
  color: var(--gold);
}
.edition {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  margin-left: auto;
  color: #d1dfc8;
}
button {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: #fff8e2;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  cursor: pointer;
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:hover:enabled {
  filter: brightness(0.95);
}
button:focus-visible,
input:focus-visible,
#board:focus-visible {
  outline: 3px solid #e99145;
  outline-offset: 3px;
}
.plain {
  background: transparent;
  color: inherit;
  border-color: currentColor;
  font: 700 0.75rem var(--mono);
}
header .plain {
  margin-left: 8px;
}
.cabinet {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(285px, 0.9fr);
  align-items: start;
  gap: clamp(14px, 3.4vw, 44px);
}
.playarea {
  min-width: 0;
  width: 100%;
  max-width: min(560px, calc(80svh - 93px));
  justify-self: center;
}
.board-head,
.legend {
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: #e3e4c8;
}
.board-head b {
  font:
    italic bold 1.1rem Georgia,
    serif;
  color: var(--gold);
}
#board {
  width: 100%;
  aspect-ratio: 4/5;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 5px 0 #0d241e,
    0 0 0 2px #a77a48;
  background: #d9a86a;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#board canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.legend {
  padding-top: 12px;
  letter-spacing: 0;
}
.legend b {
  color: var(--gold);
}
.legend i {
  font-style: normal;
  font-weight: 400;
  color: var(--cream);
}
.paper {
  min-width: 0;
  color: var(--ink);
  background: var(--cream);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 4px 5px 0 #09282155;
  margin-top: 7px;
}
.stripe {
  height: 11px;
  background: repeating-linear-gradient(
    120deg,
    var(--tomato) 0 12px,
    #ffde9a 12px 24px
  );
}
.paper-in {
  padding: clamp(16px, 2.6vw, 29px);
}
h1,
h2,
p {
  margin: 0 0 10px;
}
h1,
h2 {
  font-family: Georgia, serif;
  letter-spacing: -0.05em;
  line-height: 1.03;
}
h1 {
  font-size: clamp(3.1rem, 6vw, 5rem);
}
h1 em {
  color: var(--tomato);
}
h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
}
.lead {
  font-size: 1.1rem;
  font-weight: bold;
}
.kicker,
.sub,
footer {
  font-size: 0.69rem;
  letter-spacing: 0.09em;
  font-weight: bold;
}
.kicker {
  color: #80502f;
  margin-bottom: 11px;
}
.sub {
  margin: 18px 0 8px;
  font-size: 0.85rem;
  letter-spacing: 0.035em;
}
.menu,
.buttons {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.menu {
  margin: 16px 0;
}
.primary {
  background: var(--tomato);
  border-color: var(--tomato);
  color: #fff6e5;
}
.small,
.score-row small {
  font-size: 0.78rem;
  color: var(--soft);
  letter-spacing: 0;
}
.rows {
  padding: 0;
  list-style: none;
  margin: 8px 0;
}
.rows li {
  border-top: 1px dashed var(--line);
  padding: 7px 0;
}
.lobby-row,
.score-row {
  justify-content: space-between;
}
.lobby-row span,
.score-row span {
  flex: 1;
  min-width: 0;
}
.score-row b {
  font: 700 0.85rem var(--mono);
}
.score-row .chip {
  border-radius: 100%;
  width: 25px;
  height: 25px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--forest);
  color: white;
  font: 700 0.76rem var(--mono);
}
.chip[data-slot="0"] {
  background: #a8372c;
}
.chip[data-slot="1"] {
  background: #14635f;
}
.chip[data-slot="2"] {
  background: #835113;
}
.chip[data-slot="3"] {
  background: #694474;
}
.current {
  font-weight: bold;
}
label {
  font: bold 0.78rem var(--mono);
  justify-content: space-between;
  margin-top: 9px;
}
input[type="range"] {
  width: 100%;
  height: 32px;
  accent-color: var(--tomato);
  margin: 0;
}
#turn-tools {
  border-block: 1px dashed var(--line);
  padding: 2px 0 12px;
  margin: 12px 0;
}
#notice:not(:empty) {
  padding-top: 10px;
  color: #843b26;
  font-weight: bold;
}
footer {
  border-top: 1px dashed var(--line);
  justify-content: space-between;
  padding: 9px 16px;
  color: var(--soft);
}
footer .plain {
  border-color: var(--line);
}
@media (max-width: 670px) and (orientation: portrait) {
  main {
    padding: 7px 14px 18px;
  }
  header {
    margin-bottom: 6px;
  }
  .cabinet {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .playarea {
    align-self: center;
    width: min(100%, calc(77svh - 60px));
    max-width: 440px;
  }
  .paper {
    width: 100%;
    margin: 0;
  }
  .lobby .paper,
  .waiting .paper {
    order: -1;
  }
  .lobby h1 {
    font-size: 2.8rem;
  }
  .lobby h1 br {
    display: none;
  }
  .lobby h1 em:before {
    content: " ";
  }
  .lobby .paper-in {
    padding: 15px;
  }
  .lobby .lead {
    margin-bottom: 4px;
  }
  .legend {
    padding-top: 7px;
  }
  .edition {
    font-size: 0.56rem;
  }
  .paper-in {
    padding: 16px;
  }
  .sub {
    margin-top: 12px;
  }
  .turn .playarea {
    width: min(100%, calc(68svh - 75px));
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  main {
    padding: 3px 10px 12px;
  }
  header {
    min-height: 35px;
    margin-bottom: 3px;
  }
  .cabinet {
    grid-template-columns: minmax(190px, 1fr) minmax(245px, 1.2fr);
    gap: 12px;
  }
  .playarea {
    max-width: calc(80svh - 66px);
  }
  .paper-in {
    padding: 12px;
  }
  .board-head,
  .legend {
    font-size: 0.57rem;
  }
  .board-head b {
    font-size: 0.85rem;
  }
  h1 {
    font-size: 2.4rem;
  }
  h1 br {
    display: none;
  }
  h1 em:before {
    content: " ";
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
