@font-face { font-family: "Cinzel Deco"; src: url("assets/fonts/CinzelDecorative-Bold.ttf"); font-weight: 700; }
@font-face { font-family: "Crimson"; src: url("assets/fonts/CrimsonText-Regular.ttf"); }
@font-face { font-family: "Crimson"; src: url("assets/fonts/CrimsonText-Bold.ttf"); font-weight: 700; }

:root {
  --gold: #f2cf6a;
  --gold-dim: #b89640;
  --cream: #f6e7c1;
  --ink: #100c0a;
  --panel: rgba(16, 12, 14, 0.94);
  --row: rgba(30, 22, 20, 0.92);
  --line: rgba(70, 54, 28, 0.8);
}
html, body { margin: 0; padding: 0; height: 100%; background: #0a0808; color: var(--cream);
  font-family: Crimson, Georgia, serif; overflow: hidden; position: fixed; inset: 0;
  -webkit-user-select: none; user-select: none; touch-action: manipulation; }
body.skin-crystal { background: #0a0810; }
#scene { position: absolute; top: 0; left: 0; right: 0; bottom: 218px; width: 100%; height: calc(100% - 218px); display: block; background: #0a0808; touch-action: none; }
.skin-crystal #scene { background: #0a0810; }

header.top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 10px 36px;
  background: linear-gradient(to bottom, rgba(8,6,8,.88), rgba(8,6,8,0));
  pointer-events: none;
}
header.top > * { pointer-events: auto; }
a.back {
  width: 32px; height: 32px; border-radius: 16px; flex: none;
  border: 1px solid var(--gold); background: rgba(20,16,14,.85);
  color: var(--gold); text-decoration: none; display: grid; place-items: center;
  font-family: "Cinzel Deco", serif; font-size: 22px; line-height: 1; padding-bottom: 2px;
}
.title { flex: 1; min-width: 0; padding-top: 2px; }
.title b { display: block; font-family: "Cinzel Deco", serif; font-size: 14px; letter-spacing: .04em; color: var(--cream); line-height: 1.15; }
.title small { display: block; font-size: 11px; color: var(--gold-dim); }
.pills { display: flex; gap: 6px; }
.pill {
  display: flex; align-items: center; gap: 5px;
  background: rgba(16,12,10,.85); border: 1px solid var(--gold-dim);
  border-radius: 12px; padding: 3px 8px 3px 5px; height: 26px;
  font-family: Crimson, serif; font-weight: 700; font-size: 12px; color: var(--cream);
}
.pill img { width: 16px; height: 16px; object-fit: contain; }

#magic {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 236px; z-index: 4;
  display: none; align-items: center; gap: 8px;
  min-width: 200px; justify-content: center;
  background: rgba(18,12,28,.88); border: 1px solid #c8a0ff;
  border-radius: 22px; padding: 8px 18px;
  box-shadow: 0 0 18px rgba(160,90,255,.35);
  font-family: "Cinzel Deco", serif; font-size: 22px; color: #fff;
}
.skin-crystal #magic { display: flex; }
#magic i { width: 16px; height: 16px; display: inline-block;
  background: linear-gradient(135deg, #e6c8ff, #9b6cff);
  transform: rotate(45deg); border-radius: 2px; }
#magic small { font-family: Crimson, serif; font-weight: 700; font-size: 11px; color: #d2b4ff; letter-spacing: .08em; margin-left: 2px; }

.panel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  height: 218px; background: var(--panel);
  border-top-left-radius: 18px; border-top-right-radius: 18px;
  box-shadow: 0 -1px 0 var(--gold);
  padding: 8px 10px 10px; box-sizing: border-box;
  display: flex; flex-direction: column;
}
.phead { display: flex; align-items: baseline; gap: 10px; padding: 0 4px 6px; }
.phead b { font-family: "Cinzel Deco", serif; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.phead .sp { flex: 1; }
.phead button {
  background: none; border: 0; color: var(--gold); font-family: Crimson, serif;
  font-size: 13px; padding: 4px 6px; cursor: pointer;
}
#rows { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 4px; }
.row {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center;
  background: var(--row); border: 1px solid var(--line); border-radius: 10px;
  padding: 4px 6px 4px 6px; min-height: 42px;
}
.row .ic { width: 28px; height: 28px; border-radius: 14px; border: 1px solid var(--gold);
  background: #2a1e16; display: grid; place-items: center; font-size: 13px; }
.row .meta { min-width: 0; }
.row .nm { font-weight: 700; font-size: 13px; color: var(--cream); }
.row .lv { font-size: 11px; color: var(--gold); margin-left: 6px; }
.bar { height: 6px; border-radius: 3px; background: #281e1a; margin-top: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 3px; }
.row button.up, #btnPrestige, .ov .go, .ov .xbtn {
  appearance: none; border-radius: 8px; font-family: Crimson, serif; font-weight: 700;
  cursor: pointer;
}
.row button.up {
  border: 1px solid var(--gold); background: #483410; color: var(--cream);
  font-size: 12px; padding: 5px 8px; min-width: 108px; height: 28px;
}
.row button.up:disabled, .row.locked button.up {
  border-color: #50463c; background: #1e1a20; color: #7a6e64; cursor: default;
}
.row.locked .nm, .row.locked .lv { color: #7a6e64; }
#btnPrestige {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; height: 40px; padding: 0 16px;
  border: 2px solid #ffdc78; background: #5c3a10; color: #fff;
  font-size: 14px; border-radius: 14px;
}
#btnPrestige[disabled] { opacity: .55; }
#btnPrestige em { font-style: normal; color: var(--gold); font-size: 12px; }

.ov {
  position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.ov[hidden] { display: none !important; }
.sheet, .card {
  width: 100%; background: #161014; border-top: 1px solid var(--gold);
  border-top-left-radius: 18px; border-top-right-radius: 18px;
  padding: 14px 16px 24px; box-sizing: border-box; max-height: 78%;
  overflow: auto; color: var(--cream);
}
.card { margin: 0 16px 80px; width: calc(100% - 32px); border-radius: 16px; border: 1px solid var(--gold); max-height: none; }
.sheet h2, .card h2 { font-family: "Cinzel Deco", serif; font-size: 16px; margin: 0 36px 8px 0; }
.sheet p, .card p { margin: 0 0 10px; font-size: 14px; line-height: 1.35; color: #e8dcc0; }
.sheet .x, .card .x {
  position: absolute; right: 16px; top: 12px; width: 32px; height: 32px;
  border: 0; background: none; color: var(--gold); font-size: 22px; cursor: pointer;
}
.sheet { position: relative; }
.shop-row, .bd-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  padding: 8px 0; border-top: 1px solid rgba(242,207,106,.15);
}
.shop-row b, .bd-row b { font-size: 14px; }
.shop-row small, .bd-row small { display: block; color: #c8b896; font-size: 12px; }
.shop-row button {
  border: 1px solid var(--gold); background: #483410; color: var(--cream);
  border-radius: 8px; padding: 6px 10px; font-weight: 700; min-width: 90px;
}
.shop-row button:disabled { border-color: #50463c; background: #1e1a20; color: #7a6e64; }
.tabs { display: flex; gap: 6px; margin: 0 0 8px; }
.tabs button {
  flex: 1; border: 1px solid var(--gold-dim); background: transparent; color: var(--cream);
  border-radius: 8px; padding: 6px 4px; font-family: Crimson, serif; font-weight: 700;
}
.tabs button.on { background: #483410; border-color: var(--gold); }
.bd-list { list-style: none; margin: 0; padding: 0; }
.bd-list li { display: flex; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(242,207,106,.12); font-size: 14px; }
.bd-list li.me { color: var(--gold); }
.bd-list .rk { width: 24px; color: var(--gold-dim); }
.bd-list .pts { margin-left: auto; font-weight: 700; }
.coming { margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--gold-dim); border-radius: 8px; font-size: 13px; color: #e0c878; }
.go {
  display: block; width: 100%; height: 44px; margin-top: 8px;
  border: 2px solid #ffdc78; background: #5c3a10; color: #fff;
  font-size: 16px; border-radius: 14px;
}
#toast {
  position: absolute; left: 50%; bottom: 236px; transform: translateX(-50%);
  z-index: 30; background: rgba(16,12,10,.92); border: 1px solid var(--gold);
  color: var(--cream); padding: 8px 14px; border-radius: 10px; font-size: 13px;
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
#toast.show { opacity: 1; }
#hint {
  position: absolute; left: 16px; right: 16px; bottom: 230px; z-index: 4;
  text-align: center; font-size: 13px; color: var(--cream);
  text-shadow: 0 1px 3px #000; pointer-events: none;
}
#hint[hidden] { display: none; }

#camTools {
  position: absolute; right: 8px; bottom: 228px; z-index: 7;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none;
}
#camTools > * { pointer-events: auto; }
#btnCam {
  background: rgba(16,12,10,.88); border: 1px solid var(--gold-dim);
  color: var(--gold); font-family: Crimson, serif; font-size: 12px;
  border-radius: 12px; padding: 4px 8px; cursor: pointer;
}
#mini {
  width: 56px; height: 120px; border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.5); background: rgba(10,8,8,.7);
  border: 1px solid #b89640;
  cursor: pointer;
}
body.skin-crystal #camTools { display: none; }

/* qa1127 wide-screen phone column (same as gate.css 11/23): on computers keep the tall phone layout centred instead of zooming the scene to fill the width */
@media (min-aspect-ratio: 3/4) {
  :root { --w: calc(100vh * 390 / 844); --w: calc(100dvh * 390 / 844); }
  html { background: #050302; }
  body.idle { left: calc(50% - var(--w) / 2); right: auto; width: var(--w); box-shadow: 0 0 40px rgba(0,0,0,.8); transform: translateZ(0); }
}
