html, body { margin: 0; height: 100%; background: #08060f; overflow: hidden; }
#ui { position: fixed; left: 0; top: 0; width: 100px; height: 100px; --u: 4px; --hl: 70px; --ht: 70px;
  pointer-events: none; color: #f4ead8; font-size: max(14px, calc(var(--u) * 3.4)); line-height: 1.3;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overflow: hidden; z-index: 5; }
#ui * { box-sizing: border-box; image-rendering: auto; }
#ui img.px { image-rendering: pixelated; }
#ui .layer { position: absolute; inset: 0; pointer-events: none; }
.scr { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; animation: fadein .2s ease-out both; }
.scr.out { animation: fadeout .18s ease-in forwards; pointer-events: none; }
.scr.dim { background: rgba(10, 6, 24, 0.55); }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
@keyframes fadeout { to { opacity: 0 } }
@keyframes rise { from { opacity: 0; transform: translateY(1.4em) } to { opacity: 1; transform: none } }
@keyframes pop { 0% { opacity: 0; transform: scale(.82) } 65% { opacity: 1; transform: scale(1.04) } 100% { transform: scale(1) } }
@keyframes drop { 0% { opacity: 0; transform: translateY(-40%) } 60% { opacity: 1; transform: translateY(6%) } 80% { transform: translateY(-2%) } 100% { transform: none } }
@keyframes floaty { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(calc(var(--u) * -1)) } }
@keyframes pulse { 0%, 100% { opacity: .45 } 50% { opacity: 1 } }
@keyframes blink { 0%, 100% { opacity: 0 } 50% { opacity: 1 } }

/* panels */
.panel, .box { position: relative; background: rgba(24, 18, 46, 0.92); border: 2px solid #e9c46a; border-radius: calc(var(--u) * 2.4);
  box-shadow: 0 0 0 1px #120c26, inset 0 0 calc(var(--u) * 3) rgba(233, 196, 106, .18), 0 calc(var(--u) * .6) calc(var(--u) * 2) rgba(0, 0, 0, .5); }
.panel::before, .box::before { content: ""; position: absolute; inset: 4px; border: 1px solid #8a6a3a; border-radius: calc(var(--u) * 1.8); pointer-events: none; }
.panel::after { content: ""; position: absolute; inset: -3px; pointer-events: none; background-repeat: no-repeat; background-position: left top, right top, left bottom, right bottom;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23e9c46a' stroke-width='1.5'><path d='M2 20C2 8 8 2 20 2'/><circle cx='5' cy='5' r='1.6' fill='%23e9c46a'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23e9c46a' stroke-width='1.5'><path d='M20 20C20 8 14 2 2 2'/><circle cx='17' cy='5' r='1.6' fill='%23e9c46a'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23e9c46a' stroke-width='1.5'><path d='M2 2C2 14 8 20 20 20'/><circle cx='5' cy='17' r='1.6' fill='%23e9c46a'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23e9c46a' stroke-width='1.5'><path d='M20 2C20 14 14 20 2 20'/><circle cx='17' cy='17' r='1.6' fill='%23e9c46a'/></svg>"); }
.panel { padding: 1.1em 1.4em; max-width: 94%; max-height: 94%; display: flex; flex-direction: column; gap: .6em; animation: pop .25s ease-out both; }
.box { padding: .25em .7em; border-radius: calc(var(--u) * 1.6); background: rgba(24, 18, 46, 0.82); }
.panel > *, .box > * { position: relative; z-index: 1; }

/* text */
.ttl { margin: 0; text-align: center; font-size: 1.35em; font-weight: 900; color: #f6d98a; letter-spacing: .04em;
  text-shadow: -1px -1px 0 #120c26, 1px -1px 0 #120c26, -1px 1px 0 #120c26, 1px 1px 0 #120c26, 2px 3px 0 #120c26; }
.sub { font-size: .85em; opacity: .85; font-style: italic; }
.gold { color: #f6d98a; font-weight: 700; text-shadow: 1px 1px 0 #120c26, -1px 1px 0 #120c26; }
.row { display: flex; align-items: center; justify-content: center; gap: .6em; flex-wrap: wrap; }
.lab { font-size: .85em; color: #e9c46a; text-align: center; letter-spacing: .08em; }

/* buttons */
.btn { position: relative; pointer-events: auto; cursor: pointer; font: inherit; color: #f6d98a; background: rgba(36, 26, 66, .96);
  border: 2px solid #e9c46a; border-radius: calc(var(--u) * 1.8); padding: .35em 1em; min-height: max(44px, calc(var(--u) * 9)); min-width: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; font-weight: 800;
  text-shadow: 1px 1px 0 #120c26, -1px 1px 0 #120c26, 0 -1px 0 #120c26; box-shadow: inset 0 0 0 3px rgba(138, 106, 58, .55), 0 2px 0 #120c26;
  transition: transform .12s ease, filter .12s ease, background .12s; outline: none; -webkit-appearance: none; appearance: none; margin: 0; }
.btn:hover, .btn.focus { transform: scale(1.04); filter: brightness(1.25); background: rgba(70, 48, 100, .98); }
.btn.focus { box-shadow: inset 0 0 0 3px rgba(233, 196, 106, .8), 0 0 calc(var(--u) * 2.5) rgba(233, 196, 106, .6), 0 2px 0 #120c26; }
.btn:active { transform: scale(.95); filter: brightness(1); }
.btn.off { opacity: .45; filter: grayscale(.6); }
.btn.sel { border-color: #fff2b8; background: rgba(90, 62, 110, .98); }
.btn .lbl { text-align: center; }
.ico { width: calc(var(--u) * 5); height: calc(var(--u) * 5); min-width: 24px; min-height: 24px; flex: none; object-fit: contain; image-rendering: pixelated; }
.ico.sm { width: calc(var(--u) * 3.6); height: calc(var(--u) * 3.6); min-width: 18px; min-height: 18px; }
.ico.lg { width: calc(var(--u) * 11); height: calc(var(--u) * 11); }
.coin { width: calc(var(--u) * 4); height: calc(var(--u) * 4); min-width: 18px; min-height: 18px; image-rendering: auto; }

/* title */
.title { flex-direction: column; justify-content: flex-start; background: radial-gradient(ellipse at 50% 55%, rgba(10, 6, 24, 0) 30%, rgba(10, 6, 24, .75) 100%), linear-gradient(rgba(10, 6, 24, .1), rgba(10, 6, 24, .45)); cursor: pointer; }
.title .logo { margin-top: 3%; width: 60%; max-height: 30%; object-fit: contain; animation: drop .8s ease-out both, floaty 4s ease-in-out .8s infinite; filter: drop-shadow(0 4px 0 rgba(10, 6, 24, .6)); }
.title .prompt { position: absolute; bottom: 9%; left: 0; right: 0; text-align: center; font-size: 1.25em; font-weight: 900; color: #f6d98a; animation: pulse 1.6s ease-in-out infinite;
  text-shadow: -2px -2px 0 #120c26, 2px -2px 0 #120c26, -2px 2px 0 #120c26, 2px 2px 0 #120c26, 2px 4px 0 #120c26; }
.corner { position: absolute; top: 8px; right: 8px; width: 50px; height: 50px; padding: 0; min-height: 0; }
.corner img { width: 30px; height: 30px; image-rendering: auto; }

/* night select */
.sel-p { width: min(92%, 640px); }
.sel-top { display: flex; align-items: center; justify-content: space-between; gap: .6em; }
.sel-top .ttl { flex: 1; }
.sel-shop { display: flex; align-items: center; gap: .5em; }
.sel-shop .goldbox { display: flex; align-items: center; gap: .3em; }
.sel-bot { display: flex; justify-content: center; align-items: flex-end; gap: 1.6em; flex-wrap: wrap; }
.sel-col { display: flex; flex-direction: column; align-items: center; gap: .35em; }
.cards { display: grid; gap: .5em; }
.card { flex-direction: row; justify-content: flex-start; text-align: left; gap: .7em; padding: .3em .8em; min-height: max(48px, calc(var(--u) * 11)); }
.card .num { font-size: 1.5em; font-weight: 900; color: #f6d98a; min-width: 1.6em; text-align: center; }
.card .nm { flex: 1; font-size: .85em; line-height: 1.2; font-weight: 700; }
.card.locked { opacity: .5; filter: grayscale(.5); }
.flames { display: flex; gap: .5em; justify-content: center; }
.flame { flex-direction: column; gap: .1em; padding: .2em .5em; min-width: calc(var(--u) * 17); min-height: max(48px, calc(var(--u) * 12)); font-size: .8em; position: relative; }
.flame .lk { position: absolute; right: 4px; top: 4px; }
.slots { display: flex; gap: .6em; justify-content: center; }
.slot { width: calc(var(--u) * 6); height: calc(var(--u) * 6); min-width: 26px; min-height: 26px; border: 1px solid #8a6a3a; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(10, 6, 24, .5); }
.slot img { width: 70%; height: 70%; image-rendering: pixelated; opacity: .25; filter: grayscale(1); }
.slot.on { border-color: #e9c46a; box-shadow: 0 0 calc(var(--u) * 1.5) rgba(233, 196, 106, .6); }
.slot.on img { opacity: 1; filter: none; }

/* HUD */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud-l { position: absolute; left: var(--hl); top: var(--ht); display: flex; flex-direction: column; gap: 2px;
  width: max-content; max-width: min(34%, 24em); padding: .3em .6em .35em; border-width: 1px; border-color: rgba(233, 196, 106, .75);
  background: rgba(24, 18, 46, 0.45); box-shadow: 0 0 0 1px rgba(18, 12, 38, .5); border-radius: 8px;
  font-size: max(14px, calc(var(--u) * 2.2)); line-height: 1.25; transition: opacity .25s ease; animation: rise .2s ease-out both; }
.hud-l::before { inset: 2px; border-color: rgba(138, 106, 58, .45); border-radius: 6px; }
.hud-l.faded { opacity: .28; }
.hud-l .hrow { display: flex; align-items: center; gap: .6em; justify-content: space-between; }
.hud-l .nt, .hud-l .ob, .hud-l .hud-g { text-shadow: -1px -1px 0 #120c26, 1px -1px 0 #120c26, -1px 1px 0 #120c26, 1px 1px 0 #120c26, 0 2px 2px rgba(0, 0, 0, .6); }
.hud-l .nt { font-weight: 800; color: #f6d98a; font-size: max(12px, .82em); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hud-l .ob { font-size: 1em; overflow-wrap: anywhere; }
.hud-g { display: flex; align-items: center; gap: .25em; flex: none; font-weight: 800; font-size: max(12px, .82em); color: #f6d98a; }
.hud-g img { width: 1.2em; height: 1.2em; }
.hud-r { position: absolute; right: var(--hr); top: var(--ht); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; animation: rise .2s ease-out both; }
.hud-r .btn { min-width: 48px; min-height: 48px; padding: 0 .6em; overflow: hidden; font-size: .85em; }
.sweep { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(10, 6, 24, .7); pointer-events: none; }
.cdn { position: relative; z-index: 1; }
.pill { position: absolute; left: 0; top: 0; padding: .15em .7em; border-radius: 99px; background: rgba(24, 18, 46, .9); border: 2px solid #e9c46a; color: #f6d98a; font-weight: 800; font-size: .9em; white-space: nowrap;
  text-shadow: 1px 1px 0 #120c26; box-shadow: 0 0 0 1px #120c26, 0 0 calc(var(--u) * 2) rgba(233, 196, 106, .45); will-change: transform; }

/* dialogue */
.dlg { align-items: flex-end; padding-bottom: 3%; background: none; }
.dbox { width: 76%; height: 28%; min-height: 70px; padding: .8em 1.4em; display: block; overflow: visible; animation: rise .2s ease-out both; }
.dbox .tag { position: absolute; left: 1.2em; top: -1.3em; padding: .1em .9em; border-radius: 99px; background: rgba(24, 18, 46, .98); border: 2px solid #e9c46a; font-weight: 900; z-index: 2; text-shadow: 1px 1px 0 #120c26; }
.dbox .tx { font-size: 1em; line-height: 1.45; }
.dbox .tx .hid { color: transparent; }
.dbox.nar .tx { text-align: center; font-style: italic; color: #d8cdea; }
.dbox .more { position: absolute; right: 1.2em; bottom: .4em; color: #f6d98a; animation: blink 1s steps(2) infinite; font-size: .9em; display: none; }
.dbox .more.on { display: block; }

/* pickers and cards */
.prompt-t { text-align: center; font-weight: 800; font-size: 1.05em; }
.grid { display: grid; gap: .5em; grid-template-columns: repeat(auto-fit, minmax(calc(var(--u) * 20), 1fr)); }
.item { flex-direction: column; gap: .2em; font-size: .8em; min-height: max(60px, calc(var(--u) * 15)); }
.desc { min-height: 3em; font-size: .8em; text-align: center; color: #f4ead8; font-weight: 500; }
.choose { align-items: flex-end; padding-bottom: 4%; }
.choose .panel { width: min(78%, 560px); }
.choose .btn { width: 100%; justify-content: flex-start; text-align: left; font-weight: 700; font-size: .92em; }
.clue { align-items: center; text-align: center; width: min(70%, 380px); }
.clue .hd { color: #e9c46a; font-size: .85em; letter-spacing: .12em; }
.clue .nm { font-size: 1.15em; font-weight: 900; color: #f6d98a; }
.clue .ds { font-size: .85em; }
.exitl { position: absolute; left: 0; top: 0; padding: .1em .6em; border-radius: 4px; background: rgba(24, 18, 46, .78); border: 1px solid #e9c46a; color: #f6d98a; font-weight: 800; font-size: max(14px, calc(var(--u) * 2.7)); white-space: nowrap; pointer-events: none; text-shadow: 1px 1px 0 #120c26; }
.exitl.sealed { color: #d8d2c4; border-color: #8a8478; background: rgba(40, 36, 52, .72); opacity: .9; }
.toasts { position: absolute; left: 0; right: 0; top: 27%; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { padding: .3em 1em; font-size: .85em; text-align: center; max-width: 60%; animation: rise .2s ease-out both; }
.jr { width: min(92%, 640px); }
.jr .cols { display: flex; gap: 1em; align-items: flex-start; }
.jr .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .4em; }
.jr .it { display: flex; gap: .5em; align-items: flex-start; font-size: .8em; line-height: 1.25; }
.jr .it b { color: #f6d98a; display: block; }
.helpl { font-size: .9em; display: flex; flex-direction: column; gap: .35em; text-align: left; }
.res { width: min(80%, 480px); align-items: center; text-align: center; }
.res .big { font-size: 1.8em; }
.cardl { background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: auto; transition: opacity .5s; opacity: 0; }
.cardl.show { opacity: 1; }
.cardl h1 { margin: 0; font-size: 2.2em; font-weight: 900; color: #f6d98a; text-align: center; padding: 0 8%; text-shadow: 2px 3px 0 #120c26; }
.cardl .rule { width: 40%; height: 0; border-top: 1px solid #e9c46a; margin: .6em 0; position: relative; }
.cardl .rule::after { content: ""; position: absolute; left: 50%; top: -5px; width: 8px; height: 8px; background: #e9c46a; transform: translateX(-50%) rotate(45deg); }
.cardl p { margin: 0; font-style: italic; opacity: .85; text-align: center; padding: 0 10%; }
.endl { background: rgba(10, 6, 24, .72); flex-direction: column; gap: .7em; text-align: center; padding: 0 10%; }
.endl p { margin: 0; font-size: 1.05em; font-style: italic; animation: rise .8s ease-out both; text-shadow: 1px 2px 0 #120c26; max-width: 90%; text-wrap: balance; }
.endl .te { font-size: 2em; font-weight: 900; font-style: normal; color: #f6d98a; }
