/* Nine Gates Mahjong: the result card and the small things of play from the keyboard. The card is an object like the table: a
   lacquer rim with a gold line, lit from the upper left. It carries the winning hand in one row, the scoring lines, and the four
   seats with what the hand paid or cost them and their new totals, which count up (at once with reduced motion). */

.result-modal{background:radial-gradient(ellipse at 50% 38%,#000000a6,#000000d9)}
.result-modal>.result-card{width:min(780px,94vw);max-height:calc(100dvh - 28px);overflow:auto;padding:24px 30px 20px;border:0;border-radius:20px;text-align:center;
  background:radial-gradient(ellipse 70% 50% at 28% 0,#ffe9a81a,transparent 70%),linear-gradient(160deg,#154238,#0a2521 46%,#061513);
  box-shadow:0 0 0 1px #e6bd66,0 0 0 8px #48140e,0 0 0 9px #d9a84b88,inset 0 1px 0 #ffffff33,inset 0 0 70px #00000080,8px 22px 60px #000e;
  animation:ng-card-in .2s ease-out backwards}
@keyframes ng-card-in{from{opacity:0;transform:translateY(14px) scale(.97)}}
.result-modal .result-card h2{margin:4px 0 6px;font:700 clamp(28px,4.6vh,44px) var(--display);color:var(--gold2);letter-spacing:.03em;text-shadow:0 2px 0 #5a3a08,0 0 26px #ffdb7855}
.result-modal .result-card>p{margin:0 0 8px}
.result-card .result-hand{flex-wrap:nowrap;gap:2px;margin:12px 0 14px;justify-content:center}
.result-card .result-hand .ng-tile{--tw:clamp(20px,min(4.4vw,5.6vh),44px)}
.result-card .result-hand.has-yaku{gap:9px 7px;padding:6px 8px}
.result-scores{list-style:none;margin:12px auto 12px;padding:0;display:grid;gap:4px;max-width:540px}
.result-scores li{display:grid;grid-template-columns:26px 28px minmax(0,1fr) auto 5.4em;align-items:center;gap:10px;padding:5px 14px 5px 8px;border-radius:999px;background:#00000038;box-shadow:inset 0 0 0 1px #ffffff12;text-align:start;font-size:14px}
.result-scores li.winner{background:linear-gradient(90deg,#ffdb7833,#00000038 70%);box-shadow:inset 0 0 0 1px #ffdb7899}
.result-scores .wind{font-style:normal;display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#00000066;box-shadow:inset 0 0 0 1px #ffffff26;color:#e9dfc5;font:700 14px var(--ng-glyph-font,serif)}
.rs-medal{display:block;line-height:0}
.rs-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#e6ecdf;font-weight:700}
.rs-delta{font-variant-numeric:tabular-nums;font-weight:800;letter-spacing:.02em}
.up .rs-delta{color:#7ff0c9}.down .rs-delta{color:#ff9d8f}
.rs-total{text-align:end;color:var(--gold2);font:700 17px var(--display);font-variant-numeric:tabular-nums}
.result-modal .result-card small{margin-bottom:12px}
.result-actions{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.result-actions button{min-height:46px;min-width:170px}
.result-modal>.result-card #result-next{position:static;width:auto}
#result-review{margin:0}

@media (max-width:640px){.result-card .result-hand{flex-wrap:wrap}.result-modal>.result-card{padding:18px 14px 14px}.result-scores li{font-size:13px;gap:7px}.result-actions button{min-width:0;flex:1 1 140px}}
@media (max-height:560px){
  .result-modal>.result-card{padding:10px 18px 0;max-height:calc(100dvh - 20px)}
  .result-modal .result-card h2{font-size:24px;margin:0 0 2px}.result-modal .result-card .eyebrow{display:none}
  .result-card .result-hand{margin:6px 0 8px}
  .result-scores{grid-template-columns:1fr 1fr;max-width:none;margin:8px 0}.result-scores li{padding:3px 10px 3px 6px;font-size:12.5px;grid-template-columns:22px minmax(0,1fr) auto 4.6em;gap:6px}.rs-medal{display:none}.rs-total{font-size:14px}.result-scores .wind{width:20px;height:20px;font-size:12px}
  .result-actions{position:sticky;bottom:0;padding:8px 0 10px;background:linear-gradient(180deg,transparent,#081d1a 34%)}
  .result-actions button{min-height:38px}
}

/* ---- keyboard: the cursor on the hand, key caps on the buttons a key can press (only where there is a keyboard to press) */
.tile-button.cursor{transform:translateY(calc(var(--hw)*-.2))}
.tile-button.cursor::before{content:"";position:absolute;inset:calc(var(--hw)*-.05) calc(var(--hw)*-.05) calc(var(--hw)*-.12);border:3px solid var(--gold2);border-radius:calc(var(--hw)*.14);box-shadow:0 0 14px #ffdb78aa;pointer-events:none;z-index:2}
@media (hover:hover) and (pointer:fine){
  .corner-button[data-corner="keys"]{display:inline-grid}
  [data-key]:not([data-key=""])::after{content:attr(data-key);display:inline-block;margin-inline-start:9px;padding:0 6px;border-radius:5px;border:1px solid currentColor;font:700 11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;opacity:.72;vertical-align:1px}
}
@media (prefers-reduced-motion:reduce){.result-modal>.result-card{animation:none}}
.ng-reduced-motion .result-modal>.result-card{animation:none}

/* ---- the windows (settings, rivals, record) and the tip banner are the same object as the result card */
.settings-dialog,.rivals-dialog,.stats-dialog{border:0;border-radius:18px;margin:auto;
  background:radial-gradient(ellipse 70% 40% at 28% 0,#ffe9a814,transparent 70%),linear-gradient(160deg,#154238,#0a2521 46%,#061513);
  box-shadow:0 0 0 1px #e6bd66,0 0 0 7px #48140e,0 0 0 8px #d9a84b88,inset 0 1px 0 #ffffff33,inset 0 0 60px #00000070,8px 22px 60px #000e}
.settings-dialog::backdrop,.rivals-dialog::backdrop,.stats-dialog::backdrop{background:radial-gradient(ellipse at 50% 38%,#000000a6,#000000d9)}
.settings-dialog select,.sol-settings select,.rule-tools input,.rule-tools select{border-radius:8px}
.rival-card{border-radius:14px;box-shadow:2px 4px 10px #0008,inset 0 1px 0 #ffffff14}
.tip{border-radius:14px;border-color:#5fe3c4aa;background:linear-gradient(160deg,#124038f7,#07201cfa);box-shadow:3px 8px 22px #000c,inset 0 1px 0 #ffffff26}
.gold-button,.ghost-button{border-radius:9px}
.gold-button{background:linear-gradient(160deg,#f6d27a,#c8912f 46%,#8d5a17);border-color:#fff0b8;box-shadow:inset 0 1px 0 #fffc,inset 0 -2px 0 #0003,2px 5px 14px #0009}
.ghost-button{background:linear-gradient(160deg,#17463dee,#0a2622ee 55%,#051512ee);border-color:#d9a84b88;color:#f3e6c0;box-shadow:inset 0 1px 0 #ffffff26,2px 4px 10px #0008}
