/* Nine Gates Mahjong: the premium look. A title screen that shows the painted key art with drifting mist, falling blossoms and glowing lanterns, a lacquered table with
   lantern light, wall stacks that shrink as tiles are drawn, a dealer marker, a score ribbon and a fanned hand on the win card, and a gate-clear moment with shimmering stars.
   Ambient motion here is slow and decorative; everything stops with body.ng-reduced-motion and prefers-reduced-motion. Table cloths come from the --cloth-* variables. */

:root{--cloth-a:#126052;--cloth-b:#0a4037;--cloth-c:#072f29;--cloth-d:#051d1b;--lacquer-a:#7a2a1c;--lacquer-b:#3b110c;--lacquer-c:#8a3322}
body[data-cloth="indigo"]{--cloth-a:#2a4a86;--cloth-b:#1b3366;--cloth-c:#122452;--cloth-d:#0a1636}
body[data-cloth="crimson"]{--cloth-a:#8a2a2e;--cloth-b:#661b22;--cloth-c:#48121a;--cloth-d:#2a0a10}
body[data-cloth="ink"]{--cloth-a:#3a3f46;--cloth-b:#262a30;--cloth-c:#181b20;--cloth-d:#0c0e11}
body[data-back="crimson"] .ng-tile[data-body="back"] .ng-tile__body{filter:sepia(1) hue-rotate(-42deg) saturate(3) brightness(.95)}
body[data-back="indigo"] .ng-tile[data-body="back"] .ng-tile__body{filter:sepia(1) hue-rotate(185deg) saturate(2.6) brightness(.9)}

/* the painted key art sits behind the page: the canvas is dark, the body lets it through (a negative z-index layer paints under an opaque body) */
html{background:#031011}body{background:transparent}

/* ---- title screen: the key art is the scene */
.scene{position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:0}
.mist{position:absolute;left:-20%;width:140%;height:22%;background:radial-gradient(ellipse at 30% 50%,#ffffff33,transparent 62%),radial-gradient(ellipse at 75% 40%,#fff2cf2b,transparent 60%);filter:blur(10px);animation:ng-drift 70s linear infinite}
.mist.m1{top:30%}.mist.m2{top:48%;animation-duration:110s;animation-direction:reverse;opacity:.7}
@keyframes ng-drift{from{transform:translateX(-8%)}to{transform:translateX(8%)}}
.petal{position:absolute;top:-24px;width:10px;height:7px;border-radius:70% 30% 70% 30%;background:linear-gradient(135deg,#ffe3ea,#f3a8bc);opacity:.85;animation:ng-fall 16s linear infinite}
.petal.p1{left:8%;animation-delay:-2s}.petal.p2{left:23%;animation-delay:-9s;animation-duration:19s}.petal.p3{left:41%;animation-delay:-5s}.petal.p4{left:63%;animation-delay:-12s;animation-duration:21s}.petal.p5{left:78%;animation-delay:-7s}.petal.p6{left:92%;animation-delay:-14s;animation-duration:18s}
@keyframes ng-fall{0%{transform:translate(0,0) rotate(0)}50%{transform:translate(40px,48vh) rotate(160deg)}100%{transform:translate(-20px,104vh) rotate(320deg)}}
.lantern{position:absolute;top:-6px;width:46px;height:92px;transform-origin:50% 0;animation:ng-sway 7s ease-in-out infinite alternate;filter:drop-shadow(0 0 16px #ffa43c99)}
.lantern.l1{left:4%}.lantern.l2{right:4%;animation-delay:-3s}.lantern.l3{left:19%;top:-26px;width:34px;height:68px;animation-delay:-1.5s}.lantern.l4{right:19%;top:-26px;width:34px;height:68px;animation-delay:-4.5s}
@keyframes ng-sway{from{transform:rotate(-2.6deg)}to{transform:rotate(2.6deg)}}
.journey{position:relative}
.journey>*:not(.scene){position:relative;z-index:1}

@media (max-height:600px),(max-width:899px){.scene{display:none}}
@media (prefers-reduced-motion:reduce){.mist,.petal,.lantern{animation:none!important}}
.ng-reduced-motion .mist,.ng-reduced-motion .petal,.ng-reduced-motion .lantern{animation:none!important}

/* ---- the win moment: a score ribbon and a fanned hand (each motion under 250 ms; none with reduced motion) */
.result-modal strong{display:inline-block;margin:6px 0 2px;padding:7px 34px;background:linear-gradient(#f1c966,#b27a22);color:#2b1204;font:700 20px var(--display);letter-spacing:.04em;text-shadow:0 1px 0 #ffffff66;clip-path:polygon(0 0,100% 0,96.5% 50%,100% 100%,0 100%,3.5% 50%);filter:drop-shadow(0 3px 6px #000a);animation:ng-ribbon .22s ease-out backwards}
@keyframes ng-ribbon{from{opacity:0;transform:scaleX(.6)}}
.result-hand .rt{animation:ng-fan .2s ease-out backwards;animation-delay:calc(var(--i,0)*6ms)}
@keyframes ng-fan{from{opacity:0;transform:translateY(26px) rotate(calc((var(--i,0) - 6)*4deg)) scale(.82)}}
.ng-reduced-motion .result-modal strong,.ng-reduced-motion .result-hand .rt{animation:none}
@media (prefers-reduced-motion:reduce){.result-modal strong,.result-hand .rt{animation:none!important}}

/* ---- the gate-clear moment: the cleared gate, a ring of light and the earned stars shimmering (no input is taken; it fades by itself) */
.gate-clear{position:fixed;left:50%;top:38%;z-index:90;transform:translate(-50%,-50%);display:grid;justify-items:center;gap:10px;padding:26px 44px;border:1px solid var(--gold2);border-radius:18px;background:radial-gradient(ellipse at 50% 0,#14362dee,#061313f5);box-shadow:0 0 60px #ffdb7855,var(--shadow);pointer-events:none;animation:ng-clear-in .22s ease-out backwards,ng-clear-out .3s ease-in 2.5s forwards}
.gate-clear[hidden]{display:none}
.gate-clear b{font:700 26px var(--display);color:var(--gold2);letter-spacing:.04em;text-align:center}
.gc-stars{display:flex;gap:10px;font-size:40px;line-height:1}
.gc-stars i{font-style:normal;color:#ffffff22}
.gc-stars i.on{background:linear-gradient(100deg,#d9a84b 0 38%,#fff6c8 50%,#d9a84b 62% 100%) 0 0/250% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:ng-shimmer 1.1s ease-in-out .15s 2}
@keyframes ng-shimmer{from{background-position:120% 0}to{background-position:-40% 0}}
@keyframes ng-clear-in{from{opacity:0;transform:translate(-50%,-44%) scale(.9)}}
@keyframes ng-clear-out{to{opacity:0}}
.ng-reduced-motion .gate-clear,.ng-reduced-motion .gc-stars i.on{animation:none}
@media (prefers-reduced-motion:reduce){.gate-clear,.gc-stars i.on{animation:none!important}}

/* a short window: the button of the result card stays reachable */
@media (max-height:560px){.result-modal>div #result-next{position:sticky;bottom:0;width:100%}}

/* ---- review, record and daily note */
.daily-note{margin:8px 0 0!important;font-size:12px!important;color:#b9c8bd!important}
.daily-banner{color:var(--gold2)!important;font-weight:700}
.review-panel{margin:0 0 12px;text-align:left;padding:10px 12px;border:1px solid #ffffff1c;border-radius:8px;background:#071c19}
.review-panel h3{margin:0 0 6px;font:700 16px var(--display);color:var(--gold2)}
.review-panel p{margin:0 0 6px;font-size:13px;line-height:1.45;color:#d3dccf}
.rv-list{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.rv-list li{display:grid;grid-template-columns:auto 1fr;gap:12px;align-items:center;padding-top:8px;border-top:1px solid #ffffff12}
.rv-tiles{display:flex;align-items:center;gap:6px;--tw:30px}
.rv-tiles .ng-tile{--tw:30px}
.rv-arrow{font-style:normal;color:var(--gold2);font-size:18px}
[dir=rtl] .rv-arrow{display:inline-block;transform:scaleX(-1)}
.rv-why{color:#9fe3cf!important;font-size:12px!important}
#result-review{margin-inline-end:8px}
.stats-dialog{border:1px solid var(--gold);background:linear-gradient(145deg,#0a2924,#071414);color:var(--ink);padding:22px 26px;width:min(460px,94vw);max-height:94dvh;overflow:auto;box-shadow:var(--shadow)}
.stats-dialog::backdrop{background:#000b}
.stats-dialog h2{font:700 24px var(--display);color:var(--gold2);margin:0 0 2px}
.stats-note{margin:0 0 14px;color:#9faea6;font-size:12px}
.stats-list{margin:0 0 16px}
.stats-list div{display:flex;justify-content:space-between;gap:16px;padding:7px 0;border-bottom:1px solid #ffffff10}
.stats-list dt{color:#c3cdc2;font-size:13px}.stats-list dd{margin:0;color:var(--gold2);font:700 15px var(--display);font-variant-numeric:tabular-nums}
.stats-dialog .gold-button{width:100%}

.talk-bubble{width:max-content}

