/* The score readout doubles as the brass tab for the player's records. */
.no-solution #verdict-label {order:0; color:inherit; font:inherit}
#no-solution:disabled {cursor:default; color:#d3bc9c; box-shadow:inset 0 1px 3px #1d110c}
.status #records-open {
  position:relative; display:flex; align-items:baseline; flex-wrap:wrap; min-width:44px; margin:0; padding:0;
  pointer-events:auto; text-align:left; border:0; border-radius:3px; background:transparent; color:inherit;
}
#records-open::before {
  content:""; position:absolute; inset-inline:0; top:50%; height:max(44px,100%); transform:translateY(-50%);
}
#records-open small {white-space:nowrap; text-transform:uppercase}
.records-link {
  margin-inline-start:3px; padding-inline-start:8px; border-inline-start:1px solid #aa865797;
  color:#ffe5b6; font:500 13px/1.1 Georgia,serif; letter-spacing:0; text-transform:none;
  text-decoration:underline; text-underline-offset:3px; text-decoration-color:#c9a369;
}
#records-open:hover .records-link, #win-records:hover {text-decoration-color:#ffe7b3}
#exit-replay {
  min-height:44px; padding:0 5px; border:0; background:transparent; color:#f9dfb6;
  text-decoration:underline; text-underline-offset:4px; font:600 15px Georgia,serif; white-space:nowrap;
}
#exit-replay[hidden], .header-tools:has(#exit-replay:not([hidden])) #how-to {display:none}
#records-open:focus-visible, #win-records:focus-visible, #exit-replay:focus-visible,
#records-dialog :is(button,summary):focus-visible {
  outline:2px solid #ffe4a3; outline-offset:2px;
}
.win-card #result {
  margin:18px 0 5px; color:#ffe2a6; font:600 clamp(19px,3.2vw,25px)/1.25 Georgia,serif;
  font-variant-numeric:lining-nums tabular-nums; letter-spacing:0;
}
.win-card p {color:#ecd8ba}
#score-detail {margin-bottom:16px; font:400 15px/1.35 Georgia,serif; color:#ebd4af; text-wrap:pretty}
#score-detail:empty {display:none}
.win-card #win-records {
  width:auto; min-height:44px; margin:4px auto -6px; padding:6px 12px; border:0;
  background:transparent; box-shadow:none; color:#f0d3a3; font:500 16px/1.2 Georgia,serif;
  text-decoration:underline; text-decoration-color:#b99562; text-underline-offset:4px; letter-spacing:0;
}

/* The fractured stamp carries the same diamond and center pin as the instrument. */
.broken-token, #win[data-outcome="broken"] .spark {display:none}
#win[data-outcome="broken"] .win-card {
  border-color:#cfab6b;
  background:radial-gradient(ellipse at 43% 0%,#a36b3045,transparent 67%),linear-gradient(145deg,#3d2518ed,#21160ffa),var(--relic-grain) center/cover;
}
#win[data-outcome="broken"] #win-title {color:#ffe5b6;font-size:clamp(2.15rem,8vw,3rem);line-height:1.04;letter-spacing:-.035em}
#win[data-outcome="broken"] #win-summary {max-width:25ch;margin:10px auto;line-height:1.36}
#win[data-outcome="broken"] .broken-token {
  display:block;position:relative;width:clamp(62px,12vmin,86px);aspect-ratio:1;
  margin:0 auto 12px;isolation:isolate;filter:drop-shadow(0 4px 2px #120a07ba);
}
.broken-token::before {
  content:"";position:absolute;inset:6%;border-radius:50%;background:linear-gradient(#9f683b,#ffe5a3 45%,#ce8b43 80%,#4a2b17);
  clip-path:polygon(57% 0,66% 0,54% 28%,61% 38%,49% 53%,55% 60%,39% 81%,44% 87%,36% 100%,27% 100%,37% 85%,33% 79%,47% 59%,42% 52%,53% 37%,48% 28%);
}
.broken-token i {
  position:absolute;inset:3%;display:grid;place-items:center;border:2px solid #c9a365;border-radius:50%;
  background:radial-gradient(circle,transparent 61%,#342010 62% 64%,#bb975d 65% 67%,#644221 68% 70%,transparent 71%),
    linear-gradient(135deg,#f5ce8f26,#331c0f44),url("excavation.webp?v=0424fdf9d1d8234e") 64% 52%/720% auto;
  box-shadow:inset 1px 1px 1px #ffdf9c,inset -2px -2px 2px #422b17;
}
.broken-token i::before,.broken-token i::after {content:"";position:absolute}
.broken-token i::before {
  width:34%;height:34%;border:3px double #dfb775;transform:rotate(45deg);
  background:#482e1966;box-shadow:inset 1px 1px 2px #27190e,0 1px 1px #362010;
}
.broken-token i::after {
  width:12%;height:12%;border:1px solid #a77d43;border-radius:50%;background:radial-gradient(circle at 35% 25%,#ffe7a7,#c19551 52%,#64431f);
}
.broken-token i:first-child {
  --apart:translate(-2%, -1%) rotate(-4deg);transform:var(--apart);
  clip-path:polygon(0 0,61% 0,51% 28%,57% 38%,46% 53%,51% 60%,36% 80%,40% 86%,32% 100%,0 100%);
}
.broken-token i:last-child {
  --apart:translate(3%, 2%) rotate(3deg);transform:var(--apart);
  clip-path:polygon(61% 0,100% 0,100% 100%,32% 100%,40% 86%,36% 80%,51% 60%,46% 53%,57% 38%,51% 28%);
}
@media (prefers-reduced-motion:no-preference) {
  #win[data-outcome="broken"]:not([hidden]) .broken-token i {animation:part-seal .42s cubic-bezier(.15,.78,.25,1) both}
  @keyframes part-seal {from {transform:none} to {transform:var(--apart)}}
}
@media (orientation:landscape) and (max-height:540px) {
  #win[data-outcome="broken"] .broken-token {width:44px;margin-bottom:3px}
  #win[data-outcome="broken"] #win-title {font-size:clamp(30px,8dvh,40px)}
  #win[data-outcome="broken"] #win-summary {max-width:none;margin:4px auto}
}

/* The lacquered cabinet edge stays fixed while the ledger can scroll independently. */
#records-dialog {
  --record-edge-x:max(10px,var(--safe-left),var(--safe-right));
  --record-edge-y:max(9px,var(--safe-top),var(--safe-bottom));
  width:min(36rem,calc(100vw - 2 * var(--record-edge-x))); max-width:none;
  max-height:calc(100dvh - 2 * var(--record-edge-y)); padding:0; overflow:hidden;
  border:3px double #c4a06b; border-radius:5px; color:#f6e5c6;
  background:linear-gradient(116deg,#382317ed,#24170ff5 65%),var(--relic-grain) center/cover,#392418;
  box-shadow:inset 0 0 0 2px #281a11,0 13px 45px #160d08c2;
  font:400 16px/1.3 Georgia,serif; font-variant-numeric:lining-nums tabular-nums;
}
#records-dialog[open] {display:flex; flex-direction:column}
#records-dialog::backdrop {background:#1a110ac4; backdrop-filter:blur(4px)}
html:has(#records-dialog[open]) {overflow:hidden}
.records-heading {
  display:flex; flex:none; justify-content:space-between; align-items:flex-start; gap:8px;
  padding:clamp(14px,3.5vw,24px) clamp(13px,4vw,26px) 13px;
  border-bottom:1px solid #b8965f76; box-shadow:0 1px #1f120b;
}
#records-title {margin:0; color:#fbe4b2; font:600 clamp(26px,5vw,34px)/1.1 Georgia,serif; letter-spacing:-.035em}
#records-summary {margin:5px 0 0; color:#debf92; font-size:14px; line-height:1.25}
#records-close {
  display:grid; place-items:center; flex:none; width:44px; height:44px; margin:-5px -7px 0 0;
  padding:0; border:1px solid #97764b; border-radius:3px; background:#3f2b1d; color:#ffe0ac;
  font:400 26px/1 Georgia,serif;
}
#records-close:hover {background:#583d28}
.records-scroll {overflow:auto; overscroll-behavior:contain; padding:12px clamp(12px,4vw,26px) 15px; scrollbar-color:#966f46 #302016}
#records-filters {display:flex; gap:3px; margin:0 -2px 8px}
#records-filters button, .record-replay, #records-more {
  min-height:44px; padding:6px 8px; border:1px solid transparent; background:transparent;
  color:#edcf9f; font:500 15px/1 Georgia,serif;
}
#records-filters button {flex:1 0 0; max-width:5.3rem; border-radius:2px; border-bottom-color:#9070477a}
#records-filters button[aria-pressed="true"] {
  background:linear-gradient(130deg,#e8cb93,#c5a16a); border-color:#e0c18e; color:#332116;
  box-shadow:inset 0 0 0 2px #8461326b; font-weight:700;
}
#records-filters button:hover:not([aria-pressed="true"]), .record-replay:hover, #records-more:hover {background:#b58d531a}
#records-table {width:100%; border-collapse:collapse; table-layout:auto}
#records-dialog [hidden] {display:none}
#records-table th {
  padding:8px 4px; border-bottom:1px solid #ac895bbd; color:#d0ad7b; font-size:13px; font-weight:400;
}
#records-table td {padding:7px 4px; border-bottom:1px solid #9d784c4d; vertical-align:middle}
#records-table :is(td,th):first-child {width:2rem; padding-left:0; text-align:left; color:#c6a777}
#records-table th:nth-child(2) {text-align:left}
#records-table :is(th,td):nth-child(n+3) {text-align:right}
#records-table :is(td,th):last-child {width:6.4rem; padding-right:0}
.record-name, .record-points {display:block; color:#f9e1b4; font-size:17px; line-height:1.16}
.record-outcome, .record-penalty {display:block; margin-top:2px; color:#d1b592; font-size:13px; line-height:1.2}
.record-penalty {color:#f0b597}
.record-replay {min-width:44px; padding:6px 3px; color:#f0c382; text-decoration:underline; text-underline-offset:4px}
.record-actions {display:flex; align-items:center; justify-content:flex-end; gap:3px}
#records-empty {margin:18px 0; padding:12px 0; color:#efd8b5; font-size:16px}
#records-more {display:block; margin:6px auto; text-decoration:underline; text-underline-offset:4px}
#records-scoring {margin-top:12px; border-top:1px solid #b08b586b; color:#dfc7a4}
#records-scoring summary {
  min-height:44px; padding:11px 0; color:#e8c995; font-size:15px; cursor:pointer;
}
#records-scoring p {margin:0 0 .65em; line-height:1.42}
#records-scoring p:last-child {margin-bottom:0}
.record-email,.share-result,#share-dialog a {
  color:#ead0a5;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;
}
.record-email {display:inline-flex;align-items:center;min-height:30px;font:500 13px/1.2 Georgia,serif}
.win-card .share-result {
  display:inline-flex;align-items:center;justify-content:center;min-height:44px;width:auto;margin:0;
  padding:5px 9px;border:0;background:transparent;box-shadow:none;color:#f5d7a7;font:500 15px/1.2 Georgia,serif;letter-spacing:0;
}
.win-card .share-result[hidden],.win-card #win-records[hidden],#records-open [hidden] {display:none}
#share-dialog {
  box-sizing:border-box;width:min(400px,calc(100vw - 28px));max-height:calc(100dvh - 20px);overflow:auto;
  margin:auto;padding:18px;border:1px solid #ac8958;border-radius:5px;color:#f2ddba;
  background:linear-gradient(155deg,#402e20f5,#21160ffc),var(--relic-grain) center/cover;
  box-shadow:inset 0 0 0 3px #8a693d40,0 12px 46px #130b0780;font:500 16px/1.4 Georgia,serif
}
#share-dialog::backdrop {background:#191007b3}
#share-dialog header {position:static;display:flex;justify-content:space-between;gap:10px;align-items:center;padding:0;background:none;border:0;pointer-events:auto}
#share-dialog header::before,#share-dialog header::after {display:none}
#share-dialog h2 {margin:0;color:#ffe1a9;font:600 25px/1.1 Georgia,serif;letter-spacing:0}
#share-dialog p {margin:7px 0 14px}
#share-dialog input {box-sizing:border-box;width:100%;padding:9px;border:1px solid #96764d;border-radius:2px;background:#241a12;color:#f5e2bc;font:15px Georgia,serif}
#share-dialog button {min-width:44px;min-height:44px;border:1px solid #8f704c;border-radius:2px;padding:4px 9px;background:#403022;color:#ffe5bc;font:600 15px Georgia,serif}
#share-dialog .share-actions {display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:12px}
#share-dialog a {display:inline-flex;align-items:center;min-height:44px}
#share-dialog [role="status"] {color:#dfbe88;font-size:14px}
.record-email:focus-visible,.share-result:focus-visible,#share-dialog :focus-visible {outline:2px solid #ffe4a3;outline-offset:2px}
.records-sr {position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap}
@media (max-width:400px) {
  .status .progress {display:none}
  .records-link {font-size:12px}
  #records-table :is(td,th) {padding-inline:2px}
  #records-table :is(td,th):first-child {width:1.25rem}
  #records-table :is(td,th):last-child {width:3.25rem}
  .record-actions {flex-direction:column; align-items:flex-end; gap:0}
}
@media (orientation:landscape) and (max-height:540px) {
  .records-heading {padding:10px 17px 8px}
  #records-title {font-size:26px}
  .records-scroll {padding-block:5px 8px}
  #records-filters {margin-bottom:2px}
  .win-card #result {margin:5px 0}
  .win-card #score-detail {margin-bottom:6px}
  .win-card #win-records {margin:0}
}
