:root {
  color-scheme: dark;
  background: #0a1c20;
  color: #fff2db;
  font: 500 15px/1.4 'DM Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
#game {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 15px clamp(11px, 4vw, 24px) 16px;
}
header { margin-bottom: 12px; }
h1 {
  margin: 0;
  font: 500 clamp(37px, 10vw, 54px)/.99 'DM Serif Text', Georgia, serif;
  letter-spacing: -.055em;
}
header p { margin: 5px 0 0; color: #bdd1c9; }
button { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid #ffcf70; outline-offset: 2px; }
.bar, .modes, .hud { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.bar { margin-bottom: 8px; }
.modes { padding: 2px; background: #142f31; border-radius: 13px; }
.bar button {
  color: #dfe9de; background: transparent; border: 1px solid transparent;
  border-radius: 11px; padding: 0 10px; min-height: 36px; font-size: 13px; font-weight: 650;
}
.modes [aria-pressed=true] { color: #102822; background: #bed9c7; }
#restart { border-color: #476762; }
.field { position: relative; overflow: hidden; border: 1px solid #426461; border-radius: 16px; }
#scene { width: 100%; height: auto; display: block; }
.hud {
  position: absolute; top: 10px; inset-inline: 10px; pointer-events: none;
  font-size: 13px; line-height: 1.2;
}
.hud span { padding: 6px 9px; color: #fff4db; background: #102b30; border-radius: 7px; }
.hud strong { color: #ffce77; }
.feedback { margin: 8px 0; min-height: 57px; }
.feedback-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; column-gap: 8px; row-gap: 2px;
}
#ribbon-stock { color: #ffdb96; font-size: 12px; font-weight: 700; }
#detail { display: block; color: #bfd2cb; font-size: 13px; }
.actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
#tie-ribbon {
  min-height: 50px; padding: 4px 8px; border: 1px solid #b38a52; border-radius: 12px;
  background: #25352d; color: #ffdc97; font-weight: 750;
}
#tie-ribbon:hover { background: #354437; }
#primary {
  width: 100%; min-height: 50px; border: 0; border-radius: 12px;
  background: #ffcf76; color: #192724; font-weight: 800; box-shadow: inset 0 -3px #c79149;
}
#primary:hover { background: #ffdc97; }
#primary[aria-disabled=true] { cursor: default; }
@media (min-width: 560px) {
  #game { width: 436px; }
}
@media (max-height: 740px) {
  #game { padding-top: 10px; }
  .field { max-width: min(100%, max(250px, calc((100dvh - 280px) * 9 / 11))); margin-inline: auto; }
}
@media (max-height: 620px) {
  .field { max-width: min(100%, max(210px, calc((100dvh - 310px) * 9 / 11))); }
}
