/* Nine Gates Mahjong: the title screen. The painted key art fills the window (its logo is the title); over it a short menu on the
   left and the journey along the bottom: nine gate medallions on a winding path, with their stars, the next gate glowing, the gates
   not reached yet dim and locked. No panel, no page furniture. Short windows keep the art and shrink the path; a phone held upright
   gets the art as a banner and the gates as three rows of three. */

.sr-only{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}

body[data-mode="journey"]::before{background:url("/assets/games/nine-gates-mahjong-cover.webp") center top/cover no-repeat,#031011;filter:none}
body[data-mode="journey"]::after{background:linear-gradient(90deg,#020b0bd9 0,#020b0b8c 20%,transparent 44%),linear-gradient(180deg,transparent 0 44%,#020b0bb8 64%,#020b0bf5 100%)}
body[data-mode="journey"] .shell{background:none}
body[data-mode="journey"] .topbar{background:transparent;border-color:transparent;backdrop-filter:none}
body[data-mode="journey"] .topbar .brand,body[data-mode="journey"] .topbar nav{visibility:hidden}
body[data-mode="journey"] .round{background:#041011b3;backdrop-filter:blur(6px)}

#journey-view{position:relative;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto auto;gap:0;align-items:end;height:100%;padding:0 clamp(14px,3.6vw,60px) 6px;overflow:hidden}
#journey-view .hero-copy{justify-self:start;width:min(clamp(310px,21vw,430px),82vw);max-width:none;margin:0 0 clamp(8px,3.4vh,40px);padding:0;background:none;border:0;box-shadow:none;backdrop-filter:none;overflow:visible}
#journey-view .hero-copy::after{display:none}
.tagline{width:max-content;max-width:min(560px,84vw);margin:0 0 12px!important;color:#ffe6a6!important;font-size:11px!important;letter-spacing:.2em;text-shadow:0 1px 4px #000,0 0 14px #000}
#journey-view .hero-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:9px;margin:0}
.menu-main,.menu-button{width:100%;text-align:start;font:700 clamp(17px,1.2vw,22px) var(--display);letter-spacing:.05em;border-radius:10px;cursor:pointer;transition:transform .12s ease-out,filter .12s,box-shadow .12s}
.menu-main{min-height:clamp(56px,6.2vh,72px);padding:12px 20px;font-size:clamp(19px,1.35vw,25px);border:1px solid #fff0b8;background:linear-gradient(160deg,#f6d27a,#c8912f 46%,#8d5a17);color:#1c0f03;box-shadow:2px 6px 18px #000b,inset 0 1px 0 #fffc,inset 0 -2px 0 #0003;text-shadow:0 1px 0 #ffffff66}
.menu-button{min-height:clamp(46px,5vh,58px);padding:9px 20px;border:1px solid #d9a84b99;background:linear-gradient(160deg,#17463dee,#0a2622ee 55%,#051512ee);color:#f3e6c0;box-shadow:2px 5px 14px #000a,inset 0 1px 0 #ffffff2e,inset 0 -1px 0 #0008;backdrop-filter:blur(4px)}
.menu-main:hover,.menu-button:hover,.menu-main:focus-visible,.menu-button:focus-visible{transform:translateX(6px);filter:brightness(1.1)}
.menu-button:hover,.menu-button:focus-visible{border-color:var(--gold2);box-shadow:2px 5px 14px #000a,0 0 16px #ffdb7844,inset 0 1px 0 #ffffff2e}
#journey-view .daily-note{margin:-3px 0 0 4px!important;font-size:12px!important;color:#d6e2d3!important;text-shadow:0 1px 3px #000}
.menu-links{display:flex;flex-wrap:wrap;gap:4px 18px;margin-top:6px}
.link-button{padding:6px 2px;border:0;border-bottom:1px solid #d9a84b66;background:none;color:#e9dfc5;font:700 13px var(--display);letter-spacing:.06em;cursor:pointer;text-shadow:0 1px 4px #000;min-height:32px}
.link-button:hover,.link-button:focus-visible{color:var(--gold2);border-color:var(--gold2)}

/* ---- the journey */
.journey-strip{position:relative;min-width:0}
.strip-stars{position:absolute;right:0;bottom:calc(100% + 6px);margin:0;display:inline-flex;align-items:baseline;gap:6px;color:#d6e2d3;font-size:12px;text-shadow:0 1px 3px #000}
.strip-stars b{color:var(--gold2);font:700 18px var(--display)}
#gate-path{--gd:clamp(46px,9vh,82px);position:relative;display:flex;gap:0;align-items:flex-start;min-height:calc(var(--gd)*1.375 + 44px)}
.gate-trail{position:absolute;left:0;top:0;width:100%;height:calc(var(--gd)*1.375);pointer-events:none;overflow:visible}
.gate-trail path{fill:none;stroke:#f1d58a55;stroke-width:3;stroke-dasharray:2 9;stroke-linecap:round}
.gate-trail path.walked{stroke:#ffe08a;stroke-dasharray:none;stroke-width:3;filter:drop-shadow(0 0 5px #ffdb78)}
#journey-view .gate{flex:1 1 0;min-width:0;display:grid;justify-items:center;align-content:start;gap:3px;margin-top:calc(var(--o,0)*var(--gd)*.375);padding:0;border:0;background:none;box-shadow:none;opacity:1;backdrop-filter:none;color:var(--ink);font:inherit;text-align:center;cursor:pointer;position:relative;z-index:1}
.gate-disc{display:block;width:var(--gd);height:var(--gd);border-radius:50%;filter:drop-shadow(2px 5px 6px #000c);transition:transform .14s ease-out,filter .14s}
.gate-disc svg{display:block;width:100%;height:100%}
.gate-name{font:700 clamp(10.5px,1.05vw,14px) var(--display);letter-spacing:.03em;color:#f6e7bd;text-shadow:0 1px 3px #000,0 0 10px #000;line-height:1.15;padding:0 2px}
.gate-stars{display:flex;gap:2px;justify-content:center}
.gate-star{width:13px;height:13px;fill:#ffffff24;stroke:#00000066;stroke-width:1}
.gate-star.on{fill:#ffd35c;stroke:#7a4d08;filter:drop-shadow(0 0 3px #ffdb78aa)}
#journey-view .gate:hover:not(:disabled) .gate-disc,#journey-view .gate:focus-visible .gate-disc{transform:translateY(-4px) scale(1.06);filter:drop-shadow(2px 8px 8px #000c) drop-shadow(0 0 10px #ffdb7899)}
#journey-view .gate:focus-visible{outline:none}
#journey-view .gate.next .gate-disc{animation:ng-gate-glow 2.4s ease-in-out infinite}
@keyframes ng-gate-glow{0%,100%{filter:drop-shadow(2px 5px 6px #000c) drop-shadow(0 0 4px #ffdb7866)}50%{filter:drop-shadow(2px 5px 6px #000c) drop-shadow(0 0 16px #ffe9a8)}}
#journey-view .gate.locked{cursor:default}
#journey-view .gate.locked .gate-disc{filter:drop-shadow(2px 5px 6px #000c) saturate(.2) brightness(.6)}
#journey-view .gate.locked .gate-name{color:#a3afa7}
#journey-view .gate.locked .gate-stars{visibility:hidden}

/* ---- the foot: counted facts, save note, copyright */
.title-foot{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:2px 18px;padding-top:4px;border-top:1px solid #ffffff14;min-width:0}
#journey-view .hero-metrics{display:flex;gap:4px 16px;flex-wrap:wrap;margin:0;padding:0;border:0}
#journey-view .hero-metrics span{color:#93a199;font-size:11px}
#journey-view .hero-metrics b{display:inline;margin-inline-end:4px;color:#d9c98f;font:700 12px var(--display)}
#journey-view .save-notice,#journey-view .copyright{margin:0!important;font-size:11px!important;color:#7f8c85!important;line-height:1.3}

/* ---- short windows: the art stays, the menu and the path shrink */
@media (max-height:600px){
  .scene{display:block}.scene .mist,.scene .lantern.l3,.scene .lantern.l4{display:none}
  #journey-view .hero-copy{width:min(clamp(200px,24vw,250px),60vw);margin-bottom:8px}
  .tagline{display:none}
  #journey-view .hero-actions{gap:6px}
  .menu-main{min-height:40px;padding:6px 14px;font-size:15px}.menu-button{min-height:34px;padding:4px 14px;font-size:13.5px}
  #journey-view .daily-note,#journey-view .save-notice,#journey-view .hero-metrics{display:none}
  .menu-links{margin-top:0;flex-wrap:nowrap;width:max-content;gap:4px 14px}.link-button{min-height:26px;padding:2px;font-size:11.5px}
  #gate-path{--gd:clamp(34px,10.5vh,52px);min-height:calc(var(--gd)*1.375 + 30px)}
  .gate-star{width:10px;height:10px}.gate-name{font-size:10.5px}
  .title-foot{justify-content:flex-end;border:0;padding:0}
}

/* ---- a phone held upright: the art is a banner, the gates stand three by three */
@media (max-width:899px) and (orientation:portrait){
  body[data-mode="journey"]::before{background:url("/assets/games/nine-gates-mahjong-cover.webp") top center/100% auto no-repeat,#031011}
  body[data-mode="journey"]::after{background:linear-gradient(180deg,transparent 0 20%,#031011e6 31%,#031011 36%)}
  .scene{display:none}
  #journey-view{grid-template-rows:auto auto auto;align-content:start;align-items:start;gap:12px;padding:calc(56.25vw - 66px) 16px 8px;overflow:auto}
  #journey-view .hero-copy{width:100%;margin:0}
  .tagline{text-align:center;width:auto;max-width:none}
  .menu-main,.menu-button{text-align:center}
  .menu-main:hover,.menu-button:hover{transform:none}
  .menu-links{justify-content:center}
  #journey-view .daily-note{text-align:center}
  .strip-stars{position:static;display:flex;justify-content:center;margin:0 0 8px}
  #gate-path{--gd:56px;flex-wrap:wrap;row-gap:8px;min-height:0}
  .gate-trail{display:none}
  #journey-view .gate{flex:0 0 33.333%;margin-top:0}
  .gate-name{font-size:12px}
  .title-foot{justify-content:center;text-align:center}
}

@media (prefers-reduced-motion:reduce){#journey-view .gate.next .gate-disc{animation:none}.menu-main,.menu-button,.gate-disc{transition:none}}
.ng-reduced-motion #journey-view .gate.next .gate-disc{animation:none}

/* the journey runs from the first gate on the left in every language (the drawn path does not mirror) */
#gate-path{direction:ltr}
