/* 神話輪迴錄 — shared DOM UI style (gothic gilded icon look). Both ui-run.js and ui-meta.js use these classes. */
:root {
  --gold: #e2bf74; --gold-dark: #8a6a2c; --ink: #f4e6c4; --outline: #160a06; --crimson: #8e1420; --blood: #c42a2a;
  --verdigris: #4f9a8a; --night: #0c0807; --font: "Times New Roman", serif; --font-title: "Times New Roman", serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
#stage { position: fixed; inset: 0; overflow: hidden; background: var(--night); font-family: var(--font); color: var(--ink); }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui .screen { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; }
#ui .screen.passthrough { pointer-events: none; }
#ui .screen.passthrough .tap { pointer-events: auto; }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
#fade.on { opacity: 1; }
/* subtitles sit at the very top between the platform's corner buttons; during play (.inrun) just under the HUD */
#subtitle { position: absolute; left: 58px; right: 58px; top: calc(8px + var(--safe-t)); text-align: center; font-size: 14px; line-height: 1.3; color: var(--ink);
  background: rgba(10,6,5,.55); border-radius: 8px; padding: 6px 10px; pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 60; }
#subtitle.on { opacity: 1; }
#subtitle.inrun { left: 6%; right: 6%; top: calc(164px + var(--safe-t)); font-size: 15px; }

/* text with a dark outline and hard shadow */
.ol { text-shadow: -2px -2px 0 var(--outline), 2px -2px 0 var(--outline), -2px 2px 0 var(--outline), 2px 2px 0 var(--outline),
  0 -2px 0 var(--outline), 0 2px 0 var(--outline), -2px 0 0 var(--outline), 2px 0 0 var(--outline), 0 4px 0 rgba(0,0,0,.6); }
.ol-thin { text-shadow: -1px -1px 0 var(--outline), 1px -1px 0 var(--outline), -1px 1px 0 var(--outline), 1px 1px 0 var(--outline), 0 2px 2px rgba(0,0,0,.7); }
.title-font { font-family: var(--font-title); font-weight: 700; letter-spacing: .04em; }
.gold { color: var(--gold); }

/* 9-slice panel from ui-panel */
.panel { border-style: solid; border-width: 26px; border-image: url(../assets/ui-panel.webp) 20% fill / 26px stretch;
  padding: 6px; color: var(--ink); filter: drop-shadow(0 6px 14px rgba(0,0,0,.6)); }
.panel-inner { padding: 4px 6px; }

/* 9-slice button from ui-button */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; min-width: 96px;
  padding: 2px 18px; border-style: solid; border-width: 14px 18px; border-image: url(../assets/ui-button.webp) 26% 9% fill / 14px 18px stretch;
  background: none; color: var(--ink); font-family: var(--font-title); font-weight: 700; font-size: 18px; cursor: pointer;
  transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .15s; outline: none; }
.btn:hover, .btn.focus { transform: scale(1.04); filter: brightness(1.18) drop-shadow(0 0 8px rgba(226,191,116,.55)); }
.btn:active { transform: scale(.94); }
.btn.primary { font-size: 21px; min-height: 58px; filter: drop-shadow(0 0 10px rgba(226,191,116,.5)); }
.btn.primary:hover, .btn.primary.focus { filter: brightness(1.2) drop-shadow(0 0 14px rgba(255,214,130,.8)); }
.btn.disabled { filter: grayscale(.8) brightness(.6); }
.btn img.ic { width: 24px; height: 24px; object-fit: contain; }

/* small square icon button on the pause-plate look (44–52 px) */
/* blank square plate: the ui-button art as a 9-slice (the pause plate has a pause sign drawn on it) */
.icon-btn { width: 50px; height: 50px; padding: 0; border-style: solid; border-width: 9px; border-image: url(../assets/ui-button.webp) 26% 9% fill / 9px stretch;
  background: none; cursor: pointer; overflow: visible;
  display: inline-flex; align-items: center; justify-content: center; transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .15s; }
.icon-btn.plain { border: 0; border-image: none; background: url(../assets/ui-trophy.webp) center/100% 100% no-repeat; }
.icon-btn:hover { filter: brightness(1.2); transform: scale(1.06); }
.icon-btn:active { transform: scale(.92); }

/* stat chip: icon + number */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 4px; border-radius: 16px; background: rgba(12,6,4,.72);
  border: 1px solid rgba(226,191,116,.55); font-weight: 700; font-size: 17px; }
.chip img { width: 26px; height: 26px; object-fit: contain; }

/* bar */
.bar { position: relative; height: 16px; border-radius: 8px; background: rgba(0,0,0,.65); border: 2px solid var(--gold-dark); overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#e0473f, #8e1420); transition: width .2s; }
.bar > b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }

/* motion */
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
@keyframes slideUp { 0% { transform: translateY(40px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes dropIn { 0% { transform: translateY(-60px) scale(1.1); opacity: 0; } 70% { transform: translateY(6px); opacity: 1; } 100% { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes slam { 0% { transform: scale(2.2); opacity: 0; } 60% { transform: scale(.95); opacity: 1; } 100% { transform: scale(1); } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.anim-pop { animation: pop .28s cubic-bezier(.3,1.5,.5,1) both; }
.anim-slide { animation: slideUp .28s cubic-bezier(.3,1.4,.5,1) both; }
.anim-drop { animation: dropIn .5s cubic-bezier(.3,1.4,.5,1) both; }
.anim-fade { animation: fadeIn .3s ease both; }

/* dim backdrop for overlays */
.backdrop { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(20,8,6,.55), rgba(0,0,0,.88)); }
