:root {
  --page: #fffaf0;
  --ink: #351e30;
  --oxblood: #802c40;
  --bone: #fff1d2;
  --rounded: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --width: min(calc(100% - 24px), 1450px);
  --mast-height: 68px;
}

.mast {
  min-height: calc(var(--mast-height) + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  gap: clamp(5px, 1.8vw, 22px);
  padding: env(safe-area-inset-top) 0 0;
  position: relative;
  z-index: 6;
}
.mast h1, .mast .brand {
  display: block;
  margin: 0;
  white-space: normal;
  font: 900 clamp(1.6rem, 3.6vw, 3.55rem)/.98 var(--rounded);
  letter-spacing: -.075em;
  text-align: center;
  overflow-wrap: anywhere;
}
.mast > nav { min-width: 0; justify-self: end; text-align: end; }
.mast nav a, .language-menu summary { padding-inline: clamp(4px, 1vw, 12px); line-height: 1.15; }
.mast nav a, .language-menu summary, .site-footer a { overflow-wrap: anywhere; }
.language-menu { min-width: 0; position: relative; justify-self: start; }
.language-menu summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  list-style: none;
  padding-block: 4px;
  font-size: .92rem;
  font-weight: 760;
  color: var(--oxblood);
  -webkit-tap-highlight-color: transparent;
}
.language-menu summary::-webkit-details-marker { display: none; }
.language-menu summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  flex: none;
  margin: -4px 2px 0 0;
}
.language-menu .language-nav {
  position: absolute;
  inset: 100% auto auto 0;
  display: grid;
  min-width: 134px;
  width: max-content;
  margin: 0;
  padding: 3px 8px;
  background: var(--page);
  border: 1px solid #a36956;
  border-radius: 6px;
  box-shadow: 0 4px 0 #673841;
}
.mast .language-nav a { justify-items: start; border-bottom: 1px solid #a369563d; }
.mast .language-nav a:last-child { border-bottom: 0; }
.mast .language-nav a[aria-current="page"] { color: var(--ink); text-decoration: none; }

#game {
  --pad: 11px;
  --field-gap: clamp(2px, .39vmin, 5px);
  --rim: 7px;
  --rail: var(--rim);
  --press-height: clamp(452px, calc(100dvh - var(--mast-height) - env(safe-area-inset-top) - 14px - env(safe-area-inset-bottom)), 1100px);
  width: min(var(--width), max(780px, 66vw));
  container-type: size;
  height: var(--press-height);
  display: block;
  padding: var(--pad);
  overflow: clip;
  border: 1px solid #69382d;
  border-radius: 19px 19px 12px 12px;
  background:
    repeating-linear-gradient(3deg, #ffdb9325 0 1px, #67322a16 2px, transparent 4px 9px),
    radial-gradient(ellipse at 34% 4%, #efb779, #c98551 60%, #9a5638);
  box-shadow: inset 0 2px #f4bf79, inset 0 -7px #713d33, 0 3px #4f2c2d, 0 13px 22px #6039311f;
}
.press-layout {
  --tray-size: min(100cqw, 1480px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 35%);
  grid-template-rows: 48px minmax(0, 1fr) 49px;
  grid-template-areas: "meters tools" "rack rack" "tray controls";
  gap: 7px;
  height: 100%;
  max-width: 1480px;
  margin-inline: auto;
}
.readouts {
  grid-area: meters;
  grid-template: 1fr / repeat(3, minmax(0, 1fr));
  align-self: stretch;
  border-radius: 8px;
  background: #522d31;
  box-shadow: inset 0 2px 3px #32192199, 0 1px #e6a668, 0 0 0 1px #995534;
}
.meter {
  flex-direction: column;
  gap: 2px;
  padding: 2px 3px;
  border: 0;
  border-inline-end: 1px solid #e8b99a39;
  color: #ffe3b5;
  font: 700 .88rem/1.1 var(--rounded);
  overflow-wrap: anywhere;
}
.meter:last-child { border: 0; }
.meter strong { font: 900 clamp(1.2rem, 2.8vmin, 2.1rem)/1 var(--rounded); }
.time-meter i { background: #f7bc83; }
.press-tools {
  grid-area: tools;
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 3px;
  z-index: 5;
}
.tool-button {
  width: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: #522d31;
  border-color: #3d2029;
  color: #ffebc9;
  box-shadow: 0 2px #371923, inset 0 1px #b27770;
  -webkit-tap-highlight-color: transparent;
}
.tool-button:focus-visible { outline-color: #381028; outline-offset: 2px; }
.fullscreen-icon {
  width: 18px;
  height: 18px;
  display: grid;
  grid-template: repeat(2, 1fr) / repeat(2, 1fr);
  gap: 5px;
}
.fullscreen-icon i {
  border: solid currentColor;
  border-width: 2px 0 0 2px;
  rotate: calc(var(--corner-turn, 0deg) + var(--icon-turn, 0deg));
}
.fullscreen-icon i:nth-child(2) { --corner-turn: 90deg; }
.fullscreen-icon i:nth-child(3) { --corner-turn: 270deg; }
.fullscreen-icon i:nth-child(4) { --corner-turn: 180deg; }
[data-act="fullscreen"][aria-pressed="true"] .fullscreen-icon {
  --icon-turn: 180deg;
  gap: 3px;
}
.rack {
  grid-area: rack;
  width: var(--tray-size);
  align-self: stretch;
  justify-self: center;
  padding-block: var(--rim);
  border-radius: 8px;
  box-shadow: inset 0 3px 6px #382026af, 0 2px #f7c486, 0 0 0 2px #935936;
}
.rail i { width: 60%; }
.tile {
  border-radius: clamp(3px, .7vmin, 8px);
  font: 900 clamp(1.15rem, min(5.2cqw, 7.8cqh), 4.6rem)/1 var(--serif);
}
.tile span { padding-bottom: .09em; }
.tile.selected { box-shadow: inset 0 2px #fff0e2, inset 0 -4px #a44f6855, 0 1px 5px #581b3e; }
.controls {
  grid-area: controls;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  border: 0;
  box-shadow: none;
}
.controls button, .panel button { font-family: var(--rounded); }
.controls button, .controls [data-act="lift"] { min-width: 44px; padding-inline: 5px; }
.controls [data-act="lift"][data-ready]:not([aria-pressed="true"]) { background: #ffd497; }
.controls [data-act="lift"].charge-earned { animation: charge-earned .23s ease-out; }
@keyframes charge-earned { 35% { transform: translateY(-2px); box-shadow: 0 3px #633427, inset 0 0 0 2px #a64460; } }
.controls [data-act="submit"] { background: #852f44; color: #fff2d6; }
.tray {
  grid-area: tray;
  width: 100%;
  min-width: 0;
  align-content: center;
  justify-items: center;
  border: 1px solid #5b332c;
  border-radius: 5px 5px 9px 9px;
  box-shadow: inset 0 1px 4px #301a224d, 0 1px #e6af70;
}
#word { font: 900 clamp(1rem, 2.4vmin, 1.55rem)/1 var(--rounded); }
#hint { line-height: 1.1; font-size: .875rem; }
#game[data-mode="menu"] .tray, #game[data-mode="over"] .tray, #game[data-mode="won"] .tray { visibility: hidden; }

.panel {
  top: 50%;
  left: 50%;
  width: min(calc(100% - 26px), 555px);
  display: grid;
  gap: 12px;
  padding: clamp(12px, 2.4vw, 27px);
  text-align: start;
  transform: translate(-50%, -50%);
  border: 1px solid #8b5148;
  border-inline: 7px solid #703845;
  border-radius: 4px 13px 4px 13px;
  background: repeating-linear-gradient(0deg, #6b3b4a08 0 1px, transparent 1px 5px), #fff0d3;
  box-shadow: 0 2px #dca07c, 0 6px 0 1px #582b35, 0 10px 24px #29132388;
}
.panel::before, .panel::after { display: none; }
.panel h2 { font: 900 clamp(1.35rem, 3.8vmin, 2.44rem)/1.02 var(--rounded); margin: 0 0 5px; }
.panel p { margin: 0; font: 650 .93rem/1.28 var(--rounded); }
.panel-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.panel-actions button, .panel-actions .primary { min-width: 0; }
.panel button { overflow-wrap: anywhere; border-radius: 6px; }
#game[data-mode="menu"] .panel {
  text-align: center;
  border-inline-color: #a64c5e;
  justify-items: center;
}
#game[data-mode="menu"] .panel-actions { width: min(100%, 360px); }
#game[data-mode="menu"] .panel h2 { color: #6c2d45; }
#game[data-mode="paused"] .panel {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  text-align: start;
  column-gap: 14px;
}
#game[data-mode="paused"] .panel-copy { grid-area: 1 / 1; align-self: center; }
#game[data-mode="paused"] .panel-actions { grid-area: 2 / 1; }
.options {
  grid-area: 1 / 2 / 3;
  align-self: center;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 10px;
  border: 0;
  border-inline-start: 1px solid #a36956;
}
#game[data-mode="won"] .panel, #game[data-mode="over"] .panel {
  top: 65%;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  align-items: center;
  border-inline-width: 1px;
  border-top: 5px solid #963e59;
  border-radius: 8px 8px 3px 3px;
  background-color: #ffe5c7;
}
#game[data-mode="won"] .panel { background-color: #ffd2d4; }
#game[data-mode="over"] .panel-actions, #game[data-mode="won"] .panel-actions { grid-template-columns: 1fr; }

#game .panel[data-library] {
  top: 50%;
  display: block;
  width: min(calc(100% - 22px), 510px);
  max-height: calc(100% - 24px);
  overflow: auto;
  text-align: center;
  border-inline-width: 7px;
  background-color: #fff0d3;
}
.press-tools .puzzle-tool { width: auto; padding-inline: 9px; font-size: .875rem; }
.press-tools [data-act="clue"]:disabled { opacity: .68; }
#puzzle-list { display: grid; gap: 7px; }
.puzzle-tabs, #puzzle-entries, .puzzle-footer {
  display: grid;
  gap: 5px;
}
#puzzle-list button { -webkit-tap-highlight-color: transparent; }
.puzzle-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#puzzle-entries { grid-template-columns: repeat(5, minmax(0, 1fr)); }
#puzzle-entries button {
  min-width: 44px;
  padding-inline: 0;
  font-variant-numeric: tabular-nums;
}
#puzzle-entries button[data-completed], .puzzle-tabs button[aria-pressed="true"] {
  background: #852f44;
  color: #fff2d6;
}
#puzzle-entries button[data-completed]::after { content: " ✓"; }
.puzzle-footer { grid-template-columns: 44px minmax(0, 1fr) 44px; }
.puzzle-footer button:disabled { opacity: .55; box-shadow: none; }

#game.is-fullscreen {
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: max(var(--pad), env(safe-area-inset-top)) max(var(--pad), env(safe-area-inset-right))
    max(var(--pad), env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left));
}
#game.is-viewport-fullscreen { position: fixed; inset: 0; z-index: 20; }
html.press-fullscreen, html.press-fullscreen body { overflow: hidden; overscroll-behavior: none; }
#game.is-fullscreen .press-tools {
  inset-block-start: max(var(--pad), env(safe-area-inset-top));
  inset-inline-end: max(var(--pad), env(safe-area-inset-right));
}

.editorial {
  width: min(calc(100% - 2 * var(--gutter)), 985px);
  color: var(--ink);
}
.editorial-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.12fr);
  align-items: start;
  gap: clamp(12px, 4vw, 58px);
  border-top: 1px solid #b4755580;
  padding: clamp(16px, 3vw, 36px) 0;
}
.editorial-section > div { min-width: 0; }
.editorial-section > div > :last-child { margin-bottom: 0; }
.editorial h1, .editorial h2, .editorial .intro { font-family: var(--rounded); }
.editorial h2 { margin: 0; overflow-wrap: anywhere; hyphens: auto; }
.editorial .intro { font-size: clamp(1.1rem, 1.95vw, 1.4rem); }
.editorial .questions { margin: 0; border-top: 0; }
.editorial .questions details:first-child summary { padding-top: 0; }
.editorial.subpage { padding-top: 0; }
.editorial h1 {
  margin: 0 0 .45em;
  font-size: clamp(1.75rem, 4.2vw, 3.8rem);
  overflow-wrap: anywhere;
}
.editorial .rules-table { max-width: 100%; }
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0;
  border-top: 1px solid #b47555;
  padding: 18px 0 12px;
  gap: 11px;
}
.site-footer .footer-brand {
  display: block;
  width: 100%;
  font: 900 min(15vw, 11rem)/.92 var(--rounded);
  letter-spacing: -.08em;
  text-align: center;
  color: #703548;
}
.site-footer nav { justify-content: center; gap: 0 18px; }

@media (max-width: 780px) {
  :root { --width: calc(100% - 12px); --mast-height: 57px; }
  #game { --pad: 6px; --rim: 5px; --field-gap: 2px; }
  .press-layout {
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-rows: 49px minmax(0, 1fr) 47px 44px;
    grid-template-areas: "meters tools" "rack rack" "tray tray" "controls controls";
    gap: 4px;
  }
  .controls button { min-height: 44px; box-shadow: 0 1px #633427; }
  .tile { font-size: clamp(1.3rem, 8.6cqw, 3.8rem); }
  .panel { width: min(calc(100% - 22px), 490px); }
}
@media (max-width: 480px) {
  #game {
    --press-height: max(450px, min(calc(100dvh - var(--mast-height) - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), calc(100vw + 330px)));
  }
  .mast { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr) minmax(0, 1fr); align-items: center; }
  .mast h1, .mast .brand { white-space: normal; font-size: clamp(1.38rem, 6vw, 1.72rem); letter-spacing: -.055em; }
  .mast > nav { justify-self: stretch; }
  .mast > nav a, .language-menu summary { font-size: .82rem; }
  .language-menu .language-nav { inset-inline: auto 0; }
  .meter { gap: 1px; padding: 3px 2px; font-size: .875rem; line-height: 1; }
  .meter:first-child { container-type: inline-size; }
  .meter strong { font-size: 1.06rem; white-space: nowrap; }
  #score { font-size: clamp(.875rem, 23cqw, 1.18rem); }
  #game[data-mode="paused"] .panel { grid-template-columns: minmax(0, 1fr); }
  #game[data-mode="paused"] .panel-copy, #game[data-mode="paused"] .panel-actions { grid-area: auto; }
  .options { grid-area: auto; border: 0; padding: 0; }
  .editorial { width: calc(100% - 22px); }
  .editorial-section { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .editorial h2 { font-size: 1.25rem; }
  .editorial.subpage h1 { font-size: 1.425rem; hyphens: auto; }
  .editorial .rules-table th, .editorial .rules-table td { padding-inline: .25em; }
}
@media (max-width: 330px) {
  .editorial-section { grid-template-columns: 1fr; }
}
@media (orientation: landscape) and (max-height: 535px) {
  :root { --mast-height: 44px; }
  .mast h1, .mast .brand { font-size: clamp(1.5rem, 4.6vw, 1.9rem); }
  #game { width: var(--width); --pad: 5px; --rim: 3px; --field-gap: 2px; --press-height: max(288px, calc(100dvh - var(--mast-height) - 5px - env(safe-area-inset-top) - env(safe-area-inset-bottom))); }
  .press-layout {
    --tray-size: min(100cqh, calc(100cqw - 258px));
    grid-template-columns: minmax(93px, 1fr) var(--tray-size) minmax(137px, 1fr);
    grid-template-rows: 49px minmax(0, 1fr) 77px;
    grid-template-areas: "meters rack tools" "meters rack controls" "meters rack tray";
    gap: 5px;
  }
  .rack { aspect-ratio: 1; align-self: center; }
  .tile { font-size: clamp(1.15rem, calc(var(--tray-size) / 13), 3.9rem); }
  .readouts { align-self: center; justify-self: end; width: min(100%, 150px); grid-template: repeat(3, minmax(57px, 1fr)) / 1fr; }
  .meter { border: 0; border-bottom: 1px solid #e8b99a39; }
  #game .press-tools, #game.is-fullscreen .press-tools { grid-area: tools; position: static; justify-content: end; }
  .controls { align-self: center; justify-self: center; width: min(100%, 150px); grid-template-columns: 1fr; gap: 4px; padding: 0 4px; }
  .tray { justify-self: center; width: min(100%, 150px); }
  .panel { width: min(calc(var(--tray-size) - 15px), 440px); padding: 10px 11px; gap: 8px; }
  #game .panel[data-library] { width: clamp(280px, var(--tray-size), 440px); }
  #game[data-mode="paused"] .panel { column-gap: 8px; }
  .panel button { padding-inline: 3px; }
  .options { padding-inline-start: 7px; grid-template-columns: 1fr; }
}
