:root {
  color-scheme: dark;
  --bg: #151b1b;
  --surface: #232b29;
  --paper: #f4efdd;
  --muted: #acb4a9;
  --dim: #87928a;
  --gold: #f5c264;
  --line: #3b4540;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
  --sans: 'DM Sans', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --serif: 'Songti SC', 'STSong', 'Noto Serif CJK SC', serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 18% -35%, #25312f, transparent 57%),
    var(--bg);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 12px;
}
button, a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}
button {
  border: 0;
  background: none;
}
button, dialog {
  touch-action: manipulation;
}
.ico {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.wrap {
  max-width: 1440px;
  width: calc(100% - clamp(40px, 9.4vw, 152px));
  margin: auto;
}
.mast {
  border-bottom: 1px solid var(--line);
  background: #161d1cea;
}
.mast-inner {
  height: 66px;
  display: flex;
  align-items: center;
}
.mast nav {
  align-self: stretch;
  display: flex;
  gap: 32px;
  align-items: stretch;
  margin-right: auto;
}
.mast nav > * {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 1px 0;
  color: #b1bbb2;
  font-size: 13px;
  position: relative;
  letter-spacing: 0.5px;
}
.mast nav .nav-current {
  color: var(--gold);
}
.nav-current:after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gold);
}
.mast-tools, .step-nav, .rail-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mast-tools {
  border-left: 1px solid var(--line);
  padding-left: 23px;
}
.icon-button, .micro-button, .tool, .glass-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  color: #d2d8ce;
  border-radius: 7px;
}
.icon-button {
  width: 35px;
  height: 35px;
  background: #242c29;
}
.icon-button .ico {
  width: 17px;
  height: 17px;
}
#music { position: relative; }
#music[aria-pressed='true'] { color: var(--gold); }
#music[aria-pressed='false']::after {
  position: absolute;
  content: '';
  width: 65%;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -1px #242c29;
  transform: rotate(45deg);
}
.icon-button:hover, .micro-button:not(:disabled):hover, .tool:not(:disabled):hover {
  background: #354037;
  color: #ffdf9b;
  border-color: #78816c;
}
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: clamp(24px, 3vw, 43px) 0 24px;
}
.title-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.title-line {
  display: flex;
  align-items: center;
  gap: 18px;
}
.game-subtitle {
  margin: 0 0 0 2px;
  color: #e7c47b;
  font: 600 14px/1.35 var(--serif);
  letter-spacing: .13em;
  text-shadow: 0 1px 0 #0003;
}
.game-subtitle span {
  margin-left: 10px;
  color: #95a68e;
  font: 9px/1.2 var(--mono);
  letter-spacing: 1.5px;
  vertical-align: 1px;
}
.title-lockup h1 {
  margin: 0;
  font-size: clamp(42px, 4.3vw, 70px);
  line-height: 1.14;
  font-weight: 850;
  letter-spacing: -0.065em;
  text-shadow: 0 2px 0 #0004;
}
.english-title {
  font: 700 clamp(11px, 1vw, 15px)/1.12 var(--mono);
  color: var(--gold);
  letter-spacing: 1.9px;
  border-left: 1px solid #647066;
  padding: 1px 0 1px 15px;
}
.total-progress {
  width: 157px;
  align-self: flex-end;
  padding-bottom: 5px;
}
.total-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 9px;
  align-items: center;
}
.total-progress span {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
  color: #c0c8bd;
  font-size: 12px;
}
.total-progress .ico {
  color: var(--gold);
  width: 15px;
  height: 15px;
}
.total-progress strong {
  white-space: nowrap;
  font: 600 14px var(--mono);
  color: var(--gold);
}
.total-progress em {
  font-style: normal;
  color: #a0aaa1;
  font-size: 11px;
}
.progress-track {
  margin-top: 9px;
  height: 5px;
  display: flex;
  gap: 3px;
}
.progress-track i {
  flex: 1;
  background: #38433c;
  border-radius: 1px;
  overflow: hidden;
}
.progress-track b {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
}
.stage {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  min-width: 0;
  background: #202927;
  border: 1px solid #4a534b;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 32px #070d0c38;
}
.art-pane {
  position: relative;
  min-width: 0;
  isolation: isolate;
  background-color: #223130;
  background-image: var(--painting);
  background-position: var(--focus, 50% 50%);
  background-size: cover;
}
.art-pane:after {
  position: absolute;
  inset: 0;
  content: '';
  background: linear-gradient(to top, #071013f5 0%, #091317ab 11%, #0d19201a 35%, transparent 53%);
  z-index: -1;
}
.art-caption {
  position: absolute;
  bottom: clamp(22px, 2.55vw, 39px);
  left: clamp(22px, 2.65vw, 40px);
  right: clamp(22px, 2.65vw, 40px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  color: #fff4d6;
  text-shadow: 0 1px 6px #0008;
}
.art-caption h2 {
  margin: 0;
  font: 650 clamp(25px, 2.35vw, 40px)/1.15 var(--serif);
  letter-spacing: 1px;
}
.glass-button {
  width: 37px;
  height: 37px;
  background: #141c19a8;
  border: 1px solid #f7edc65c;
  color: #f9efd5;
  backdrop-filter: blur(5px);
}
.glass-button:hover {
  background: #303b30;
}
.console {
  min-width: 0;
  padding: clamp(22px, 2.45vw, 37px);
  border-left: 1px solid #606954;
  background: linear-gradient(120deg, #29322e 0%, #202725 95%);
  display: flex;
  flex-direction: column;
}
.console-head {
  display: contents;
}
.opening-line, .night-brief p.opening-line {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 7px 13px;
  min-height: 42px;
  align-content: center;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #9a9c7b;
  border-radius: 6px;
  background: #23312a;
  color: #f2d79b;
  font: 500 clamp(14px, 1.25vw, 18px)/1.45 var(--serif);
  text-shadow: none;
}
.scratch-text { visibility: hidden; }
.opening-line:is(.scratching,.scratched) .scratch-text { visibility: visible; }
.scratch-cover, .scratch-cover canvas, .scratch-label { position: absolute; inset: 0; width: 100%; height: 100%; }
.scratch-cover { padding: 0; border: 0; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.scratch-cover:focus-visible { outline: 2px solid #fff1b8; outline-offset: -3px; z-index: 1; }
.scratch-cover canvas, .scratch-label { pointer-events: none; }
.scratch-label { display: grid; place-items: center; color: #28342c; font: 650 14px/1 var(--sans); }
.opening-line:not(.scratching) .scratch-cover { background: #b5bea9; }
.opening-line.scratching .scratch-label { visibility: hidden; }
.mode-rules { margin: 6px 0 10px; font-size: 13px; color: #d4ddcd; }
.mode-rules summary { width: fit-content; cursor: pointer; }
#status-line[hidden] { display: none; }
#status-line[hidden] + .controls { margin-top: 10px; }
.console-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.level-code {
  font: 700 12px/1 var(--mono);
  white-space: nowrap;
  letter-spacing: 1px;
  color: var(--gold);
  background: #37382c;
  border: 1px solid #686044;
  border-radius: 4px;
  padding: 6px 8px;
}
.chapter-label {
  font-size: 12px;
  color: #c0c8bc;
  letter-spacing: 0.9px;
}
.step-nav {
  margin-left: auto;
  gap: 4px;
}
.micro-button {
  width: 28px;
  height: 28px;
  background: #222a26;
  border-radius: 5px;
}
.micro-button .ico {
  width: 16px;
  height: 16px;
}
.micro-button:disabled, .tool:disabled {
  opacity: 0.36;
}
.puzzle-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 14px 0 17px;
}
.puzzle-heading h2 {
  margin: 0;
  font-size: clamp(25px, 2.15vw, 36px);
  line-height: 1.18;
  letter-spacing: 0.02em;
}
.board-size {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a3afa4;
  font: 11px var(--mono);
}
.board-size .ico {
  width: 12px;
  height: 12px;
}
.screen {
  height: clamp(184px, 15.25vw, 231px);
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  container-type: size;
  border: 1px solid #48574c;
  border-radius: 8px;
  background: #192322;
  box-shadow: inset 0 2px 12px #05100e70;
  overflow: hidden;
}
.screen:before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(#b3c3a833 0.8px, transparent 1px),
    linear-gradient(#13201ee8, #172220f2),
    var(--painting);
  background-size: 10px 10px, cover, cover;
  background-position: center, center, var(--focus, center);
}
.sight {
  position: absolute;
  width: 9px;
  height: 9px;
  opacity: 0.66;
  border-color: #91a28b;
  border-style: solid;
  pointer-events: none;
}
.tl {
  left: 10px;
  top: 10px;
  border-width: 1px 0 0 1px;
}
.tr {
  right: 10px;
  top: 10px;
  border-width: 1px 1px 0 0;
}
.bl {
  left: 10px;
  bottom: 10px;
  border-width: 0 0 1px 1px;
}
.br {
  right: 10px;
  bottom: 10px;
  border-width: 0 1px 1px 0;
}
.board {
  --gap: 6px;
  --cell: min(
    var(--tile-limit, 55px),
    calc((100cqw - 40px - (var(--cols) - 1) * var(--gap)) / var(--cols)),
    calc((100cqh - var(--board-inset-y, 32px) - (var(--rows) - 1) * var(--gap)) / var(--rows))
  );
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-template-rows: repeat(var(--rows), var(--cell));
  gap: var(--gap);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tile {
  --face: #e4e9d9;
  --top: #fbfbea;
  --rim: #a7afa0;
  --ink: #586452;
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: linear-gradient(145deg, var(--top), var(--face) 68%);
  color: var(--ink);
  border-radius: 5px;
  border: 1px solid var(--rim);
  box-shadow: inset 0 1px 0 #ffffebae, inset 0 -3px 0 var(--rim), 0 3px 0 #0c1413;
  display: grid;
  place-items: center;
  touch-action: none;
  transition: background-color 0.12s, filter 0.12s, transform 0.12s;
}
.tile[data-value='1'] {
  --face: #edaa35;
  --top: #ffdb7b;
  --rim: #bd883e;
  --ink: #62451c;
}
.tile[data-value='2'] {
  --face: #52c2c2;
  --top: #b5eeea;
  --rim: #478e99;
  --ink: #234c59;
}
.tile[data-value='3'] {
  --face: #6d4934;
  --top: #a97553;
  --rim: #4b3022;
  --ink: #f4e2bd;
}
@media (hover: hover) {
  .screen:not(.won) .tile:not([data-fixed]):hover {
    filter: brightness(1.08);
    outline: 2px solid #fff7ca;
    outline-offset: 1px;
  }
}
.tile:focus-visible {
  outline: 2px solid #f6e6a4;
  outline-offset: 3px;
  z-index: 2;
}
.tile[data-fixed] {
  cursor: not-allowed;
  border-color: var(--ink);
  border-radius: 2px;
}
.tile[data-fixed]::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 13%;
  min-height: 3px;
  background: repeating-linear-gradient(130deg, var(--ink) 0 3px, var(--top) 3px 5px);
  border-top: 1px solid var(--ink);
  pointer-events: none;
}
.tile-lock {
  display: grid;
  place-items: center;
  position: absolute;
  z-index: 1;
  right: 0;
  bottom: 0;
  width: 32%;
  height: 32%;
  min-width: 9px;
  min-height: 9px;
  color: #fff8dc;
  background: #24322d;
  border-radius: 35% 0 0 0;
  pointer-events: none;
}
.tile-lock .ico {
  width: 85%;
  height: 85%;
  stroke-width: 2.6;
}
.tile[data-fixed] .tile-symbol {
  width: 56%;
  height: 56%;
  transform: translate(-5%, -8%);
}
.tile-symbol {
  width: 62%;
  height: 62%;
  fill: currentColor;
  display: block;
  pointer-events: none;
}
.player-lock {
  display: none;
  place-items: center;
  position: absolute;
  z-index: 1;
  top: 0;
  left: 0;
  width: 34%;
  height: 34%;
  min-width: 9px;
  min-height: 9px;
  color: #ffe7a5;
  background: #493319;
  border-radius: 3px 0 40% 0;
  pointer-events: none;
}
.player-lock .ico {
  width: 84%;
  height: 84%;
  stroke-width: 2.7;
}
.tile.player-locked {
  border-color: #785a2c;
  box-shadow: inset 0 0 0 1px #ffe4a2, inset 0 -3px 0 var(--rim), 0 3px 0 #0c1413;
}
.tile.player-locked .player-lock {
  display: grid;
}
.tile.player-locked .tile-symbol {
  width: 56%;
  height: 56%;
  transform: translate(6%, 6%);
}
.tile.error {
  outline: 2px solid #ff8d75;
  outline-offset: 1px;
  color: #a93326;
  animation: shake 0.23s ease-in-out 2;
}
.edge {
  position: absolute;
  width: 0;
  height: 0;
  border: 4px solid transparent;
  pointer-events: none;
}
.edge.u {
  top: -6px;
  border-top: 0;
  border-bottom-color: var(--rim);
}
.edge.d {
  bottom: -6px;
  border-bottom: 0;
  border-top-color: var(--rim);
}
.edge.l {
  left: -6px;
  border-left: 0;
  border-right-color: var(--rim);
}
.edge.r {
  right: -6px;
  border-right: 0;
  border-left-color: var(--rim);
}
.screen.won {
  border-color: #a29a63;
}
.screen.won .tile {
  filter: brightness(1.035);
}
.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 23px;
  margin: 13px 0 14px;
  font-size: 12px;
  line-height: 1.55;
  color: #cbd1c0;
}
.status-line > .ico {
  color: var(--gold);
  width: 15px;
  height: 15px;
}
.status-line.bad, .status-line.bad > .ico {
  color: #ffab93;
}
.status-line.bad {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 3px 8px;
}
#status-reason {
  grid-column: 2 / -1;
  grid-row: 2;
  color: #fff0e4;
  overflow-wrap: anywhere;
}
#status-reason strong { color: #ffb49a; }
.status-line.good, .status-line.good > .ico {
  color: #d5e7aa;
}
.controls {
  display: flex;
  gap: 9px;
  align-items: stretch;
}
.primary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #332c1b;
  background: linear-gradient(115deg, #ffda8a, #f4bf5d);
  border: 1px solid #fcdc97;
  border-radius: 6px;
  min-height: 43px;
  padding: 0 10px;
  font-size: 15px;
  font-weight: 750;
  box-shadow: 0 2px 0 #9a743c;
}
.primary:hover {
  filter: brightness(1.065);
}
.primary:active, .tool:active {
  transform: translateY(1px);
}
kbd {
  font: 10px var(--mono), var(--sans);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 2px 4px;
}
.primary kbd {
  margin-left: 3px;
  color: #675431;
  border-color: #9b7e45;
  font-size: 10px;
}
.tool {
  flex: none;
  width: 44px;
  background: #2c3530;
  border-color: #525d51;
  border-radius: 6px;
}
.tool .ico {
  width: 17px;
  height: 17px;
}
.exhibitions {
  margin-top: clamp(24px, 2.8vw, 41px);
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title h2 {
  margin: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 21px;
  letter-spacing: 0.025em;
}
.section-title h2 .ico {
  color: var(--gold);
  width: 20px;
  height: 20px;
}
.rail-control {
  gap: 6px;
}
.rail-control > span {
  font: 10px var(--mono);
  letter-spacing: 1px;
  color: var(--dim);
  margin-right: 6px;
}
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 36px) / 4);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 2px 1px 4px;
}
.rail::-webkit-scrollbar {
  display: none;
}
.exhibit {
  display: flex;
  align-items: stretch;
  text-align: left;
  padding: 0;
  border: 1px solid #424d45;
  background: #202824;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  height: 92px;
  min-width: 0;
  scroll-snap-align: start;
}
.exhibit:hover {
  background: #2c352f;
  border-color: #8a927c;
}
.exhibit.active {
  border-color: #c7a35b;
  background: #30332a;
  box-shadow: inset 0 0 0 1px #9a7c4130;
}
.exhibit img {
  width: 33%;
  height: 100%;
  object-fit: cover;
  flex: none;
}
.exhibit-copy {
  padding: 13px 11px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
}
.exhibit-copy small {
  color: #aeb9a8;
  font: 10px/1 var(--mono);
  letter-spacing: 1.4px;
}
.exhibit.active small, .exhibit.active .exhibit-state {
  color: var(--gold);
}
.exhibit-copy strong {
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.exhibit-state {
  position: absolute;
  right: 8px;
  top: 9px;
  color: #9ba799;
  display: flex;
}
.exhibit-state .ico {
  width: 12px;
  height: 12px;
}
.exhibit-state .on-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 6px #efbb5880;
}
footer {
  border-top: 1px solid #333c36;
  margin: 24px 0 0;
  padding: 16px 0 24px;
  color: #9ca89c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
}
footer > span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.save-dot {
  width: 5px;
  height: 5px;
  background: #a0ba91;
  border-radius: 50%;
}
dialog {
  width: min(610px, calc(100% - 32px));
  max-height: calc(100% - 44px);
  padding: 0;
  background: #232c28;
  color: var(--paper);
  border: 1px solid #586453;
  border-radius: 13px;
  box-shadow: 0 22px 90px #050909a8;
  overflow: auto;
}
dialog::backdrop {
  background: #07100ed9;
  backdrop-filter: blur(5px);
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #242e28;
  border-bottom: 1px solid var(--line);
  padding: 16px 22px;
}
.dialog-head h2 {
  font-size: 20px;
  margin: 0;
}
.dialog-heading { display: flex; align-items: center; gap: 3px; }
#catalog-mascot {
  width: 44px;
  height: 44px;
  margin-block: -5px;
  padding: 2px;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#catalog-mascot img {
  display: block;
  width: auto;
  height: 100%;
  margin: auto;
  pointer-events: none;
}
#catalog-mascot:active img { transform: translateY(1px) scale(.93); }
.dialog-head button {
  flex: none;
}
#dialog-body {
  padding: 20px 22px 24px;
}
.chap-tabs {
  display: grid;
  grid-template-columns: repeat(var(--hall-count), minmax(0, 1fr));
  gap: 5px;
  margin: 0 0 16px;
}
.chap-tabs button {
  min-width: 0;
  padding: 7px 0;
  border: 1px solid #4a554c;
  border-radius: 4px;
  color: #bcc5b8;
  font: 13px var(--sans);
  white-space: nowrap;
}
.chap-tabs button[aria-pressed='true'] {
  background: #e6bc67;
  color: #282b21;
  border-color: #ebc777;
}
.catalog-art {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.catalog-art img {
  border-radius: 5px;
  width: 86px;
  height: 59px;
  object-fit: cover;
}
.help-label {
  color: var(--gold);
  font: 10px var(--mono);
  letter-spacing: 1.1px;
}
.catalog-art h3 {
  margin: 0;
  font-size: 22px;
}
.catalog-art button {
  margin-left: auto;
  color: #e8ce91;
  font-size: 12px;
}
.catalog-art button:hover {
  text-decoration: underline;
}
.catalog-note, .help-intro, .completion p {
  font-size: 13px;
  line-height: 1.65;
  color: #c6cfbf;
}
.catalog-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.catalog-level {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 41px;
  padding: 8px 11px;
  background: #29342d;
  border: 1px solid #53604f;
  border-radius: 5px;
  text-align: left;
  font-size: 13px;
}
.catalog-level small {
  font: 11px var(--mono);
  color: #eac776;
}
.catalog-level .ico {
  margin-left: auto;
  width: 14px;
  height: 14px;
}
.catalog-level:disabled {
  color: #9ca79a;
  border-color: #3a463d;
  background: #222b26;
}
.catalog-level:disabled small {
  color: #9ca79a;
}
.catalog-level.current {
  border-color: var(--gold);
}
.dialog-art {
  width: min(1000px, calc(100% - 28px));
}
.dialog-art #dialog-body {
  padding: 0;
}
.full-art {
  display: block;
  width: 100%;
  height: min(71vh, 690px);
  background: #101714;
  object-fit: contain;
}
.art-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  color: #cdd4c6;
  font-size: 12px;
}
.art-foot button, .inline-button {
  border: 1px solid #66725f;
  border-radius: 5px;
  padding: 6px 12px;
  color: #f3ce85;
  font-size: 12px;
}
.help-intro {
  margin: 0 0 16px;
}
.help-list {
  display: grid;
  gap: 8px;
}
.help-rule {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #424f44;
  background: #26312b;
  border-radius: 6px;
}
.help-rule .sample {
  background: #eac373;
  flex: none;
  width: 32px;
  height: 32px;
  color: #544321;
  display: grid;
  place-items: center;
  border-radius: 4px;
}
.help-rule strong {
  font-size: 13px;
}
.help-rule p {
  font-size: 12px;
  line-height: 1.6;
  color: #bfc9ba;
  margin: 2px 0 0;
}
.help-label {
  display: block;
  margin: 19px 0 8px;
  font-size: 12px;
}
.help-details {
  color: #bec8bc;
  font-size: 12px;
  line-height: 1.8;
}
.help-details kbd {
  color: #e2d8b4;
  margin-right: 3px;
}
.help-details summary {
  cursor: pointer;
  color: #e6dcae;
}
.completion {
  text-align: center;
  padding: 15px 8px;
}
.completion > img {
  width: 64px;
  image-rendering: pixelated;
}
.completion h3 {
  margin: 13px 0 5px;
  font-size: 24px;
}
.completion .primary {
  margin: 16px auto 0;
  padding: 0 22px;
}
.rail button:focus-visible {
  outline-offset: -3px;
}
.art-foot button:hover, .inline-button:hover {
  background: #394434;
}
body.modal-open {
  overflow: hidden;
}
@keyframes shake {
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}
@media (min-width: 1550px) {
  .screen {
    height: 245px;
  }
  .exhibit {
    height: 100px;
  }
}
@media (max-width: 1050px) {
  .wrap {
    width: calc(100% - 48px);
  }
  .stage {
    grid-template-columns: 1fr 1.07fr;
  }
  .console {
    padding: 22px;
  }
  .exhibit-copy {
    padding: 11px 8px;
  }
  .exhibit-copy strong {
    font-size: 14px;
  }
  .exhibit {
    height: 78px;
  }
  .controls {
    gap: 7px;
  }
  .tool {
    width: 39px;
  }
  .rail {
    grid-auto-columns: calc((100% - 24px) / 3);
  }
}
@media (max-width: 760px) {
  .wrap {
    width: calc(100% - 32px);
  }
  .mast-inner {
    height: 56px;
  }
  .mast nav {
    gap: 16px;
  }
  .mast nav > * {
    font-size: 12px;
    gap: 5px;
  }
  .mast-tools {
    padding-left: 13px;
    gap: 6px;
  }
  .title-row {
    margin: 22px 0 16px;
  }
  .title-lockup {
    gap: 4px;
  }
  .title-line {
    gap: 12px;
  }
  .title-lockup h1 {
    font-size: 43px;
  }
  .game-subtitle {
    font-size: 12px;
    letter-spacing: .1em;
  }
  .game-subtitle span {
    display: none;
  }
  .english-title {
    font-size: 10px;
    padding-left: 10px;
    letter-spacing: 1.2px;
  }
  .stage {
    grid-template-columns: 1fr;
  }
  .art-pane {
    height: clamp(150px, 29vw, 220px);
    background-position: var(--mobile-focus, 50% 34%);
  }
  .art-pane:after {
    background: linear-gradient(0deg, #091210d9, transparent 60%);
  }
  .art-caption {
    bottom: 15px;
    left: 20px;
    right: 19px;
  }
  .art-caption h2 {
    font-size: 24px;
  }
  .console {
    padding: 17px 19px 21px;
    border-left: 0;
    border-top: 1px solid #586050;
  }
  .chapter-label {
    font-size: 11px;
  }
  .puzzle-heading {
    margin: 9px 0 12px;
  }
  .puzzle-heading h2 {
    font-size: 25px;
  }
  .screen {
    height: 175px;
  }
  .total-progress {
    width: 120px;
  }
  .primary {
    min-height: 42px;
  }
  .tool {
    width: 43px;
  }
  .status-line {
    margin: 10px 0;
    font-size: 12px;
  }
  .exhibitions {
    margin-top: 23px;
  }
  .section-title {
    margin-bottom: 12px;
  }
  .section-title h2 {
    font-size: 18px;
  }
  .rail {
    grid-auto-columns: calc((100% - 18px) / 2.5);
    gap: 9px;
  }
  .exhibit {
    height: 75px;
  }
  .glass-button {
    width: 32px;
    height: 32px;
  }
  .section-title h2 .ico {
    width: 17px;
  }
  .total-progress {
    align-self: center;
    padding-bottom: 0;
  }
  footer {
    margin-top: 17px;
  }
}
@media (max-width: 510px) {
  .mast nav button {
    font-size: 12px;
  }
  .mast-tools {
    padding-left: 8px;
  }
  .icon-button {
    width: 31px;
    height: 31px;
  }
  .total-progress {
    width: 111px;
  }
  .total-progress span {
    font-size: 10px;
    gap: 4px;
  }
  .total-progress .ico {
    width: 12px;
    height: 12px;
  }
  .total-progress strong {
    font-size: 11px;
  }
  .total-progress em {
    font-size: 9px;
  }
  .progress-track {
    margin-top: 6px;
    gap: 2px;
  }
  .title-lockup h1 {
    font-size: 37px;
  }
  .english-title {
    font-size: 8px;
    letter-spacing: 0.8px;
  }
  .title-lockup {
    gap: 3px;
  }
  .title-line {
    gap: 9px;
  }
  .game-subtitle {
    font-size: 12px;
  }
  .title-row {
    gap: 8px;
    margin: 18px 0 14px;
  }
  .rail {
    grid-auto-columns: calc((100% - 8px) / 1.82);
  }
  .exhibit-copy strong {
    font-size: 14px;
  }
  .exhibit img {
    width: 34%;
  }
  .exhibit-state {
    right: 6px;
    top: 6px;
  }
  .exhibit-copy small {
    font-size: 9px;
  }
  .console-meta {
    gap: 8px;
  }
  .level-code {
    font-size: 10px;
  }
  .screen {
    height: 161px;
  }
  .board {
    --gap: 5px;
  }
  .console {
    padding: 15px 14px 17px;
  }
  .controls {
    gap: 6px;
  }
  .status-line {
    min-height: 25px;
  }
  .puzzle-heading h2 {
    font-size: 23px;
  }
  .stage {
    border-radius: 11px;
  }
  .tool {
    width: 38px;
  }
  .art-pane {
    height: 148px;
  }
  .primary kbd {
    display: none;
  }
  .dialog-head {
    padding: 12px 14px;
  }
  #dialog-body {
    padding: 15px;
  }
  .catalog-list {
    grid-template-columns: 1fr;
  }
  .rail-control > span {
    font-size: 9px;
  }
  .art-foot {
    padding: 9px 12px;
  }
}
@media (max-width: 350px) {
  .wrap {
    width: calc(100% - 22px);
  }
  .english-title {
    display: none;
  }
  .title-lockup h1 {
    font-size: 33px;
  }
  .mast-tools {
    border: 0;
  }
  .tool {
    width: 34px;
  }
  .chapter-label {
    letter-spacing: 0;
  }
  .rail {
    grid-auto-columns: 70%;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *:before, *:after {
    animation: none !important;
    transition: none !important;
  }
}

/* Keep the game controls in view inside the Toy player's short landscape frame. */
@media (min-width: 470px) and (max-height: 720px) {
  :is(.toy-player, .toy-container) .wrap { width: calc(100% - clamp(22px, 5vw, 64px)); }
  :is(.toy-player, .toy-container) .mast-inner { height: 42px; }
  :is(.toy-player, .toy-container) .title-row { margin: 9px 0; }
  :is(.toy-player, .toy-container) .title-lockup h1 { font-size: clamp(25px, 3.1vw, 39px); }
  :is(.toy-player, .toy-container) .english-title { font-size: 9px; }
  :is(.toy-player, .toy-container) .stage { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); }
  :is(.toy-player, .toy-container) .art-pane { height: auto; min-height: 0; }
  :is(.toy-player, .toy-container) .art-caption { left: 16px; right: 16px; bottom: 15px; }
  :is(.toy-player, .toy-container) .art-caption h2 { font-size: clamp(18px, 2.3vw, 29px); }
  :is(.toy-player, .toy-container) .console { padding: clamp(9px, 2vh, 18px) clamp(10px, 1.6vw, 22px); border-top: 0; border-left: 1px solid var(--line); }
  :is(.toy-player, .toy-container) .console-meta { gap: 7px; }
  :is(.toy-player, .toy-container) .level-code { padding: 4px 6px; font-size: 10px; }
  :is(.toy-player, .toy-container) .chapter-label { font-size: 11px; letter-spacing: 0; }
  :is(.toy-player, .toy-container) .puzzle-heading { margin: 5px 0 8px; }
  :is(.toy-player, .toy-container) .puzzle-heading h2 { font-size: clamp(18px, 2.1vw, 26px); }
  :is(.toy-player, .toy-container) .screen { height: clamp(98px, calc(var(--toy-height, 100vh) - 275px), 220px); }
  :is(.toy-player, .toy-container) .status-line { min-height: 19px; margin: 6px 0; font-size: 11px; }
  :is(.toy-player, .toy-container) .primary { min-height: 34px; font-size: 13px; }
  :is(.toy-player, .toy-container) .controls { gap: 5px; }
  :is(.toy-player, .toy-container) .tool { width: 31px; }
  :is(.toy-player, .toy-container) .exhibitions { margin-top: 17px; }
}
@media (max-width: 469px) and (max-height: 740px) {
  :is(.toy-player, .toy-container) .mast-inner { height: 42px; }
  :is(.toy-player, .toy-container) .title-row { margin: 7px 0; }
  :is(.toy-player, .toy-container) .title-lockup h1 { font-size: 28px; }
  :is(.toy-player, .toy-container) .art-pane { height: clamp(44px, calc(var(--toy-height, 100vh) - 441px), 131px); }
  :is(.toy-player, .toy-container) .art-caption { bottom: 6px; left: 12px; right: 12px; }
  :is(.toy-player, .toy-container) .art-caption h2 { font-size: 18px; }
  :is(.toy-player, .toy-container) .console { padding: 10px; }
  :is(.toy-player, .toy-container) .screen { height: clamp(102px, calc(var(--toy-height, 100vh) - 325px), 171px); }
  :is(.toy-player, .toy-container) .status-line { margin: 6px 0; }
}
@media (min-width: 470px) and (max-height: 360px) {
  :is(.toy-player, .toy-container) .mast-inner { height: 35px; }
  :is(.toy-player, .toy-container) .title-row { margin: 3px 0; }
  :is(.toy-player, .toy-container) .total-progress { padding-bottom: 0; }
  :is(.toy-player, .toy-container) .status-line { margin: 4px 0; }
}

/* A mouse-sized player uses one painted surface. The HUD takes two rows so the
   board gets the remaining height, including in Bilibili's shallow PC preview. */
@media (min-width: 700px) and (hover: hover) and (pointer: fine) {
  :root {
    --desk-mast: clamp(38px, 7vh, 65px);
    --desk-title: clamp(42px, 11vh, 99px);
  }
  :root .wrap {
    max-width: 1660px;
    width: calc(100% - clamp(32px, 6.4vw, 124px));
  }
  :root .mast-inner { height: var(--desk-mast); }
  :root .title-row { height: var(--desk-title); margin: 0; }
  :root .title-lockup h1 { font-size: clamp(29px, min(4.2vw, 6.3vh), 65px); }
  :root .total-progress { align-self: center; padding-bottom: 0; }
  #stage {
    --pad-x: clamp(15px, 2.1vw, 34px);
    --pad-y: clamp(8px, 2vh, 23px);
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: 'heading heading' 'board artwork' 'hint controls';
    gap: clamp(5px, 1.3vh, 13px) clamp(12px, 2vw, 36px);
    height: clamp(190px, calc(var(--toy-height, 100dvh) - var(--desk-mast) - var(--desk-title) - 18px), 630px);
    padding: var(--pad-y) var(--pad-x);
    isolation: isolate;
    background-color: #22312b;
    background-image:
      linear-gradient(0deg, #07100ffa 0%, #091514bb 9%, transparent 32%, transparent 80%, #0b1418c9 100%),
      linear-gradient(90deg, #091519b3, #0d1d2280 35%, #10212419 62%, transparent 80%),
      var(--painting);
    background-size: cover;
    background-position: center, center, var(--mobile-focus, center);
  }
  #stage .console, #stage .art-pane, #stage .console-meta, #stage .puzzle-heading { display: contents; }
  #stage .art-pane::after, #stage .screen::before { content: none; }
  #stage .console-head {
    grid-area: heading;
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    grid-template-areas: 'code name chapter size nav';
    gap: clamp(8px, 1.1vw, 18px);
    row-gap: 3px;
    align-items: center;
    text-shadow: 0 1px 6px #091312, 0 1px 2px #000;
  }
  #stage .opening-line { grid-column: 1 / -1; grid-row: 2; margin: 0; }
  #stage #status-line[hidden] + .controls { margin-top: 0; }
  #stage .level-code { grid-area: code; font-size: clamp(12px, 1vw, 16px); padding: 6px 8px; }
  #stage .puzzle-heading h2 { grid-area: name; font-size: clamp(23px, 2.3vw, 40px); }
  #stage .chapter-label { grid-area: chapter; font-size: clamp(12px, 1.05vw, 16px); color: #eff1df; }
  #stage .board-size { grid-area: size; color: #f8f2d8; font-size: 13px; }
  #stage .step-nav { grid-area: nav; }
  #stage .micro-button { width: clamp(30px, 2.45vw, 39px); height: clamp(30px, 2.45vw, 39px); }
  #stage .screen {
    grid-area: board;
    align-self: stretch;
    height: auto;
    min-height: 0;
    background: linear-gradient(110deg, #101c2045, #101c2024);
    border: 1px solid #e0e9ce40;
    box-shadow: none;
    border-radius: 9px;
  }
  #stage .screen.won { border-color: #efd287bf; }
  #stage .sight { border-color: #f7edc5; }
  #stage .board {
    --tile-limit: clamp(82px, 9vw, 112px);
    --board-inset-y: 16px;
    --gap: clamp(6px, .65vw, 10px);
  }
  #stage .tile { border-radius: 7px; box-shadow: inset 0 1px 0 #ffffebc0, inset 0 -4px 0 var(--rim), 0 3px 0 #0b1515, 0 5px 10px #080f1466; }
  #stage .tile[data-fixed] { border-radius: 2px; border-color: var(--ink); }
  #stage .art-caption {
    grid-area: artwork;
    position: static;
    align-self: end;
    align-items: end;
    margin: 0 0 4px;
    text-shadow: 0 2px 8px #050e10, 0 1px 3px #000;
  }
  #stage .art-caption h2 { font-size: clamp(22px, 2.1vw, 34px); }
  #stage .status-line {
    grid-area: hint;
    align-self: center;
    margin: 0;
    color: #f3f1df;
    font-size: clamp(12px, 1.1vw, 17px);
    text-shadow: 0 1px 3px #061112;
  }
  #stage .status-line.bad { color: #ffbda9; }
  #stage .status-line.good { color: #d8efb9; }
  #stage .controls { grid-area: controls; gap: clamp(5px, .65vw, 11px); }
  #stage .primary { min-height: clamp(35px, 5.5vh, 56px); font-size: clamp(14px, 1.2vw, 19px); }
  #stage .tool { width: clamp(34px, 3.4vw, 53px); }
  #stage .tool .ico { width: 1.2em; height: 1.2em; }
}

.dialog-overview { width: min(880px, calc(100% - 28px)); }
.overview-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 5px;
  margin-bottom: 14px;
  border: 1px solid #485647;
  border-radius: 9px;
  background: #1b241f;
}
.overview-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #bcc8b6;
  font: 600 13px/1.2 var(--sans);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.overview-tabs button .ico { width: 15px; height: 15px; flex: none; }
.overview-tabs button em {
  font-style: normal;
  font: 600 11px var(--mono);
  padding: 2px 6px;
  border-radius: 999px;
  background: #2b372f;
  color: #b7c6b0;
}
.overview-tabs button:hover { color: #f0edd8; background: #26312b; }
.overview-tabs button[aria-selected='true'] {
  color: #24271e;
  background: #e4bd70;
  border-color: #f1d496;
}
.overview-tabs button[aria-selected='true'] em {
  background: #24271e1f;
  color: #2b271a;
}
.pack-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-bottom: 16px;
}
.pack-tabs button {
  display: grid;
  gap: 3px;
  text-align: left;
  border: 1px solid #4d5b4c;
  border-radius: 7px;
  padding: 8px 11px;
  background: #28332c;
  color: #d8e1d2;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.pack-tabs button:hover { border-color: #8f9b7d; background: #303d34; }
.pack-tab-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.pack-tab-head strong { font: 600 13px var(--sans); }
.pack-tab-head em { font-style: normal; font: 600 11px var(--mono); color: #aab8a3; }
.pack-tabs button small { font-size: 11px; color: #96a590; }
.pack-tabs button[aria-pressed='true'] {
  color: #242820;
  background: #e4bd70;
  border-color: #f0d598;
}
.pack-tabs button[aria-pressed='true'] .pack-tab-head em,
.pack-tabs button[aria-pressed='true'] small { color: #3d3623; }
.back-overview {
  border: 1px solid #53604f; border-radius: 5px; padding: 7px 10px; color: #d3ddce; font-size: 13px;
  margin-bottom: 14px;
}
.level-matrix { display: grid; gap: 7px; }
.level-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px; align-items: start; }
.level-numbers { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 5px; }
.bonus-levels .level-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bonus-levels .level-number { font-family: var(--sans); }
.room-name { min-height: 34px; padding: 0; color: var(--gold); font: 600 14px var(--sans); white-space: nowrap; }
.room-name:hover { text-decoration: underline; }
.level-number { min-height: 34px; font: 14px var(--mono); }
.level-number {
  position: relative; border: 1px solid #65735f; border-radius: 4px; color: #f0efdd; background: #334038; padding: 0;
}
.level-number.current { border: 2px solid var(--gold); }
.level-number:disabled { border-color: #424e45; color: #a2ad9d; background: #27312b; }
.level-number:not(:disabled):hover { background: #465247; }
.level-number .ico { position: absolute; width: 10px; height: 10px; right: 1px; bottom: 1px; color: #b1d295; }
.medal .ico { position: static; width: 17px; height: 17px; vertical-align: middle; color: var(--gold); }
.catalog-list + .medal { margin-top: 8px; width: 44px; }
.overview-foot { margin-top: 16px; color: #cbd2c3; font-size: 13px; }
.overview-foot.with-choice {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-block: 4px;
  background: #232c28;
  border-top: 1px solid var(--line);
}
.free-choice { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; cursor: pointer; }
.free-choice input { margin: 0; width: 17px; height: 17px; accent-color: var(--gold); }
@media (max-width: 650px) {
  .chap-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .level-numbers { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .level-row { gap: 8px; }
  .room-name { font-size: 13px; }
  .level-matrix { gap: 10px; }
}
@media (max-width: 800px) {
  .board.dense { --gap: 3px; --board-inset-y: 9px; }
  .screen:has(.board.dense) { min-height: min(275px, 67vw); }
}

.catalog-actions, .piece-tabs, .album-head, .restore-actions {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.catalog-actions { margin-bottom: 14px; }
.catalog-actions .pack-tabs { margin: 0; }
.mode-groups { display: grid; gap: 16px; }
.mode-group {
  padding: 12px 13px;
  border: 1px solid #3c483d;
  border-radius: 9px;
  background: #202a24;
}
.mode-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-bottom: 10px;
}
.mode-group-head h3 { margin: 0; color: var(--gold); font: 600 14px var(--sans); letter-spacing: .3px; }
.mode-group-head span { color: #95a490; font-size: 12px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.mode-card {
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 10px 11px;
  border: 1px solid #4e5d4e;
  border-radius: 7px;
  background: #29352e;
  color: #efe4be;
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.mode-card:hover { border-color: #e4bd70; background: #324037; transform: translateY(-1px); }
.mode-card.is-done { border-color: #6c8f5e; background: #293a2c; }
.mode-card-top { display: flex; align-items: center; gap: 6px; }
.mode-card-ico { display: inline-flex; color: var(--gold); flex: none; }
.mode-card-ico .ico { width: 15px; height: 15px; }
.mode-card-top strong { font: 600 13.5px var(--sans); color: #f6ebd0; }
.mode-card-new {
  padding: 1px 5px;
  border-radius: 4px;
  background: #e4bd70;
  color: #242117;
  font: 700 9px var(--mono);
  letter-spacing: .5px;
}
.mode-card-badge {
  margin-left: auto;
  font-style: normal;
  font: 600 11px var(--mono);
  padding: 2px 7px;
  border-radius: 999px;
  background: #1d2621;
  color: #b7c8b0;
  white-space: nowrap;
}
.mode-card.is-done .mode-card-badge { background: #3a5738; color: #daf0c6; }
.mode-card small { color: #a7b5a1; font-size: 11.5px; line-height: 1.4; }
@media (max-width: 650px) {
  .overview-tabs button { flex-wrap: wrap; gap: 4px; padding: 6px 8px; font-size: 12px; }
  .pack-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-grid { grid-template-columns: 1fr; }
}
.piece-tabs button, #status-next {
  padding: 7px 10px; border: 1px solid #657260; border-radius: 5px; color: #ede0b5; font: 13px var(--sans);
}
.piece-tabs { margin-bottom: 16px; }
.piece-tabs button[aria-pressed='true'] { background: #e8c576; color: #302c22; border-color: #f2d495; }
.piece-tabs button:disabled { color: #a3a99b; border-color: #475145; }
#status-next { flex: none; padding: 3px 6px; background: #29312c; }
#status-next[hidden], .restore-actions [hidden] { display: none; }
.tile.issue-current { outline: 3px solid #ffe7ab; outline-offset: 1px; box-shadow: inset 0 0 0 2px #aa352d; }
.restoration { display: grid; grid-template-columns: minmax(0,.79fr) minmax(0,1fr); gap: 18px; align-items: start; }
.restoration figure, .ticket figure { margin: 0; }
.restoration figure img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; border-radius: 6px; filter: grayscale(1); transition: filter .7s ease; }
.restoration.restored figure img { filter: none; }
.restoration figcaption { font: 600 16px/1.45 var(--serif); margin-top: 7px; }
.restore-desk h3, .ticket h3 { margin: 0; }
.restore-rule, .restore-status, .album-note { font-size: 13px; line-height: 1.55; color: #d4ddcd; margin: 6px 0 12px; }
.repair-grid { display: grid; grid-template-columns: repeat(var(--repair-cols),minmax(0,1fr)); gap: 5px; max-width: 345px; }
.repair-grid .tile { aspect-ratio: 1; touch-action: manipulation; }
.repair-grid .tile:disabled { opacity: 1; }
.repair-grid .tile.retouched::before { content: ''; position: absolute; inset: 3px; border: 2px solid var(--ink); border-radius: 2px; pointer-events: none; }
.restore-counter, .album-head strong { color: var(--gold); font: 600 14px var(--sans); }
.restore-counter { margin-top: 12px; }
.restore-status:empty { display:none; }
.restore-actions { margin-top: 10px; }
.restore-actions .back-overview, .album-head .back-overview { margin: 0; }
.restore-actions button:disabled { opacity: .45; }
.album-head { justify-content: space-between; }
.ticket-book { display: grid; gap: 10px; }
.ticket { display: grid; grid-template-columns: 25% minmax(0,1fr) auto; align-items: center; gap: 12px; border-radius: 6px; overflow: hidden; }
.ticket.issued { background: #eee4ca; color: #293b33; }
.ticket.unissued { grid-template-columns: 25% 1fr; background: #303b34; color: #c5ccbe; }
.ticket > img { width: 100%; height:100%; min-height: 78px; object-fit: cover; }
.ticket.unissued img { filter: grayscale(1); opacity:.55; }
.ticket h3 { font: 650 clamp(16px,3vw,21px) var(--serif); }
.ticket p,.ticket figcaption { margin: 3px 0; font-size: 12px; }
.ticket span { font: 12px var(--mono); }
.ticket figure { padding: 10px 12px; border-left: 1px dashed #9f9c83; text-align: center; }
.stamp-board { display: grid; grid-template-columns: repeat(var(--stamp-cols),1fr); width: clamp(45px,10vw,70px); gap: 1px; margin: auto; }
.stamp-board i { aspect-ratio: 1; background: #e6e2cc; box-shadow: inset 0 0 0 1px #aaa990; }
.stamp-board i[data-ink="1"] { background:#dfaa49; } .stamp-board i[data-ink="2"] { background:#579f9a; }
.stamp-board i[data-ink="-1"] { background:transparent; box-shadow:none; }
@media(max-width:560px) {
  .restoration { grid-template-columns: 1fr; gap: 10px; }
  .restoration figure { display:flex; align-items:center; gap:12px; }
  .restoration figure img { width: 80px; aspect-ratio: 1; object-position: center 28%; }
  .restoration.restored figure img { width: 110px; }
  .restoration figcaption { margin:0; }
  .repair-grid { max-width: 305px; }
  .ticket { gap: 7px; }
  .ticket figure { padding: 8px; }
}
@media(prefers-reduced-motion:reduce) { .restoration figure img { transition:none; } }

.dialog-night { width: min(790px, calc(100% - 24px)); }
.night-nav, .night-nav label, .night-actions, .night-meter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.night-nav { justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.night-nav .back-overview { margin: 0; }
.night-nav label { font-size: 13px; color: #d3d9cc; }
.night-nav select {
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #717b64;
  border-radius: 5px;
  background: #28352e;
  color: #ffe4a0;
  font: inherit;
}
.night-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(0, .86fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: 'board brief' 'board controls';
  align-items: start;
  gap: 10px 22px;
}
.night-figure { grid-area: board; min-width: 0; margin: 0; }
.night-figure figcaption { margin-top: 7px; color: #e8d8af; font: 600 14px/1.5 var(--serif); }
.night-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 1;
  border: 2px solid #aa9060;
  border-radius: 6px;
  background: #111b21;
  box-shadow: 0 2px 9px #050c0d80;
}
.night-painting { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--night-focus); }
.night-revealed .night-painting { object-fit: contain; object-position: center; }
.night-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--night-size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--night-size), minmax(0, 1fr));
}
.night-grid[hidden], .night-actions [hidden], .night-message [hidden] { display: none; }
.night-cell, .night-wall {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px #a6b4a04d;
}
.night-cell {
  background-color: #0e202bd9;
  transition: background-color .23s ease;
  touch-action: manipulation;
}
.night-cell:focus-visible { z-index: 1; outline: 3px solid #fff4c8; outline-offset: -4px; }
.night-cell:not([data-beam='0']) { background-color: #f5ca6e1c; }
.night-cell::before, .night-cell::after { content: ''; position: absolute; pointer-events: none; }
.night-cell[data-beam='0']::before { width: 4px; height: 4px; background: #c3cecc83; border-radius: 50%; }
.night-cell[data-beam='1']::before, .night-cell[data-beam='3']::before {
  left: 0; right: 0; top: 50%; height: 2px; background: #ffeba6ba; box-shadow: 0 0 4px #ffc64c;
}
.night-cell[data-beam='2']::after, .night-cell[data-beam='3']::after {
  top: 0; bottom: 0; left: 50%; width: 2px; background: #ffeba6ba; box-shadow: 0 0 4px #ffc64c;
}
.night-glow {
  z-index: 1; display: none; place-items: center; width: 62%; height: 62%;
  border-radius: 50%; color: #513417; border: 1px solid #ffebb0; background: #ffdc83;
  box-shadow: 0 0 0 2px #6a461d, 0 0 11px 2px #ffd572;
}
.has-lamp .night-glow { display: grid; }
.night-glow .ico { width: 68%; height: 68%; stroke-width: 1.9; }
.night-clash .night-glow { color: #581e1b; background: #ff9b85; box-shadow: 0 0 0 3px #ac3333; }
.night-wall {
  color: #fff0c4;
  background: repeating-linear-gradient(135deg, #333d3f 0 3px, #293234 3px 7px);
  box-shadow: inset 0 0 0 2px #738075;
}
.night-wall b { font: 700 clamp(15px, 4vw, 24px)/1 var(--mono); text-shadow: 0 1px 3px #000; }
.night-wall.night-satisfied { color: #bde6b1; }
.night-error { z-index: 1; box-shadow: inset 0 0 0 3px #ff937b; }
.night-brief { grid-area: brief; }
.night-brief h3 { margin: 0 0 8px; color: #f6e4bd; font: 600 clamp(21px, 3.3vw, 30px)/1.25 var(--serif); }
.night-brief p { margin: 4px 0; color: #d7dfd0; font-size: 13px; line-height: 1.6; }
.night-controls { grid-area: controls; min-width: 0; }
.night-meter { justify-content: space-between; color: #f5d893; font: 600 13px/1.6 var(--sans); }
.night-meter span + span { color: #cad5c9; font-weight: 400; }
.night-controls progress { display: block; width: 100%; height: 6px; margin: 5px 0 12px; accent-color: #e4bb69; }
.night-message { color: #e5eacb; font-size: 13px; line-height: 1.55; }
.night-message strong, .night-message span { display: block; }
.night-message.night-bad { color: #ffe7dc; }
.night-message strong { color: #ffb39d; }
.night-actions { flex-wrap: wrap; margin-top: 10px; }
.night-actions button { border: 1px solid #74806d; padding: 8px 12px; border-radius: 5px; color: #e1e6d6; font: 600 13px var(--sans); }
.night-actions .night-primary { border-color: #f3d394; background: #ebc375; color: #312b1f; }
.night-actions button:disabled { opacity: .45; }
@media (max-width: 590px) {
  .night-layout { grid-template-columns: 1fr; grid-template-areas: 'brief' 'board' 'controls'; gap: 9px; }
  .night-nav { margin-bottom: 12px; }
  .night-brief h3 { margin-bottom: 4px; }
  .night-frame { max-width: 365px; margin-inline: auto; }
  .night-figure figcaption { text-align: center; }
}
@media (min-width: 591px) and (max-height: 500px) {
  .night-frame { max-width: clamp(222px, calc(var(--toy-height, 100dvh) - 160px), 350px); margin-inline: auto; }
}
@media (prefers-reduced-motion: reduce) { .night-cell { transition: none; } }

/* Daily coaster: a small, self-contained puzzle that changes with the date. */
.dialog-daily { width: min(940px, calc(100% - 24px)); }
.daily-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 15px;
}
.daily-nav .back-overview { margin: 0; }
.daily-date { color: #c5d1c0; font: 12px var(--mono); letter-spacing: .3px; }
.daily-layout {
  display: grid;
  grid-template-columns: minmax(0, .94fr) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 36px);
  align-items: center;
}
.daily-left { min-width: 0; }
.daily-coaster {
  position: relative;
  width: min(100%, 410px);
  aspect-ratio: 1;
  margin: auto;
  padding: clamp(10px, 2vw, 19px);
  overflow: hidden;
  border: 1px solid #c9ba93;
  border-radius: 17px;
  color: #35483b;
  background:
    radial-gradient(circle at 50% 42%, #f6eed8 0 54%, #e9ddbe 54.5% 68%, #d8c79f 68.5% 69%, #eee3c8 69.5% 100%);
  box-shadow: 0 18px 34px #07100e66, inset 0 2px 0 #fff8dfcc, inset 0 -7px 0 #aa946833;
}
.daily-coaster::before {
  content: '';
  position: absolute;
  inset: 6.5%;
  border: 1px dashed #b09d70aa;
  border-radius: 50%;
  pointer-events: none;
}
.daily-coaster::after {
  content: '';
  position: absolute;
  inset: 14%;
  border: 1px solid #c1ad7c44;
  border-radius: 50%;
  pointer-events: none;
}
.coaster-ring {
  position: absolute;
  z-index: 1;
  inset: 3.5%;
  border: 1px solid #a9946870;
  border-radius: 12px;
  pointer-events: none;
}
.coaster-print {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 2px;
}
.coaster-top, .coaster-bottom {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #405847;
  font: 700 9px var(--mono);
  letter-spacing: 1.15px;
  text-transform: uppercase;
}
.coaster-top b { color: #92713e; font-weight: 600; letter-spacing: .5px; }
.coaster-bottom { border-top: 1px solid #b5a17488; padding-top: 7px; font: 600 11px var(--serif); letter-spacing: .8px; }
.coaster-bottom span:last-child { color: #8f6e3c; }
.daily-board-mat {
  width: min(82%, 318px);
  padding: clamp(7px, 1.5vw, 10px);
  border: 1px solid #81906f;
  border-radius: 9px;
  background: linear-gradient(145deg, #1d312b, #2b4036);
  box-shadow: inset 0 1px #dce5c033, 0 8px 17px #3e2f1645;
}
.daily-grid {
  display: grid;
  grid-template-columns: repeat(var(--daily-cols), minmax(0, 1fr));
  gap: clamp(3px, .62vw, 6px);
}
.daily-tile {
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 #ffffebae, inset 0 -2px 0 var(--rim), 0 2px 0 #0c1413, 0 3px 7px #07100e44;
}
.daily-tile .tile-symbol { width: 56%; height: 56%; }
.daily-tile[data-fixed] .tile-symbol { width: 52%; height: 52%; }
.daily-tile .tile-lock { min-width: 8px; min-height: 8px; }
.daily-tile:not([disabled]):hover { filter: brightness(1.07); outline: 2px solid #fff7ca; outline-offset: 1px; }
.daily-tile.error { outline: 2px solid #ff8d75; outline-offset: 1px; animation: shake .23s ease-in-out 2; }
.daily-stamp {
  position: absolute;
  z-index: 3;
  right: 7%;
  bottom: 8%;
  width: 94px;
  height: 94px;
  display: grid;
  place-content: center;
  gap: 0;
  transform: rotate(-11deg);
  border: 2px solid #9e493e;
  border-radius: 50%;
  color: #8e3e33;
  background: #f4e8c8e6;
  box-shadow: inset 0 0 0 3px #f4e8c8, 0 3px 8px #6e4e2544;
  text-align: center;
  pointer-events: none;
}
.daily-stamp[hidden] { display: none; }
.daily-stamp strong { font: 700 16px/1.15 var(--serif); letter-spacing: 2px; }
.daily-stamp small { font: 11px var(--mono); letter-spacing: .4px; }
.daily-coaster.is-done { box-shadow: 0 18px 34px #07100e66, 0 0 0 2px #f3d18988, inset 0 2px 0 #fff8dfcc, inset 0 -7px 0 #aa946833; }
.daily-art { margin: 9px 0 0; color: #b8c6b1; font: 12px var(--serif); text-align: center; }
.daily-brief { min-width: 0; }
.daily-kicker {
  margin: 0 0 4px;
  color: var(--gold);
  font: 700 10px var(--mono);
  letter-spacing: 1.8px;
}
.daily-kicker span { margin-left: 9px; color: #a8b5a3; font-weight: 400; letter-spacing: .4px; }
.daily-brief h3 { margin: 0; color: #f6e5c0; font: 600 clamp(27px, 3.4vw, 39px)/1.16 var(--serif); }
.daily-flavor { margin: 7px 0 12px; color: #cbd6c7; font-size: 13px; line-height: 1.7; }
.daily-rule {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid #4e5d4f;
  border-radius: 6px;
  background: #29352e;
}
.daily-rule-label { color: var(--gold); font: 10px var(--mono); letter-spacing: 1px; }
.daily-rule-chip { display: inline-flex; align-items: center; gap: 3px; color: #e8dbb8; font-size: 12px; }
.daily-rule-chip .tile-symbol { width: 18px; height: 18px; }
.daily-rule-note { margin-left: auto; color: #9eac99; font-size: 10px; }
.daily-rules { margin: 8px 0 10px; }
.daily-rules summary { color: #e5d7b0; }
.daily-readout { display: flex; justify-content: space-between; gap: 10px; margin: 7px 0 4px; color: #b4c1af; font: 12px var(--mono); }
.daily-message { min-height: 20px; color: #dbe5d0; font-size: 13px; line-height: 1.45; }
.daily-message.daily-bad { color: #ffcdbb; }
.daily-message.daily-good { color: #d6eab8; }
.daily-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 7px; margin-top: 6px; }
.daily-actions .primary { flex: 1 1 150px; min-height: 40px; font-size: 14px; }
.daily-actions button:not(.primary):not([hidden]) {
  border: 1px solid #697665;
  border-radius: 5px;
  padding: 0 11px;
  min-height: 40px;
  color: #dfe6d7;
  font-size: 13px;
}
.daily-actions button:not(.primary):hover { background: #39483b; }
.daily-actions button:disabled { opacity: .4; }
.daily-actions [hidden] { display: none; }
.daily-share { border-color: #e8c773 !important; color: #f4d68d !important; }
.daily-streak { margin-top: 14px; padding-top: 12px; border-top: 1px solid #4b574b; }
.daily-streak-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.daily-streak-head strong { color: var(--gold); font-size: 14px; }
.daily-streak-head span { color: #aab6a5; font-size: 11px; text-align: right; }
.daily-day-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 8px 0 5px; }
.daily-day {
  position: relative;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #4d5c4c;
  border-radius: 4px;
  background: #2a352e;
  color: #aebba8;
  font: 11px var(--mono);
}
.daily-day small { position: absolute; top: 2px; right: 4px; color: #9fc28d; font-size: 9px; }
.daily-day.done { border-color: #f2d18d; background: #e0bc6f; color: #31301f; }
.daily-day.done small { color: #52652e; }
.daily-day.today { outline: 1px solid #f1d189; outline-offset: 1px; }
.daily-next { margin: 2px 0 0; color: #98a497; font-size: 11px; }
.museum-links button.done { border-color: #8d9d6e; color: #cfe4ad; }
@media (max-width: 680px) {
  .dialog-daily { width: calc(100% - 18px); }
  .daily-layout { grid-template-columns: 1fr; gap: 16px; }
  .daily-coaster { width: min(100%, 340px); }
  .daily-brief h3 { font-size: 27px; }
  .daily-rule-note { display: none; }
  .daily-actions .primary { flex-basis: 100%; }
}
@media (max-width: 370px) {
  .daily-coaster { width: min(100%, 300px); }
  .daily-brief h3 { font-size: 24px; }
  .daily-streak-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .daily-day-row { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .daily-tile { transition: none; }
  .daily-tile.error { animation: none; }
}

/* Keep the coaster, rule and primary action in view in Bilibili's short landscape frame. */
@media (min-width: 681px) and (max-height: 560px) {
  .dialog-daily { width: min(920px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-daily .dialog-head { padding: 10px 16px; }
  .dialog-daily .dialog-head h2 { font-size: 18px; }
  .dialog-daily #dialog-body { padding: 9px 16px 11px; }
  .daily-nav { margin-bottom: 7px; }
  .daily-date { font-size: 10px; }
  .daily-layout { grid-template-columns: minmax(0, .82fr) minmax(0, 1fr); gap: 14px; }
  .daily-coaster { width: min(100%, calc(100dvh - 170px)); padding: 8px; }
  .coaster-top { font-size: 7px; letter-spacing: .7px; }
  .coaster-bottom { padding-top: 4px; font-size: 9px; letter-spacing: .3px; }
  .coaster-ring, .daily-coaster::before, .daily-coaster::after { display: none; }
  .daily-board-mat { width: 84%; padding: 5px; }
  .daily-art, .daily-rules, .daily-flavor { display: none; }
  .daily-kicker { margin-bottom: 2px; font-size: 9px; }
  .daily-brief h3 { font-size: clamp(21px, 3.2vw, 26px); }
  .daily-rule { gap: 5px; padding: 5px 7px; }
  .daily-rule-label { font-size: 9px; }
  .daily-rule-note { display: none; }
  .daily-readout { margin: 4px 0 2px; font-size: 11px; }
  .daily-message { min-height: 17px; font-size: 11px; }
  .daily-actions { gap: 5px; margin-top: 3px; }
  .daily-actions .primary, .daily-actions button:not(.primary) { min-height: 32px; font-size: 12px; }
  .daily-streak { margin-top: 7px; padding-top: 6px; }
  .daily-streak-head strong { font-size: 12px; }
  .daily-streak-head span { font-size: 10px; }
  .daily-day-row { gap: 3px; margin: 4px 0 0; }
  .daily-day { min-height: 24px; font-size: 9px; }
  .daily-next { display: none; }
}

/* Double pour: two differently-clued cards share one colour assignment. */
.dialog-duet { width: min(880px, calc(100% - 24px)); }
.duet-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.duet-nav .back-overview { margin: 0; }
.duet-nav label { display: flex; align-items: center; gap: 7px; color: #d3d9cc; font-size: 12px; }
.duet-nav select {
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #717b64;
  border-radius: 5px;
  background: #28352e;
  color: #ffe4a0;
  font: inherit;
}
.duet-heading { text-align: center; }
.duet-kicker {
  margin: 0 0 3px;
  color: var(--gold);
  font: 700 10px var(--mono);
  letter-spacing: 1.8px;
}
.duet-kicker span { margin-left: 8px; color: #a5b49f; font-weight: 400; letter-spacing: .4px; }
.duet-heading h3 { margin: 0; color: #f6e5c0; font: 600 clamp(27px, 3.3vw, 36px)/1.15 var(--serif); }
.duet-heading .opening-line { margin: 8px auto 0; text-align: left; }
.duet-content {
  display: grid;
  grid-template-columns: minmax(0, 1.66fr) minmax(0, .84fr);
  gap: clamp(12px, 2vw, 22px);
  align-items: start;
  margin-top: 10px;
}
.duet-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
}
.duet-side {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #687a63;
  border-radius: 8px;
  background: #1b2a24;
  box-shadow: 0 8px 18px #07100e66;
}
.duet-art { position: relative; height: 51px; overflow: hidden; border-bottom: 1px solid #61705c; }
.duet-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #0b1714cc, transparent 65%, #0b1714aa); }
.duet-art img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.78) brightness(.72); display: block; }
.duet-art span {
  position: absolute;
  z-index: 1;
  left: 9px;
  bottom: 5px;
  color: #ffe5a4;
  font: 700 11px var(--sans);
  letter-spacing: 2px;
  text-shadow: 0 1px 4px #000;
}
.duet-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  background: linear-gradient(145deg, #1b2d25, #22352b);
}
.duet-tile { width: 100%; aspect-ratio: 1; min-height: 0; border-radius: 4px; }
.duet-tile .tile-symbol { width: 56%; height: 56%; }
.duet-tile:not([data-fixed]):hover { filter: brightness(1.08); outline: 2px solid #fff4c8; outline-offset: 1px; }
.duet-tile.error { outline: 2px solid #ff927c; outline-offset: 1px; animation: shake .23s ease-in-out 2; }
.duet-side figcaption { padding: 6px 9px 7px; color: #b9c8b2; font: 11px var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.duet-link { position: relative; display: grid; place-items: center; align-self: stretch; }
.duet-link::before { content: ''; position: absolute; inset: 13% 50%; border-left: 1px dashed #c8ad7066; }
.duet-link span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid #a78b55;
  border-radius: 50%;
  background: #26362e;
  color: #f1d18c;
  font: 600 10px var(--sans);
  letter-spacing: 1px;
}
.duet-stage.is-won .duet-link span { background: #e7c273; border-color: #f7d995; color: #3d311e; }
.duet-stage.is-won .duet-side { border-color: #c9ac6d; }
.duet-brief { min-width: 0; }
.duet-rule {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 7px;
  padding: 7px 9px;
  width: 100%;
  border: 1px solid #4d5d4e;
  border-radius: 6px;
  background: #28352e;
}
.duet-rule-note { width: 100%; }
.duet-rule-label { color: var(--gold); font: 10px var(--mono); letter-spacing: 1px; }
.duet-rule-chip { display: inline-flex; align-items: center; gap: 3px; color: #e8dbb8; font-size: 12px; }
.duet-rule-chip .tile-symbol { width: 18px; height: 18px; }
.duet-rule-note { color: #a3b09d; font-size: 10px; }
.duet-rules { margin: 0 0 7px; width: 100%; }
.duet-rules summary { color: #e5d7b0; }
.duet-meter {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  width: 100%;
  margin: 0 0 3px;
  color: #b6c3b0;
  font: 10px var(--mono);
}
.duet-message { min-height: 19px; width: 100%; margin: 0; color: #dce7d2; font-size: 12px; line-height: 1.45; }
.duet-message.duet-bad { color: #ffcdbb; }
.duet-message.duet-good { color: #d6eab8; }
.duet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  margin: 6px 0 0;
}
.duet-actions .primary { flex: 1 1 150px; min-height: 36px; font-size: 13px; }
.duet-actions button:not(.primary):not([hidden]) {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #697665;
  border-radius: 5px;
  color: #dfe6d7;
  font-size: 13px;
}
.duet-actions button:not(.primary):hover { background: #39483b; }
.duet-actions button:disabled { opacity: .42; }
.duet-actions [hidden] { display: none; }
.duet-done {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid #d7bb79;
  border-radius: 20px;
  color: #f2d79a;
  background: #35422d;
  font: 600 12px var(--sans);
}
.duet-foot { margin: 9px 0 0; color: #94a392; font-size: 10px; text-align: left; line-height: 1.5; }
@media (max-width: 680px) {
  .dialog-duet { width: calc(100% - 18px); }
  .duet-content { grid-template-columns: 1fr; gap: 9px; margin-top: 8px; }
  .duet-stage { grid-template-columns: minmax(0, 1fr) 29px minmax(0, 1fr); gap: 5px; }
  .duet-art { height: 38px; }
  .duet-art span { left: 6px; bottom: 3px; font-size: 10px; }
  .duet-grid { gap: 3px; padding: 5px; }
  .duet-side figcaption { padding: 4px 5px; font-size: 9px; }
  .duet-link span { width: 27px; height: 27px; font-size: 8px; letter-spacing: 0; }
  .duet-heading h3 { font-size: 26px; }
  .duet-heading .opening-line { margin-top: 6px; font-size: 12px; min-height: 36px; padding: 5px 9px; }
  .duet-rule { margin-top: 9px; padding: 6px 7px; gap: 5px; }
  .duet-rule-note { width: 100%; text-align: center; }
  .duet-actions .primary { flex-basis: 100%; }
  .duet-foot { margin-top: 8px; }
}
@media (max-width: 370px) {
  .duet-grid { gap: 2px; padding: 4px; }
  .duet-heading h3 { font-size: 24px; }
}
@media (min-width: 681px) and (max-height: 560px) {
  .dialog-duet { width: min(880px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-duet .dialog-head { padding: 10px 16px; }
  .dialog-duet .dialog-head h2 { font-size: 18px; }
  .dialog-duet #dialog-body { padding: 8px 16px 10px; }
  .duet-nav { margin-bottom: 4px; }
  .duet-heading h3 { font-size: 23px; }
  .duet-kicker { margin-bottom: 1px; font-size: 9px; }
  .duet-heading .opening-line { display: none; }
  .duet-content { grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); gap: 10px; margin-top: 5px; }
  .duet-stage { max-width: 370px; margin: 0 auto; grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr); gap: 5px; }
  .duet-grid { gap: 3px; padding: 4px; }
  .duet-art { height: 31px; }
  .duet-grid { gap: 4px; padding: 5px; }
  .duet-side figcaption { display: none; }
  .duet-link span { width: 27px; height: 27px; font-size: 8px; }
  .duet-rule { margin: 0 0 4px; padding: 4px 7px; }
  .duet-rules { display: none; }
  .duet-meter, .duet-message { margin-top: 2px; }
  .duet-message { min-height: 16px; font-size: 11px; }
  .duet-actions { margin-top: 3px; gap: 5px; }
  .duet-actions .primary, .duet-actions button:not(.primary):not([hidden]) { min-height: 31px; font-size: 12px; }
  .duet-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .duet-tile { transition: none; }
  .duet-tile.error { animation: none; }
}

/* Mirror pour: one board whose two halves share every colour. */
.dialog-mirror { width: min(840px, calc(100% - 24px)); }
.mirror-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.mirror-nav .back-overview { margin: 0; }
.mirror-nav label { display: flex; align-items: center; gap: 7px; color: #d3d9cc; font-size: 12px; }
.mirror-nav select {
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #717b64;
  border-radius: 5px;
  background: #28352e;
  color: #ffe4a0;
  font: inherit;
}
.mirror-heading { text-align: center; }
.mirror-kicker { margin: 0 0 3px; color: var(--gold); font: 700 10px var(--mono); letter-spacing: 1.8px; }
.mirror-kicker span { margin-left: 8px; color: #a5b49f; font-weight: 400; letter-spacing: .4px; }
.mirror-heading h3 { margin: 0; color: #f6e5c0; font: 600 clamp(28px, 3.3vw, 38px)/1.14 var(--serif); }
.mirror-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .84fr);
  gap: clamp(15px, 2.7vw, 28px);
  align-items: start;
  margin-top: 13px;
}
.mirror-figure { min-width: 0; margin: 0; }
.mirror-frame {
  position: relative;
  isolation: isolate;
  width: min(100%, 340px);
  aspect-ratio: 1;
  margin: auto;
  overflow: hidden;
  border: 2px solid #a88f5e;
  border-radius: 7px;
  background: #111b21;
  box-shadow: 0 9px 24px #07100e88, inset 0 0 0 1px #f1d18e33;
}
.mirror-painting {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.78) brightness(.64);
  transition: filter .6s ease;
}
.mirror-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, #0a1714aa, transparent 38%, #0a171444 62%, #0a1714bb);
  pointer-events: none;
}
.mirror-grid {
  position: absolute;
  z-index: 2;
  inset: 8.5%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(4px, .55vw, 7px);
  align-content: center;
}
.mirror-tile { width: 100%; aspect-ratio: 1; min-height: 0; border-radius: 5px; }
.mirror-tile .tile-symbol { width: 58%; height: 58%; }
.mirror-tile:not([data-fixed]):hover { filter: brightness(1.09); outline: 2px solid #fff4c8; outline-offset: 1px; }
.mirror-tile.error { outline: 2px solid #ff927c; outline-offset: 1px; animation: shake .23s ease-in-out 2; }
.mirror-frame::after {
  content: '';
  position: absolute;
  z-index: 3;
  top: 7%;
  bottom: 7%;
  left: 50%;
  width: 2px;
  background: linear-gradient(transparent, #ffe0a0dd 18%, #ffe0a0dd 82%, transparent);
  box-shadow: 0 0 9px #ffd979aa;
  pointer-events: none;
}
.mirror-axis {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  transform: translate(-50%, -50%);
  border: 1px solid #e3c77e;
  border-radius: 50%;
  background: #26362ee6;
  color: #ffe3a3;
  font: 600 13px var(--serif);
  box-shadow: 0 2px 8px #07100eaa;
  pointer-events: none;
}
.mirror-figure figcaption { margin-top: 7px; color: #d5e0cf; font: 12px var(--serif); text-align: center; }
.mirror-frame.is-done { border-color: #e5c57d; box-shadow: 0 9px 24px #07100e88, 0 0 0 2px #e8c97c55; }
.mirror-frame.is-done .mirror-painting { filter: saturate(1.05) brightness(.92); }
.mirror-brief { min-width: 0; }
.mirror-brief .opening-line { margin: 0 0 10px; }
.mirror-rule {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid #4e5d4f;
  border-radius: 6px;
  background: #29352e;
}
.mirror-rule-label { color: var(--gold); font: 10px var(--mono); letter-spacing: 1px; }
.mirror-rule-chip { display: inline-flex; align-items: center; gap: 3px; color: #e8dbb8; font-size: 12px; }
.mirror-rule-chip .tile-symbol { width: 18px; height: 18px; }
.mirror-rule-note { width: 100%; color: #a4b09e; font-size: 10px; }
.mirror-rules { margin: 7px 0 9px; }
.mirror-meter {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #b7c4b1;
  font: 10px var(--mono);
}
.mirror-message { min-height: 19px; margin-top: 3px; color: #dce7d2; font-size: 12px; line-height: 1.45; }
.mirror-message.mirror-bad { color: #ffcdbb; }
.mirror-message.mirror-good { color: #d6eab8; }
.mirror-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.mirror-actions .primary { flex: 1 1 150px; min-height: 36px; font-size: 13px; }
.mirror-actions button:not(.primary):not([hidden]) {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #697665;
  border-radius: 5px;
  color: #dfe6d7;
  font-size: 12px;
}
.mirror-actions button:not(.primary):hover { background: #39483b; }
.mirror-actions button:disabled { opacity: .42; }
.mirror-actions [hidden] { display: none; }
.mirror-foot { margin: 9px 0 0; color: #94a392; font-size: 10px; line-height: 1.5; }
@media (max-width: 680px) {
  .dialog-mirror { width: calc(100% - 18px); }
  .mirror-layout { grid-template-columns: 1fr; gap: 11px; margin-top: 9px; }
  .mirror-frame { width: min(100%, 340px); }
  .mirror-heading h3 { font-size: 27px; }
  .mirror-figure figcaption { text-align: center; }
  .mirror-rule-note { width: 100%; }
  .mirror-actions .primary { flex-basis: 100%; }
}
@media (max-width: 370px) {
  .mirror-frame { width: min(100%, 300px); }
  .mirror-heading h3 { font-size: 24px; }
}
@media (min-width: 681px) and (max-height: 560px) {
  .dialog-mirror { width: min(860px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-mirror .dialog-head { padding: 10px 16px; }
  .dialog-mirror .dialog-head h2 { font-size: 18px; }
  .dialog-mirror #dialog-body { padding: 8px 16px 10px; }
  .mirror-nav { margin-bottom: 4px; }
  .mirror-heading h3 { font-size: 23px; }
  .mirror-kicker { font-size: 9px; margin-bottom: 1px; }
  .mirror-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, .84fr); gap: 10px; margin-top: 5px; }
  .mirror-frame { width: min(100%, calc(100dvh - 175px)); }
  .mirror-figure figcaption { display: none; }
  .mirror-brief .opening-line, .mirror-rules { display: none; }
  .mirror-rule { padding: 5px 7px; }
  .mirror-meter { margin-top: 2px; }
  .mirror-message { min-height: 16px; font-size: 11px; }
  .mirror-actions { margin-top: 3px; gap: 5px; }
  .mirror-actions .primary, .mirror-actions button:not(.primary):not([hidden]) { min-height: 31px; font-size: 12px; }
  .mirror-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mirror-tile, .mirror-painting { transition: none; }
  .mirror-tile.error { animation: none; }
}

/* Recipe card: the colour count along every row and column is the clue. */
.dialog-recipe { width: min(860px, calc(100% - 24px)); }
.recipe-nav {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.recipe-nav .back-overview { margin: 0; }
.recipe-nav label { display: flex; align-items: center; gap: 7px; color: #d3d9cc; font-size: 12px; }
.recipe-nav select {
  max-width: 100%; padding: 6px 8px; border: 1px solid #717b64; border-radius: 5px;
  background: #28352e; color: #ffe4a0; font: inherit;
}
.recipe-heading { text-align: center; }
.recipe-kicker { margin: 0 0 3px; color: var(--gold); font: 700 10px var(--mono); letter-spacing: 1.8px; }
.recipe-kicker span { margin-left: 8px; color: #a5b49f; font-weight: 400; letter-spacing: .4px; }
.recipe-heading h3 { margin: 0; color: #f6e5c0; font: 600 clamp(28px, 3.3vw, 38px)/1.14 var(--serif); }
.recipe-layout {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .84fr);
  gap: clamp(15px, 2.7vw, 28px); align-items: start; margin-top: 13px;
}
.recipe-figure { min-width: 0; margin: 0; }
.recipe-board {
  display: grid;
  grid-template-columns: 54px repeat(4, minmax(0, 1fr));
  grid-template-rows: 54px repeat(4, minmax(0, 1fr));
  gap: 5px;
  width: min(100%, 330px);
  margin: auto;
  padding: 9px;
  border: 2px solid #8d7a51;
  border-radius: 7px;
  background: linear-gradient(145deg, #29392f, #1a2a23);
  box-shadow: 0 9px 24px #07100e88, inset 0 0 0 1px #e7cc8740;
}
.recipe-corner { grid-area: 1/1; border-bottom: 1px solid #6b7457; border-right: 1px solid #6b7457; }
.recipe-count {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 0; border: 1px solid #455349; border-radius: 4px; background: #26332c;
}
.recipe-count[data-recipe-row] { border-right: 2px solid #6e7659; }
.recipe-count[data-recipe-col] { border-bottom: 2px solid #6e7659; }
.recipe-count.met { border-color: #a7c78d; background: #2f4130; }
.recipe-count.bad { border-color: #ff927c; box-shadow: inset 0 0 0 1px #ff927c; }
.recipe-pip {
  display: grid; place-items: center; width: 15px; height: 18px; border-radius: 3px;
  color: #323a2d; background: #e7e9db; font: 700 9px/1 var(--mono); font-style: normal;
}
.recipe-pip[data-color='1'] { background: #eab13c; }
.recipe-pip[data-color='2'] { background: #56c5c4; }
.recipe-tile { width: 100%; aspect-ratio: 1; min-height: 0; border-radius: 5px; }
.recipe-tile .tile-lock { min-width: 8px; min-height: 8px; }
.recipe-tile:not([data-fixed]):hover { filter: brightness(1.08); outline: 2px solid #fff4c8; outline-offset: 1px; }
.recipe-tile.error { outline: 2px solid #ff927c; outline-offset: 1px; animation: shake .23s ease-in-out 2; }
.recipe-figure figcaption { margin-top: 7px; color: #d5e0cf; font: 12px var(--serif); text-align: center; }
.recipe-brief { min-width: 0; }
.recipe-brief .opening-line { margin: 0 0 10px; }
.recipe-rule { padding: 8px 9px; border: 1px solid #4e5d4f; border-radius: 6px; background: #29352e; }
.recipe-rule-label { color: var(--gold); font: 10px var(--mono); letter-spacing: 1px; }
.recipe-rule-note { display: block; margin-top: 5px; color: #b6c2af; font-size: 11px; line-height: 1.5; }
.recipe-rules { margin: 7px 0 9px; }
.recipe-meter { display: flex; justify-content: space-between; gap: 8px; color: #b7c4b1; font: 10px var(--mono); }
.recipe-message { min-height: 19px; margin-top: 3px; color: #dce7d2; font-size: 12px; line-height: 1.45; }
.recipe-message.recipe-bad { color: #ffcdbb; }
.recipe-message.recipe-good { color: #d6eab8; }
.recipe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.recipe-actions .primary { flex: 1 1 150px; min-height: 36px; font-size: 13px; }
.recipe-actions button:not(.primary):not([hidden]) {
  min-height: 36px; padding: 0 10px; border: 1px solid #697665; border-radius: 5px; color: #dfe6d7; font-size: 12px;
}
.recipe-actions button:not(.primary):hover { background: #39483b; }
.recipe-actions button:disabled { opacity: .42; }
.recipe-actions [hidden] { display: none; }
.recipe-foot { margin: 9px 0 0; color: #94a392; font-size: 10px; line-height: 1.5; }
@media (max-width: 680px) {
  .dialog-recipe { width: calc(100% - 18px); }
  .recipe-layout { grid-template-columns: 1fr; gap: 11px; margin-top: 9px; }
  .recipe-board { width: min(100%, 340px); grid-template-columns: 45px repeat(4, minmax(0, 1fr)); grid-template-rows: 45px repeat(4, minmax(0, 1fr)); gap: 4px; padding: 8px; }
  .recipe-heading h3 { font-size: 27px; }
  .recipe-pip { width: 13px; height: 16px; font-size: 8px; }
  .recipe-actions .primary { flex-basis: 100%; }
}
@media (max-width: 370px) {
  .recipe-board { width: min(100%, 300px); }
  .recipe-heading h3 { font-size: 24px; }
}
@media (min-width: 681px) and (max-height: 560px) {
  .dialog-recipe { width: min(860px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-recipe .dialog-head { padding: 10px 16px; }
  .dialog-recipe .dialog-head h2 { font-size: 18px; }
  .dialog-recipe #dialog-body { padding: 8px 16px 10px; }
  .recipe-nav { margin-bottom: 4px; }
  .recipe-heading h3 { font-size: 23px; }
  .recipe-kicker { font-size: 9px; margin-bottom: 1px; }
  .recipe-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, .84fr); gap: 10px; margin-top: 5px; }
  .recipe-board { width: min(100%, calc(100dvh - 175px)); grid-template-columns: 40px repeat(4, minmax(0, 1fr)); grid-template-rows: 40px repeat(4, minmax(0, 1fr)); gap: 3px; padding: 6px; }
  .recipe-figure figcaption, .recipe-brief .opening-line, .recipe-rules { display: none; }
  .recipe-rule { padding: 5px 7px; }
  .recipe-rule-note { margin-top: 2px; font-size: 10px; }
  .recipe-meter { margin-top: 2px; }
  .recipe-message { min-height: 16px; font-size: 11px; }
  .recipe-actions { margin-top: 3px; gap: 5px; }
  .recipe-actions .primary, .recipe-actions button:not(.primary):not([hidden]) { min-height: 31px; font-size: 12px; }
  .recipe-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .recipe-tile { transition: none; }
  .recipe-tile.error { animation: none; }
}

/* Regulars' card: a readable map of every mode and its little stamps. */
.dialog-passport { width: min(900px, calc(100% - 24px)); }
.passport-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  gap: clamp(14px, 2.4vw, 24px);
  align-items: start;
}
.passport-card {
  position: relative;
  overflow: hidden;
  padding: clamp(14px, 2vw, 19px);
  border: 1px solid #b49a63;
  border-radius: 10px;
  background:
    radial-gradient(circle at 92% 4%, #e8c77925, transparent 35%),
    linear-gradient(135deg, #2a3d31, #1a2822 72%);
  box-shadow: 0 12px 28px #07100e77, inset 0 1px 0 #fff1c04d;
}
.passport-card::after {
  content: '';
  position: absolute;
  right: -32px;
  bottom: -38px;
  width: 145px;
  height: 145px;
  border: 1px solid #e2c27625;
  border-radius: 50%;
  box-shadow: 0 0 0 14px #e2c27610, 0 0 0 30px #e2c27608;
  pointer-events: none;
}
.passport-card-top { display: flex; justify-content: space-between; gap: 10px; color: #c3d1bf; font: 9px var(--mono); letter-spacing: 1.2px; }
.passport-card-top span:last-child { color: #e6c777; }
.passport-identity { display: flex; align-items: center; gap: 12px; margin-top: 15px; }
.passport-identity img { width: 47px; height: 60px; object-fit: contain; filter: drop-shadow(0 3px 5px #07100e88); }
.passport-identity small { display: block; color: #aab8a6; font: 9px var(--mono); letter-spacing: 1px; }
.passport-identity strong { display: block; color: #f4d995; font: 600 clamp(23px, 3vw, 32px)/1.15 var(--serif); }
.passport-identity p { margin: 3px 0 0; color: #bdcbb6; font-size: 11px; line-height: 1.45; }
.passport-progress { height: 6px; margin-top: 13px; overflow: hidden; border: 1px solid #667555; border-radius: 6px; background: #16241f; }
.passport-progress i { display: block; height: 100%; background: linear-gradient(90deg, #c99943, #f1d38d); box-shadow: 0 0 8px #f1cc7a99; }
.passport-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 16px; margin-top: 13px; }
.passport-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #52635399; }
.passport-stat span { color: #aab8a6; font-size: 10px; white-space: nowrap; }
.passport-stat strong { color: #e9d29a; font: 600 11px var(--mono); white-space: nowrap; }
.passport-stat em { color: #879a87; font-style: normal; font-size: 9px; }
.passport-card-foot { margin: 13px 0 0; color: #91a38f; font: 9px var(--mono); letter-spacing: .3px; }
.passport-side { min-width: 0; }
.passport-badge-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid #4b594a; }
.passport-badge-head strong { color: #f0d494; font: 600 16px var(--serif); }
.passport-badge-head span { color: #aab7a6; font: 10px var(--mono); }
.passport-badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 9px; }
.passport-badge {
  position: relative;
  display: grid;
  grid-template-columns: 25px minmax(0,1fr);
  grid-template-areas: 'icon name' 'icon note';
  column-gap: 7px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid #475549;
  border-radius: 6px;
  background: #26332d;
}
.passport-badge.unlocked { border-color: #96804f; background: #304132; }
.passport-badge-icon { grid-area: icon; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; color: #899a89; background: #1d2a25; }
.passport-badge.unlocked .passport-badge-icon { color: #f4d283; background: #4c3d22; }
.passport-badge-icon .ico { width: 14px; height: 14px; }
.passport-badge strong { grid-area: name; overflow: hidden; color: #c2cfbd; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.passport-badge.unlocked strong { color: #f0dfb7; }
.passport-badge small { grid-area: note; overflow: hidden; color: #849480; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.passport-badge.unlocked small { color: #aabca3; }
.passport-seal { position: absolute; right: 4px; bottom: 3px; color: #d9b76c; font: 8px var(--mono); }
@media (max-width: 740px) {
  .dialog-passport { width: calc(100% - 18px); }
  .passport-layout { grid-template-columns: 1fr; gap: 13px; }
  .passport-identity strong { font-size: 25px; }
  .passport-card { padding: 13px; }
  .passport-badge-grid { gap: 5px; }
}
@media (min-width: 741px) and (max-height: 560px) {
  .dialog-passport { width: min(900px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-passport .dialog-head { padding: 10px 16px; }
  .dialog-passport .dialog-head h2 { font-size: 18px; }
  .dialog-passport #dialog-body { padding: 8px 16px 10px; }
  .passport-card { padding: 10px 12px; }
  .passport-identity { margin-top: 7px; }
  .passport-identity img { width: 34px; height: 44px; }
  .passport-identity strong { font-size: 23px; }
  .passport-identity p { font-size: 10px; }
  .passport-progress { margin-top: 7px; }
  .passport-stat-grid { margin-top: 7px; }
  .passport-stat { padding: 2px 0; }
  .passport-card-foot { display: none; }
  .passport-badge { padding: 4px 6px; }
  .passport-badge-grid { margin-top: 5px; gap: 4px; }
  .passport-badge-icon { width: 21px; height: 21px; }
  .passport-badge small { font-size: 8px; }
}

/* Tavern cipher: five coloured caps, six guesses, one daily password. */
.dialog-cipher { width: min(820px, calc(100% - 24px)); }
.cipher-nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.cipher-nav .back-overview { margin: 0; }
.cipher-date { color: #c5d1c0; font: 11px var(--mono); letter-spacing: .2px; }
.cipher-heading { text-align: center; }
.cipher-kicker { margin: 0 0 3px; color: var(--gold); font: 700 10px var(--mono); letter-spacing: 1.8px; }
.cipher-kicker span { margin-left: 8px; color: #a5b49f; font-weight: 400; letter-spacing: .4px; }
.cipher-heading h3 { margin: 0; color: #f6e5c0; font: 600 clamp(27px, 3.3vw, 37px)/1.14 var(--serif); }
.cipher-layout {
  display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr);
  gap: clamp(15px, 2.7vw, 26px); align-items: start; margin-top: 13px;
}
.cipher-board {
  min-width: 0; padding: 12px; border: 1px solid #6f7b60; border-radius: 8px;
  background: linear-gradient(145deg, #26372d, #18251f); box-shadow: 0 9px 22px #07100e66;
}
.cipher-label { margin: 2px 0 5px; color: #9fad99; font: 9px var(--mono); letter-spacing: 1px; text-transform: uppercase; }
.cipher-secret-wrap { margin-bottom: 10px; }
.cipher-secret, .cipher-current, .cipher-history-caps { display: flex; align-items: center; gap: 6px; }
.cipher-secret { min-height: 38px; }
.cipher-cap {
  display: inline-grid; place-items: center; width: 27px; height: 27px; padding: 0;
  border: 1px solid #4e5b45; border-radius: 50%;
  background: #e7e9db; color: #354333; box-shadow: inset 0 2px 0 #ffffe0aa, 0 2px 0 #07100e;
  font: 700 10px var(--mono); flex: none;
}
.cipher-cap[data-color='1'] { background: #eab13c; border-color: #b98831; color: #523c1d; }
.cipher-cap[data-color='2'] { background: #56c5c4; border-color: #3e9394; color: #23484c; }
.cipher-cap[data-color='3'] { background: #6d4934; border-color: #4a2e20; color: #f4e2bd; }
.cipher-cap.hidden { background: #24332b; border-color: #59664f; color: #92a28b; box-shadow: none; font-size: 12px; }
.cipher-current .cipher-cap { width: 43px; height: 43px; cursor: pointer; }
.cipher-current .cipher-cap:hover { outline: 2px solid #fff4c8; outline-offset: 2px; }
.cipher-current .cipher-cap:focus-visible { outline: 2px solid #f6e6a4; outline-offset: 3px; }
.cipher-history { max-height: 240px; overflow-y: auto; padding-right: 2px; }
.cipher-history-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 0; border-bottom: 1px dashed #465445;
}
.cipher-history-row .cipher-cap { width: 23px; height: 23px; font-size: 8px; }
.cipher-feedback { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; flex: none; }
.cipher-exact, .cipher-partial { border-radius: 3px; padding: 2px 5px; font: 9px var(--mono); white-space: nowrap; }
.cipher-exact { color: #3d311e; background: #e6c274; }
.cipher-partial { color: #173f42; background: #85d4d0; }
.cipher-empty { margin: 0; padding: 8px 0; color: #8d9d8a; font-size: 11px; }
.cipher-current-wrap { padding-top: 2px; }
.cipher-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.cipher-actions .primary { flex: 1 1 150px; min-height: 37px; font-size: 13px; }
.cipher-actions button:not(.primary) { min-height: 37px; padding: 0 12px; border: 1px solid #697665; border-radius: 5px; color: #dfe6d7; font-size: 12px; }
.cipher-actions button:not(.primary):hover { background: #39483b; }
.cipher-actions button:disabled { opacity: .42; }
.cipher-brief { min-width: 0; }
.cipher-rule { padding: 9px; border: 1px solid #4e5d4f; border-radius: 6px; background: #29352e; }
.cipher-rule strong { color: #eddaa9; font: 600 14px var(--serif); }
.cipher-rule p { margin: 5px 0 0; color: #bdcbb6; font-size: 12px; line-height: 1.6; }
.cipher-rules { margin: 7px 0 9px; }
.cipher-meter { display: flex; justify-content: space-between; gap: 8px; color: #b7c4b1; font: 10px var(--mono); }
.cipher-message { min-height: 19px; margin-top: 5px; color: #dce7d2; font-size: 12px; line-height: 1.45; }
.cipher-message.cipher-bad { color: #ffcdbb; }
.cipher-message.cipher-good { color: #d6eab8; }
.cipher-foot { margin: 10px 0 0; color: #94a392; font-size: 10px; }
@media (max-width: 680px) {
  .dialog-cipher { width: calc(100% - 18px); }
  .cipher-layout { grid-template-columns: 1fr; gap: 11px; margin-top: 9px; }
  .cipher-board { padding: 9px; }
  .cipher-current .cipher-cap { width: 39px; height: 39px; }
  .cipher-history { max-height: 185px; }
  .cipher-actions .primary { flex-basis: 100%; }
  .cipher-heading h3 { font-size: 27px; }
}
@media (max-width: 370px) {
  .cipher-current .cipher-cap { width: 34px; height: 34px; }
  .cipher-secret, .cipher-current, .cipher-history-caps { gap: 4px; }
  .cipher-heading h3 { font-size: 24px; }
}
@media (min-width: 681px) and (max-height: 560px) {
  .dialog-cipher { width: min(820px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-cipher .dialog-head { padding: 10px 16px; }
  .dialog-cipher .dialog-head h2 { font-size: 18px; }
  .dialog-cipher #dialog-body { padding: 8px 16px 10px; }
  .cipher-nav { margin-bottom: 4px; }
  .cipher-heading h3 { font-size: 23px; }
  .cipher-kicker { font-size: 9px; margin-bottom: 1px; }
  .cipher-layout { grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); gap: 10px; margin-top: 5px; }
  .cipher-board { padding: 7px; }
  .cipher-secret-wrap { margin-bottom: 5px; }
  .cipher-secret .cipher-cap { width: 27px; height: 27px; }
  .cipher-current .cipher-cap { width: 31px; height: 31px; }
  .cipher-history { max-height: 110px; }
  .cipher-history-row { padding: 2px 0; }
  .cipher-history-row .cipher-cap { width: 19px; height: 19px; }
  .cipher-rule { padding: 6px; }
  .cipher-rule p { font-size: 10px; line-height: 1.45; }
  .cipher-rules { display: none; }
  .cipher-meter { margin-top: 2px; }
  .cipher-message { min-height: 16px; font-size: 11px; }
  .cipher-actions { margin-top: 4px; }
  .cipher-actions .primary, .cipher-actions button:not(.primary) { min-height: 30px; font-size: 11px; }
  .cipher-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cipher-cap { transition: none; }
}

/* Last call: a three-minute run through the daily coaster deck. */
.dialog-rush { width: min(820px, calc(100% - 24px)); }
.rush-intro, .rush-result { text-align: center; padding: 9px 8px 13px; }
.rush-kicker { margin: 0 0 4px; color: var(--gold); font: 700 10px var(--mono); letter-spacing: 1.8px; }
.rush-kicker span { margin-left: 8px; color: #a5b49f; font-weight: 400; letter-spacing: .4px; }
.rush-intro h3, .rush-result h3 { margin: 0; color: #f6e5c0; font: 600 clamp(31px, 4.2vw, 46px)/1.1 var(--serif); }
.rush-lead { max-width: 520px; margin: 9px auto 14px; color: #cbd6c7; font-size: 13px; line-height: 1.75; }
.rush-lead strong { color: #f2d38f; }
.rush-intro-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 20px; margin: 13px 0 19px; color: #aab7a5; font-size: 11px; }
.rush-intro-stats strong { display: block; margin-top: 2px; color: #f1d28d; font: 600 17px var(--mono); }
.rush-start { max-width: 230px; margin: 0 auto; min-height: 43px; font-size: 15px; }
.rush-intro .rush-start { margin-top: 4px; }
.rush-tip { margin: 17px 0 0; color: #8fa08c; font: 10px var(--mono); }
.rush-hud { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 7px; margin-bottom: 6px; }
.rush-hud > div { padding: 6px 8px; border: 1px solid #4b594a; border-radius: 5px; background: #25342c; }
.rush-hud span { display: block; color: #9eaf99; font: 9px var(--mono); letter-spacing: .3px; }
.rush-hud strong { display: block; margin-top: 2px; color: #f3d48e; font: 600 13px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rush-progress { height: 4px; margin-bottom: 9px; overflow: hidden; border-radius: 4px; background: #1b2a23; }
.rush-progress i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, #dfa84b, #f4dc98); transition: width .25s linear; }
.rush-main { display: grid; grid-template-columns: minmax(0, 1.13fr) minmax(0, .87fr); gap: 20px; align-items: center; }
.rush-screen {
  display: grid; place-items: center; min-height: 300px; padding: 14px; overflow: hidden;
  border: 1px solid #4d5d4c; border-radius: 8px; background: radial-gradient(circle at 50% 40%, #304238, #17251f 72%);
  box-shadow: inset 0 2px 12px #07100e99;
}
.rush-grid { display: grid; grid-template-columns: repeat(var(--rush-cols, 4), minmax(0, 1fr)); gap: 7px; width: min(100%, 355px); margin: auto; }
.rush-grid.dense { width: min(100%, 350px); gap: 5px; }
.rush-tile { width: 100%; aspect-ratio: 1; min-height: 0; border-radius: 5px; }
.rush-tile .tile-symbol { width: 58%; height: 58%; }
.rush-tile:not([data-fixed]):hover { filter: brightness(1.08); outline: 2px solid #fff4c8; outline-offset: 1px; }
.rush-tile.error { outline: 2px solid #ff927c; outline-offset: 1px; animation: shake .23s ease-in-out 2; }
.rush-side { min-width: 0; }
.rush-side h3 { margin: 0; color: #f2dfb4; font: 600 27px var(--serif); }
.rush-copy { margin: 8px 0 12px; color: #bfccb8; font-size: 12px; line-height: 1.65; }
.rush-actions .primary { width: 100%; min-height: 39px; font-size: 14px; }
.rush-message { min-height: 18px; margin: 7px 0 0; color: #dce7d2; font-size: 12px; line-height: 1.45; }
.rush-foot { margin: 13px 0 0; color: #8fa08c; font: 9px var(--mono); }
.rush-result .back-overview { display: block; margin: 12px auto 0; }
@media (max-width: 680px) {
  .dialog-rush { width: calc(100% - 18px); }
  .rush-hud { grid-template-columns: repeat(2, 1fr); }
  .rush-main { grid-template-columns: 1fr; gap: 11px; }
  .rush-screen { min-height: 0; padding: 9px; }
  .rush-grid { width: min(100%, 330px); gap: 5px; }
  .rush-side h3 { font-size: 23px; }
  .rush-copy { margin: 5px 0 8px; }
  .rush-intro-stats { gap: 14px; }
}
@media (max-width: 370px) {
  .rush-grid { gap: 3px; }
  .rush-intro h3, .rush-result h3 { font-size: 31px; }
}
@media (min-width: 681px) and (max-height: 560px) {
  .dialog-rush { width: min(820px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-rush .dialog-head { padding: 10px 16px; }
  .dialog-rush .dialog-head h2 { font-size: 18px; }
  .dialog-rush #dialog-body { padding: 8px 16px 10px; }
  .rush-hud { grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 4px; }
  .rush-hud > div { padding: 3px 6px; }
  .rush-hud span { font-size: 8px; }
  .rush-hud strong { font-size: 11px; }
  .rush-progress { margin-bottom: 5px; }
  .rush-screen { min-height: 0; padding: 6px; }
  .rush-grid { width: min(100%, calc(100dvh - 180px)); gap: 4px; }
  .rush-side h3 { font-size: 22px; }
  .rush-copy { font-size: 10px; line-height: 1.45; margin: 4px 0 7px; }
  .rush-actions .primary { min-height: 31px; font-size: 12px; }
  .rush-message { min-height: 15px; font-size: 10px; }
  .rush-foot { display: none; }
  .rush-intro, .rush-result { padding: 4px; }
  .rush-lead { margin: 5px auto 8px; font-size: 11px; }
  .rush-intro-stats { margin: 6px 0 9px; }
  .rush-start { min-height: 34px; }
  .rush-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rush-progress i, .rush-tile { transition: none; }
  .rush-tile.error { animation: none; }
}

/* Tavern notes: a small book unlocked by the cups already on the card. */
.passport-story {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #95804f;
  border-radius: 5px;
  background: #2f3f31;
  color: #f1d28d;
  font: 12px var(--sans);
}
.passport-story:hover { background: #3b4d39; }
.passport-story span { font: 14px var(--mono); }
.dialog-story { width: min(820px, calc(100% - 24px)); }
.story-layout {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr);
  gap: 17px;
  align-items: stretch;
}
.story-toc { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.story-toc button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-areas: 'no title' 'no lock';
  column-gap: 7px;
  align-items: center;
  min-height: 42px;
  padding: 4px 7px;
  border: 1px solid #465448;
  border-radius: 4px;
  background: #26332c;
  color: #bdcbb8;
  text-align: left;
}
.story-toc button:hover:not(:disabled) { background: #35463a; }
.story-toc button[aria-pressed='true'] { border-color: #d7ba78; background: #3a4a36; color: #f3d69a; }
.story-toc button:disabled { opacity: .52; }
.story-toc small { grid-area: no; color: #9eb59a; font: 10px var(--mono); }
.story-toc span { grid-area: title; overflow: hidden; font: 600 12px var(--serif); white-space: nowrap; text-overflow: ellipsis; }
.story-toc em { grid-area: lock; color: #879784; font: 8px var(--mono); font-style: normal; }
.story-page {
  position: relative;
  min-width: 0;
  min-height: 380px;
  padding: 24px 26px 20px;
  border: 1px solid #b8a06c;
  border-radius: 7px;
  background:
    radial-gradient(circle at 91% 8%, #b99a5e20, transparent 26%),
    #eee4ca;
  color: #2c3b31;
  box-shadow: 0 10px 24px #07100e55, inset 0 0 0 1px #fff9e7aa;
}
.story-eyebrow { margin: 0 0 7px; color: #8b7038; font: 9px var(--mono); letter-spacing: 1.2px; }
.story-page h3 { margin: 0 0 15px; color: #293b2e; font: 600 clamp(26px, 3.4vw, 38px)/1.15 var(--serif); }
.story-body p { margin: 0 0 12px; color: #3e4c3d; font: 15px/1.9 var(--serif); }
.story-foot { margin: 18px 0 0; color: #7b846d; font: 9px var(--mono); }
.story-return { margin-top: 16px; color: #40513e; border-color: #9c9e7d; background: #e8dfc6; }
.story-return:hover { background: #f5ecd5; }
@media (max-width: 680px) {
  .dialog-story { width: calc(100% - 18px); }
  .story-layout { grid-template-columns: 1fr; gap: 9px; }
  .story-toc { flex-direction: row; overflow-x: auto; padding-bottom: 3px; }
  .story-toc button { flex: 0 0 130px; min-height: 38px; }
  .story-toc em { display: none; }
  .story-page { min-height: 0; padding: 18px 17px 16px; }
  .story-body p { font-size: 14px; }
}
@media (min-width: 681px) and (max-height: 560px) {
  .dialog-story { width: min(820px, calc(100% - 18px)); max-height: calc(100% - 14px); }
  .dialog-story .dialog-head { padding: 10px 16px; }
  .dialog-story .dialog-head h2 { font-size: 18px; }
  .dialog-story #dialog-body { padding: 8px 16px 10px; }
  .story-layout { grid-template-columns: 180px minmax(0, 1fr); gap: 12px; }
  .story-toc button { min-height: 30px; padding: 2px 5px; }
  .story-toc small { font-size: 8px; }
  .story-toc span { font-size: 10px; }
  .story-toc em { font-size: 7px; }
  .story-page { min-height: 0; padding: 13px 15px 10px; }
  .story-page h3 { font-size: 22px; margin-bottom: 7px; }
  .story-body p { font-size: 11px; line-height: 1.65; margin-bottom: 6px; }
  .story-foot { margin-top: 8px; font-size: 8px; }
  .story-return { margin-top: 8px; padding: 5px 8px; font-size: 10px; }
}

/* A short holding card while the cloud save is fetched. */
.save-boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8d29a;
  background: radial-gradient(circle at 50% 44%, #26362e, #111b18 76%);
  font: 600 15px/1.5 var(--serif);
  letter-spacing: .4px;
}
.save-boot::before {
  content: '';
  width: 16px;
  height: 16px;
  margin-right: 10px;
  border: 2px solid #d9b76a;
  border-right-color: transparent;
  border-radius: 50%;
  animation: save-spin .8s linear infinite;
}
@keyframes save-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .save-boot::before { animation: none; }
}

/* Ripple pour: cross-shaped colour rotation around the tapped coaster. */
.dialog-ripple { width: min(860px, calc(100% - 24px)); }
.ripple-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.ripple-nav .back-overview { margin: 0; }
.ripple-nav label { display: flex; align-items: center; gap: 7px; color: #d3d9cc; font-size: 12px; }
.ripple-nav select {
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #717b64;
  border-radius: 5px;
  background: #28352e;
  color: #ffe4a0;
  font: inherit;
}
.ripple-heading { text-align: center; }
.ripple-kicker { margin: 0 0 3px; color: var(--gold); font: 700 10px var(--mono); letter-spacing: 1.8px; }
.ripple-kicker span { margin-left: 8px; color: #a5b49f; font-weight: 400; letter-spacing: .4px; }
.ripple-heading h3 { margin: 0; color: #f6e5c0; font: 600 clamp(26px, 3.2vw, 36px)/1.14 var(--serif); }
.ripple-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .95fr);
  gap: clamp(15px, 2.7vw, 28px);
  align-items: start;
  margin-top: 13px;
}
.ripple-figure { min-width: 0; margin: 0; }
.ripple-frame {
  position: relative;
  isolation: isolate;
  width: min(100%, 340px);
  aspect-ratio: 1;
  margin: auto;
  overflow: hidden;
  border: 2px solid #a88f5e;
  border-radius: 7px;
  background: #111b21;
  box-shadow: 0 9px 24px #07100e88, inset 0 0 0 1px #f1d18e33;
}
.ripple-painting {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.76) brightness(.62);
  transition: filter .6s ease;
}
.ripple-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at 50% 50%, #0a171455, #0a1714bb);
  pointer-events: none;
}
.ripple-grid {
  position: absolute;
  z-index: 2;
  inset: 8.5%;
  display: grid;
  grid-template-columns: repeat(var(--ripple-cols, 3), minmax(0, 1fr));
  gap: clamp(5px, .65vw, 8px);
  align-content: center;
}
.ripple-tile { width: 100%; aspect-ratio: 1; min-height: 0; border-radius: 6px; position: relative; }
.ripple-tile .tile-symbol { width: 58%; height: 58%; }
.ripple-tile.is-ripple-target:not([data-fixed]) {
  outline: 2px dashed #ffe49c;
  outline-offset: 1px;
  filter: brightness(1.1);
}
.ripple-tile.error { outline: 2px solid #ff927c; outline-offset: 1px; animation: shake .23s ease-in-out 2; }
.ripple-tile.is-rippling { animation: ripple-pulse .34s ease-out; }
@keyframes ripple-pulse {
  0% { transform: scale(.92); box-shadow: 0 0 0 0 #ffd979cc; }
  65% { transform: scale(1.04); box-shadow: 0 0 0 7px #ffd97900; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 #ffd97900; }
}
.ripple-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: #d5e0cf;
  font: 12px var(--serif);
}
.ripple-frame.is-done { border-color: #e5c57d; box-shadow: 0 9px 24px #07100e88, 0 0 0 2px #e8c97c55; }
.ripple-frame.is-done .ripple-painting { filter: saturate(1.05) brightness(.92); }
.ripple-side { min-width: 0; }
.ripple-side .opening-line { margin: 0 0 10px; }
.ripple-cycle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 6px 9px;
  border: 1px solid #48584a;
  border-radius: 6px;
  background: #232f28;
  font-size: 11px;
  color: #c2cfb9;
}
.ripple-cycle i {
  font-style: normal;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  color: #1f2720;
}
.ripple-cycle i[data-v="0"] { background: #ede7d3; }
.ripple-cycle i[data-v="1"] { background: #e8b853; }
.ripple-cycle i[data-v="2"] { background: #6499a2; color: #f6fbff; }
.ripple-cycle em { font-style: normal; color: #909e8d; }
.ripple-rule-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid #4e5d4f;
  border-radius: 6px;
  background: #29352e;
}
.ripple-rule-chip { display: inline-flex; align-items: center; gap: 3px; color: #e8dbb8; font-size: 12px; }
.ripple-rule-chip .tile-symbol { width: 18px; height: 18px; }
.ripple-moves { width: 100%; color: #a9b8a3; font: 11px var(--mono); }
.ripple-side .mode-rules { margin: 8px 0; }
.ripple-message { min-height: 20px; margin: 4px 0 0; color: #dce7d2; font-size: 12px; line-height: 1.45; }
.ripple-message.ripple-bad { color: #ffcdbb; }
.ripple-message.ripple-good { color: #d6eab8; }
.ripple-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.ripple-actions .primary { flex: 1 1 150px; min-height: 36px; font-size: 13px; }
.ripple-actions button:not(.primary):not([hidden]) {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #697665;
  border-radius: 5px;
  color: #dfe6d7;
  font-size: 12px;
}
.ripple-actions button:not(.primary):hover { background: #39483b; }
.ripple-actions button:disabled { opacity: .42; }
.ripple-after { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ripple-after [hidden] { display: none; }
.ripple-foot { margin: 9px 0 0; color: #94a392; font-size: 10px; line-height: 1.5; }
@media (max-width: 680px) {
  .dialog-ripple { width: calc(100% - 18px); }
  .ripple-layout { grid-template-columns: 1fr; gap: 11px; margin-top: 9px; }
  .ripple-frame { width: min(100%, 320px); }
  .ripple-heading h3 { font-size: 25px; }
  .ripple-actions .primary { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ripple-tile, .ripple-painting { transition: none; }
  .ripple-tile.error, .ripple-tile.is-rippling { animation: none; }
}
