/* MOTHERLOAD — page styles for the money windows (block 4.3). Same look as the canvas buttons:
   gold cracked stone on a dark rock rim, purple crystal for the second action. */
:root {
  --ink: #f4efff; --soft: #cfc4ec; --muted: #9a8fc0; --dim: #6a5f8e;
  --gold: #f5c542; --gold-ink: #3a2105; --viol: #a54dff;
  --font-d: 'Lilita One', 'Arial Black', sans-serif;
  --font-u: 'Nunito', 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #06030c; touch-action: none;
  user-select: none; -webkit-user-select: none; font-family: var(--font-u); color: var(--ink); }
canvas { display: block; position: fixed; inset: 0; }

/* ---------- stone buttons ---------- */
.stone { position: relative; border: 0; padding: 4px; border-radius: 16px; cursor: pointer;
  background: #221a2e url('art/rock.jpg') center / cover;
  box-shadow: 0 5px 0 #120b1c, 0 10px 22px rgba(0,0,0,.6), 0 0 22px rgba(245,197,66,.28);
  transition: transform .08s, filter .2s; }
.stone > span { display: flex; align-items: center; justify-content: center; height: 100%;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  background: url('art/gold.jpg') center / cover;
  box-shadow: inset 0 2px 0 rgba(255,250,210,.85), inset 0 -4px 6px rgba(90,45,0,.55);
  font-family: var(--font-d); font-size: 16px; letter-spacing: .1em; color: var(--gold-ink);
  text-shadow: 0 1px 0 rgba(255,240,180,.8); white-space: nowrap; }
.stone.crystal { box-shadow: 0 5px 0 #120b1c, 0 10px 22px rgba(0,0,0,.6), 0 0 22px rgba(165,77,255,.45); }
.stone.crystal > span { background: linear-gradient(180deg, #e9d2ff 0%, #b46bff 42%, #6d22d8 100%);
  color: #fff; text-shadow: 0 2px 0 rgba(40,10,90,.9);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -4px 8px rgba(40,0,90,.6); }
.stone:active { transform: translateY(3px); box-shadow: 0 2px 0 #120b1c, 0 5px 12px rgba(0,0,0,.6); }
.stone:disabled { filter: grayscale(.75) brightness(.6); cursor: default; transform: none; }
.stone.round { width: 48px; height: 48px; border-radius: 50%; padding: 4px; }
.stone.round > span { border-radius: 50%; padding: 0; min-height: 0; font-size: 24px; letter-spacing: 0; }

.textBtn { display: block; margin: 10px auto 0; background: none; border: 0; cursor: pointer;
  color: var(--dim); font-family: var(--font-u); font-weight: 800; font-size: 12px; letter-spacing: .1em; }
.textBtn.danger { color: #ff8f8f; text-transform: uppercase; }

/* ---------- rock-framed windows ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center;
  padding: 18px; background: rgba(6,3,12,.78); backdrop-filter: blur(3px); }
.modal.show { display: flex; animation: fadeIn .2s ease-out; }
.modal.show .panel { animation: panelUp .45s cubic-bezier(.2,1.3,.4,1); }
@keyframes fadeIn { from { opacity: 0 } }
@keyframes panelUp { from { transform: translateY(40px) scale(.92); opacity: 0 } }
.panel { width: min(380px, 100%); padding: 6px; border-radius: 24px;
  background: #1c1426 url('art/rock.jpg') center / cover;
  box-shadow: 0 0 0 1px rgba(201,143,255,.35), 0 0 40px rgba(165,77,255,.35), 0 20px 50px rgba(0,0,0,.7); }
.panel.wide { width: min(430px, 100%); }
.panelInner { border-radius: 19px; padding: 22px 20px 16px; text-align: center; max-height: 84vh; display: flex; flex-direction: column;
  background: radial-gradient(120% 80% at 50% 0%, rgba(90,40,150,.55), rgba(12,7,22,.97) 60%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset 0 20px 40px rgba(165,77,255,.12); }
.panelTitle { font-family: var(--font-d); font-size: 26px; letter-spacing: .08em;
  background: linear-gradient(180deg, #fffbe0 0%, #ffd75e 36%, #f5a623 64%, #9c5d0a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #3a1d00) drop-shadow(0 0 14px rgba(245,166,35,.45)); }
.bigMoney { font-family: var(--font-d); font-size: 40px; margin-top: 4px; color: #fff;
  text-shadow: 0 3px 0 #2a0f52, 0 0 22px rgba(165,77,255,.8); }
.sub { font-size: 12.5px; color: var(--soft); margin-top: 6px; line-height: 1.5; }
.cap { font-family: var(--font-d); font-size: 11px; letter-spacing: .24em; color: var(--muted); margin-top: 16px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; min-height: 14px; }
.msg { font-size: 12px; color: var(--soft); margin-top: 10px; min-height: 16px; line-height: 1.45; }
.msg.err { color: #ff9a9a; }
.betRow { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 8px; }
#betVal { font-family: var(--font-d); font-size: 34px; min-width: 84px; color: var(--gold);
  text-shadow: 0 3px 0 #3a1d00, 0 0 18px rgba(245,166,35,.5); }
.moneyRow { display: flex; gap: 10px; margin-top: 12px; }
.moneyRow .stone { flex: 0 0 132px; }
.field { flex: 1; min-width: 0; border-radius: 14px; padding: 0 14px; height: 52px; outline: none;
  background: rgba(8,4,16,.8); border: 1.5px solid rgba(201,143,255,.35); color: var(--ink);
  font-family: var(--font-d); font-size: 18px; letter-spacing: .04em; text-align: center;
  user-select: text; -webkit-user-select: text; box-shadow: inset 0 3px 8px rgba(0,0,0,.6); }
.field:focus { border-color: var(--gold); box-shadow: inset 0 3px 8px rgba(0,0,0,.6), 0 0 14px rgba(245,197,66,.35); }
.field::placeholder { color: var(--dim); font-family: var(--font-u); font-weight: 700; font-size: 14px; }
#noticeOk { margin: 16px auto 0; min-width: 160px; display: block; }
#histLogout { margin: 14px auto 0; min-width: 220px; display: block; }

/* ---------- intro (TAP TO START → video → rules + PLAY) ---------- */
.stone.big { display: block; width: min(360px, calc(100vw - 48px)); margin: 0 auto; padding: 6px; border-radius: 22px; }
.stone.big > span { min-height: 68px; border-radius: 17px; font-size: 30px; letter-spacing: .12em; }
/* Jack 09-14: the whole video is always shown (never cropped); the space around it is filled with a faded,
   blurred copy of its first frame. The start screen is that same frame with TAP TO START at the bottom. */
#intro { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 30; background: #06030c;
  transition: opacity .6s; overflow: hidden; }
#intro.gone { opacity: 0; pointer-events: none; }
#introBg { position: absolute; inset: -60px; background: url('art/intro-poster.jpg') center / cover no-repeat;
  filter: blur(26px) brightness(.55) saturate(1.25); }
#introStart { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 24px 24px max(9vh, env(safe-area-inset-bottom)); transition: opacity .4s;
  background: linear-gradient(180deg, rgba(6,3,12,0) 60%, rgba(6,3,12,.6) 100%); }
#introTap { animation: pulse 1.7s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05) } }
#intro.film #introStart { opacity: 0; pointer-events: none; }

#introFilm { position: absolute; inset: 0; pointer-events: none; }
#intro.film #introFilm { pointer-events: auto; }
#introVideo { position: absolute; left: 0; top: 50%; width: 100%; height: 100%; transform: translateY(-50%);
  object-fit: contain; background: transparent; transition: top .7s, transform .7s; }
#introRules { position: absolute; left: 0; right: 0; bottom: 0; padding: 18vh 20px max(22px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(6,3,12,0) 0%, rgba(6,3,12,.82) 22%, rgba(6,3,12,.94) 100%);
  opacity: 0; transform: translateY(40px); pointer-events: none; transition: opacity .7s, transform .7s cubic-bezier(.2,1.2,.4,1); }
#intro.rules #introRules { opacity: 1; transform: none; pointer-events: auto; }
.rules { list-style: none; counter-reset: r; margin: 0 auto 20px; padding: 0; width: min(720px, 100%);
  display: grid; gap: 10px; text-align: left; }
.rules li { counter-increment: r; position: relative; padding: 10px 14px 10px 58px; border-radius: 16px;
  background: rgba(20,10,34,.72); border: 1px solid rgba(245,197,66,.28);
  font-family: var(--font-u); font-weight: 800; font-size: 15px; line-height: 1.35; color: var(--soft); }
.rules li::before { content: counter(r); position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: url('art/gold.jpg') center / cover; color: var(--gold-ink); font-family: var(--font-d); font-size: 19px;
  box-shadow: 0 0 0 2px #120b1c, 0 0 14px rgba(245,197,66,.45); }
.rules b { display: block; font-family: var(--font-d); font-weight: 400; font-size: 19px; letter-spacing: .05em; color: var(--gold);
  text-shadow: 0 2px 0 #3a1d00, 0 0 14px rgba(245,166,35,.35); }
.rules em { font-style: normal; color: #ffe08a; font-family: var(--font-d); }
.rules small { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* phones held upright: the whole video sits across the middle; when the rules come up it moves to the top
   so the rules fill the space below it */
@media (orientation: portrait) {
  #introVideo { height: calc(100vw * 9 / 16); }
  #intro.rules #introVideo { top: 0; transform: none; }
  #introRules { padding-top: 40px; background: linear-gradient(180deg, rgba(6,3,12,0) 0%, rgba(6,3,12,.85) 40px, rgba(6,3,12,.94) 100%); }
}
@media (max-width: 480px), (max-height: 560px) {
  .rules { gap: 7px; margin-bottom: 14px; }
  .rules li { padding: 8px 10px 8px 48px; font-size: 12.5px; }
  .rules li::before { width: 28px; height: 28px; font-size: 16px; left: 10px; }
  .rules b { font-size: 15px; }
  .stone.big > span { min-height: 58px; font-size: 26px; }
}
/* wide screens: two columns keep the rules below the logo */
@media (orientation: landscape) {
  #introRules { padding-top: 8vh; }
  .rules { grid-template-columns: 1fr 1fr; width: min(1000px, 100%); }
  .rules li:last-child { grid-column: 1 / -1; justify-self: center; width: calc(50% - 5px); }
}
@media (orientation: landscape) and (max-height: 560px) {
  #introRules { padding-top: 6vh; }
}

#histList { margin-top: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.hrow { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 14px;
  background: rgba(244,239,255,.04); border: 1px solid rgba(201,143,255,.18); }
.hic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 15px; background: rgba(30,15,60,.6); border: 1.5px solid rgba(165,77,255,.55); }
.hmain { flex: 1; min-width: 0; }
.ht { font-family: var(--font-d); font-size: 13px; letter-spacing: .04em; }
.hs { font-size: 10.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs a { color: #b9a0ff; text-decoration: none; }
.hv { font-family: var(--font-d); font-size: 15px; }
.hv.pos { color: #7fe0a0; } .hv.neg { color: var(--gold); }
.empty { text-align: center; color: var(--dim); font-size: 12px; padding: 18px 0 10px; }
