/* PepiFun — "Pizarra de Florida": the cardboard/split-flap boards of the Calle Florida
   exchange houses. One committed dark world (single theme by design). */
:root {
  color-scheme: dark;
  --board: #0f0e0c;       /* night street */
  --board-2: #16140f;     /* board body */
  --flap: #1d1b17;        /* flap face */
  --line: #2c2822;        /* seams */
  --amber: #ffb02e;       /* signage */
  --amber-hi: #ffcf6e;    /* lit digits */
  --cream: #f3e6c9;       /* text */
  --muted: #a8997b;       /* secondary text */
  --up: #2fbf71;  --up-ink: #062614;
  --down: #ff4d3d; --down-ink: #2b0703;
  --bill-1: #cfe0c4; --bill-2: #8aa67d; --bill-ink: #2e4428;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --mono: "Share Tech Mono", "Courier New", ui-monospace, monospace;
  --body: "Archivo", "Segoe UI", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--board); }
body { margin: 0; min-height: 100vh; background:
    radial-gradient(1200px 500px at 15% -10%, rgba(255,176,46,.10), transparent 60%),
    radial-gradient(900px 600px at 110% 10%, rgba(47,191,113,.06), transparent 60%),
    var(--board);
  color: var(--cream); font: 400 16px/1.6 var(--body); padding-bottom: 46px; }
a { color: var(--amber); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: var(--gutter); padding-block: 0 48px; }

/* ---- top bar: a lit sign ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 18px; border-bottom: 1px solid var(--line); margin-bottom: clamp(24px, 4vw, 44px); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cream);
  font: 900 1.6rem/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: blink 2.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { font: 400 .92rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  color: var(--muted); padding: 9px 12px; border: 1px solid transparent; border-radius: 4px; }
.nav a:hover { color: var(--cream); border-color: var(--line); }
.nav a.on { color: var(--board); background: var(--amber); }

/* ---- type ---- */
.kicker { font: 400 .9rem/1.2 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--amber); margin: 0 0 14px; }
.display { font: 900 clamp(3rem, 9vw, 7rem)/.86 var(--display); text-transform: uppercase; letter-spacing: .005em; margin: 0 0 18px; text-wrap: balance; }
.display em { font-style: normal; color: var(--amber); }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 58ch; margin: 0 0 24px; }
.label { font: 400 .78rem/1.2 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- split-flap ---- */
.flaps { display: inline-flex; gap: clamp(3px, .6vw, 6px); flex-wrap: nowrap; }
.flap { position: relative; display: grid; place-items: center; width: var(--fw, clamp(30px, 6vw, 62px)); height: calc(var(--fw, clamp(30px, 6vw, 62px)) * 1.45);
  background: linear-gradient(var(--flap) 50%, #181612 50%); border-radius: 5px; color: var(--amber-hi);
  font: 400 calc(var(--fw, clamp(30px, 6vw, 62px)) * .95)/1 var(--mono); text-shadow: 0 0 14px rgba(255,176,46,.35);
  box-shadow: inset 0 0 0 1px var(--line), 0 6px 14px rgba(0,0,0,.45); transform-origin: 50% 50%; }
.flap::after { content: ""; position: absolute; inset: 50% 0 auto; height: 2px; background: #0b0a09; }
.flap.sep { background: none; box-shadow: none; width: calc(var(--fw, clamp(30px, 6vw, 62px)) * .45); }
.flap.sep::after { display: none; }
.flap.go { animation: flip .42s cubic-bezier(.3,.7,.4,1) both; }
@keyframes flip { 0% { transform: rotateX(88deg); filter: brightness(1.8); } 100% { transform: none; } }

/* ---- surfaces ---- */
.panel { background: linear-gradient(180deg, var(--board-2), #12100c); border: 1px solid var(--line); border-radius: 8px; padding: clamp(16px, 2.4vw, 26px); min-width: 0; }
.panel-title { font: 900 1.3rem/1 var(--display); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 14px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

/* ---- buttons ---- */
.btn { appearance: none; border: 0; cursor: pointer; font: 900 1.15rem/1 var(--display); text-transform: uppercase; letter-spacing: .06em;
  padding: 15px 24px; border-radius: 5px; background: var(--amber); color: #1a1306; transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.08); } .btn:active { transform: translateY(1px) scale(.99); }
.btn.ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--amber); }
.btn:disabled { filter: grayscale(.7) brightness(.6); cursor: not-allowed; }
input, textarea, select { font: 400 1rem/1.4 var(--body); color: var(--cream); background: #0c0b09; border: 1px solid var(--line); border-radius: 5px; padding: 12px 14px; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--amber); }
::placeholder { color: #6f6553; }

/* ---- ticker tape (fixed bottom) ---- */
.ticker { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(40px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--amber); color: #1a1306; overflow: hidden; display: flex; align-items: center; border-top: 2px solid #c98314; }
.ticker .track { display: inline-flex; gap: 42px; white-space: nowrap; font: 400 1.02rem/1 var(--mono); letter-spacing: .04em; animation: tape 40s linear infinite; padding-left: 24px; }
.ticker .up { color: #0f5a31; } .ticker .down { color: #8f1a10; }
@keyframes tape { to { transform: translateX(-50%); } }

/* ---- 3D bill ---- */
.bill-stage { perspective: 1400px; display: grid; place-items: center; }
.bill { width: var(--bw, min(440px, 82vw)); aspect-ratio: 2.35; position: relative; transform-style: preserve-3d; animation: billfloat 8s ease-in-out infinite; }
@keyframes billfloat { 0%,100% { transform: rotateX(16deg) rotateY(-24deg) rotateZ(-5deg) translateY(0); } 50% { transform: rotateX(6deg) rotateY(20deg) rotateZ(3deg) translateY(-16px); } }
.bill .face { position: absolute; inset: 0; border-radius: 6px; overflow: hidden; backface-visibility: hidden;
  background: linear-gradient(135deg, var(--bill-1), var(--bill-2)); border: 1px solid #556e4b; box-shadow: 0 30px 50px rgba(0,0,0,.45); }
.bill .face.back { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, #8aa67d 0 3px, #9db78f 3px 6px); }
.bill .inner { position: absolute; inset: 9px; border: 2px solid rgba(40,60,35,.55); border-radius: 3px; display: grid; grid-template-columns: 1fr 1.25fr 1fr; align-items: center;
  background: repeating-radial-gradient(circle at 50% 50%, transparent 0 6px, rgba(46,68,40,.07) 6px 7px); }
.bill .n { font: 900 clamp(1.6rem, 6vw, 3.2rem)/1 var(--display); color: var(--bill-ink); text-align: center; }
.bill .oval { justify-self: center; width: 72%; aspect-ratio: .82; border-radius: 50%; border: 3px double #3d5a35;
  background: radial-gradient(circle, #c4d7b6, #8aa67d); display: grid; place-items: center; font: 900 clamp(1.4rem, 4vw, 2.4rem)/1 var(--display); color: var(--bill-ink); }
.bill .legend { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font: 400 clamp(.5rem, 1.5vw, .72rem)/1 var(--mono); letter-spacing: .3em; color: var(--bill-ink); white-space: nowrap; }
.bill .shine { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.4) 48%, transparent 60%); background-size: 260% 100%; animation: shine 5s ease-in-out infinite; mix-blend-mode: soft-light; }
@keyframes shine { 0% { background-position: 120% 0; } 55%,100% { background-position: -60% 0; } }

/* ---- falling bills (celebration / ambience) ---- */
.rain { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.rain i { position: absolute; top: -40px; width: 54px; height: 23px; border-radius: 2px; background: linear-gradient(135deg, var(--bill-1), var(--bill-2));
  box-shadow: inset 0 0 0 2px rgba(46,68,40,.35); animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg) translateX(var(--dx, 40px)); } }

/* ---- page-load reveal ---- */
.reveal > * { animation: rise .8s cubic-bezier(.2,.8,.2,1) both; }
.reveal > *:nth-child(2) { animation-delay: .08s; } .reveal > *:nth-child(3) { animation-delay: .16s; }
.reveal > *:nth-child(4) { animation-delay: .24s; } .reveal > *:nth-child(5) { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ---- misc ---- */
.toast { position: fixed; left: 50%; bottom: 58px; transform: translate(-50%, 10px); z-index: 40; background: var(--cream); color: var(--board);
  font: 400 .95rem/1.3 var(--mono); padding: 12px 18px; border-radius: 5px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 400 .8rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--down); box-shadow: 0 0 8px var(--down); animation: blink 1.2s infinite; }
footer.foot { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font: 400 .82rem/1.5 var(--mono); letter-spacing: .06em; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* realistic bill (SVG faces from bill.js) */
.bill .face svg { display: block; width: 100%; height: 100%; }
.bill .face { background: #d3d8c3; border: 0; }
.rain i { background: var(--bill-img, linear-gradient(135deg, var(--bill-1), var(--bill-2))) center / cover no-repeat; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
/* photo bill: one side only, so the float never turns it around */
.bill .face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bill .face { border-radius: 4px; }
@keyframes billfloat { 0%,100% { transform: rotateX(14deg) rotateY(-20deg) rotateZ(-5deg) translateY(0); } 50% { transform: rotateX(6deg) rotateY(16deg) rotateZ(3deg) translateY(-16px); } }

/* ---- account: header button, modal, guest line ---- */
.acct-btn { font: 400 .9rem/1 var(--mono); letter-spacing: .08em; padding: 9px 12px; border-radius: 4px; border: 1px solid var(--amber); color: var(--amber); background: none; cursor: pointer; }
.acct-btn.on { border-color: var(--line); color: var(--cream); }
.modal-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: linear-gradient(180deg, var(--board-2), #12100c); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.modal h2 { font: 900 1.7rem/1 var(--display); text-transform: uppercase; margin: 0 0 6px; }
.modal p.sub { color: var(--muted); margin: 0 0 16px; font-size: .95rem; }
.modal .tabs2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; }
.modal .tabs2 button.on { background: var(--amber); color: #1a1306; box-shadow: none; }
.modal label.f { display: grid; gap: 6px; margin-bottom: 12px; }
.modal .avail { font: 400 .8rem/1 var(--mono); min-height: 1em; }
.modal .check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: .92rem; line-height: 1.45; }
.modal .check input { width: auto; margin-top: 4px; accent-color: var(--amber); }
.modal .err { color: var(--down); font-size: .92rem; min-height: 1.2em; margin: 6px 0 0; }
.modal .row2 { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.modal .link { background: none; border: 0; color: var(--muted); font: 400 .85rem/1 var(--mono); cursor: pointer; text-decoration: underline; padding: 0; }
.modal .danger { color: var(--down); }
.acct-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: .95rem; }
.acct-line b { color: var(--cream); font-weight: 600; }
.acct-line .btn { padding: 9px 14px; font-size: 1rem; }
.bot-tag { display: inline-block; margin-left: 6px; font: 400 .66rem/1 var(--mono); letter-spacing: .12em; padding: 3px 5px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); vertical-align: 2px; }

/* ---- activity metrics strip ---- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 22px 0 0; }
@media (max-width: 640px) { .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metrics div { background: #0c0b09; padding: 14px 16px; min-width: 0; }
.metrics b { display: block; font: 400 clamp(1.3rem, 3vw, 1.9rem)/1.1 var(--mono); color: var(--amber-hi); margin-top: 6px; font-variant-numeric: tabular-nums; }
