/* ============================================================
   The Vault — player-facing styles.
   Original work. Dark, high-contrast, tabular numbers, and an
   ember accent that is reserved for money and primary actions
   so the eye lands on the figure that matters.
   ============================================================ */

:root {
  --bg:        #0e0f13;
  --surface:   #16181f;
  --surface-2: #1d2029;
  --line:      #2a2e3a;
  --line-warm: rgba(232,163,61,.28);

  --text:      #e7e8ee;
  --muted:     #8f94a6;
  --dim:       #656a7c;

  --ember:     #e8a33d;
  --ember-dim: rgba(232,163,61,.14);
  --teal:      #3fb7a6;
  --teal-dim:  rgba(63,183,166,.13);
  --crimson:   #d9614c;
  --crimson-dim: rgba(217,97,76,.13);
  --discord:   #5865F2;

  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --wrap: 58rem;
  --pad: clamp(1rem, 4vw, 2rem);
  --r: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(.98rem, .35vw + .92rem, 1.04rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ember); text-underline-offset: 3px; }
a:hover { color: #fff; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* -- header ------------------------------------------------- */

.nav { border-bottom: 1px solid var(--line); background: var(--surface); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .8rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 1.5rem; height: 1.5rem; border-radius: 4px; flex: none;
  background: linear-gradient(135deg, var(--ember), #b4762a);
  display: grid; place-items: center; color: #17181d;
  font-weight: 800; font-size: .85rem;
}
.brand-name { font-weight: 650; letter-spacing: .01em; }
.nav-right { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
.nav-who { color: var(--muted); }
.nav-who strong { color: var(--text); font-weight: 600; }

/* -- type --------------------------------------------------- */

h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.08; margin: 0 0 .5rem; letter-spacing: -.015em; }
h2 { font-size: 1.16rem; margin: 0 0 .7rem; letter-spacing: -.005em; }
h3 { font-size: .96rem; margin: 0 0 .3rem; }
.lede { color: var(--muted); margin-top: 0; font-size: 1.05rem; }
.fine { color: var(--dim); font-size: .84rem; }
.eyebrow {
  font-size: .74rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ember); margin-bottom: .5rem; font-weight: 600;
}

main { padding-block: clamp(1.5rem, 5vw, 2.8rem) 4rem; }

/* -- cards -------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 1rem;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.grid .card { margin-bottom: 0; }

/* -- balance ------------------------------------------------ */

.balance-card { border-color: var(--line-warm); background: linear-gradient(180deg, var(--ember-dim), transparent 60%), var(--surface); }
.balance { display: flex; gap: 2.5rem; flex-wrap: wrap; align-items: flex-end; }
.balance-main .figure { font-size: clamp(2.1rem, 7vw, 3rem); color: var(--ember); line-height: 1.05; }
.balance-held .figure { font-size: 1.5rem; color: var(--muted); line-height: 1.05; }
.figure { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.balance-label { color: var(--dim); font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; }

/* -- forms -------------------------------------------------- */

label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .3rem; }

input[type="text"], input[type="number"] {
  width: 100%; padding: .6rem .7rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit;
}
input[type="number"], input.code-in { font-family: var(--mono); font-variant-numeric: tabular-nums; }
input:focus { border-color: var(--ember); outline: none; }
input::placeholder { color: var(--dim); }

.row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.row > .grow { flex: 1 1 9rem; }

.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 550; padding: .58rem 1.1rem; border-radius: 7px;
  cursor: pointer; text-decoration: none; white-space: nowrap; display: inline-block;
}
.btn:hover:not(:disabled) { border-color: var(--dim); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ember); border-color: var(--ember); color: #17181d; }
.btn-primary:hover:not(:disabled) { background: #f0b45b; border-color: #f0b45b; color: #17181d; }
.btn-quiet { background: none; color: var(--muted); font-weight: 400; font-size: .88rem; padding: .42rem .8rem; }
.btn-discord { background: var(--discord); border-color: var(--discord); color: #fff; font-size: 1.02rem; padding: .7rem 1.4rem; }
.btn-discord:hover:not(:disabled) { background: #4752c4; border-color: #4752c4; color: #fff; }

/* -- link code ---------------------------------------------- */

.code-display {
  font-family: var(--mono); font-size: clamp(1.4rem, 6vw, 1.9rem);
  letter-spacing: .2em; color: var(--teal); background: var(--surface-2);
  border: 1px dashed var(--teal); border-radius: 8px;
  padding: .7rem .8rem; text-align: center; margin: .8rem 0; word-break: break-all;
}
.steps { margin: .4rem 0 0; padding-left: 1.15rem; color: var(--muted); }
.steps li { margin-bottom: .25rem; }
.steps b, .steps code { color: var(--text); }
.steps code { font-family: var(--mono); background: var(--surface-2); padding: .08rem .3rem; border-radius: 4px; }

/* -- how it works ------------------------------------------- */

.howto { counter-reset: step; display: grid; gap: .8rem; margin: 0; padding: 0; list-style: none; }
.howto li {
  counter-increment: step; position: relative; padding-left: 2.4rem;
  color: var(--muted);
}
.howto li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: .1rem;
  font-family: var(--mono); font-size: .8rem; color: var(--ember);
  border: 1px solid var(--line-warm); border-radius: 5px;
  width: 1.75rem; text-align: center; padding: .05rem 0;
}
.howto strong { color: var(--text); display: block; font-weight: 600; }

/* -- notes and pills ---------------------------------------- */

.note { border-radius: 7px; padding: .55rem .8rem; font-size: .9rem; margin-top: .75rem; border: 1px solid; }
.note-ok   { background: var(--teal-dim);    border-color: rgba(63,183,166,.42);  color: #7fd6c9; }
.note-bad  { background: var(--crimson-dim); border-color: rgba(217,97,76,.45);   color: #eb907c; }
.note-wait { background: var(--ember-dim);   border-color: var(--line-warm);      color: #d9b579; }
[hidden] { display: none !important; }

.pill {
  display: inline-block; font-size: .7rem; text-transform: uppercase;
  letter-spacing: .07em; padding: .14rem .48rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap; font-weight: 600;
}
.pill-settled  { color: #7fd6c9; border-color: rgba(63,183,166,.42); }
.pill-review   { color: #eb907c; border-color: rgba(217,97,76,.45); }
.pill-aborted  { color: var(--dim); }
.pill-intent, .pill-reserved, .pill-acting { color: #d9b579; border-color: var(--line-warm); }

/* -- table --------------------------------------------------- */

.table-scroll { overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--dim); font-weight: 500; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
td.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--dim); font-style: italic; }

/* -- footer -------------------------------------------------- */

footer { border-top: 1px solid var(--line); padding-block: 1.3rem; color: var(--dim); font-size: .84rem; }
footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* -- owner panel --------------------------------------------- */

.admin-head { margin-bottom: .8rem; }

.admin-nav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.admin-nav a {
  padding: .4rem .85rem; border-radius: 7px; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font-size: .9rem;
}
.admin-nav a:hover { color: var(--text); border-color: var(--dim); }
.admin-nav a.on { color: var(--ember); border-color: var(--line-warm); background: var(--ember-dim); }
.badge {
  display: inline-block; background: var(--crimson); color: #fff;
  border-radius: 999px; padding: 0 .38rem; font-size: .72rem; font-weight: 700;
}

/* The reconciliation banner. Deliberately the largest thing on the page:
   whether the books match the Bank's wallet is the one question the previous
   system could not answer. */
.recon {
  border-radius: var(--r); padding: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 1.1rem; border: 1px solid;
}
.recon-label { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; opacity: .85; }
.recon-figure {
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600;
  font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.1;
}
.recon p { margin: .3rem 0 0; }
.recon-ok      { background: var(--teal-dim);    border-color: rgba(63,183,166,.42); color: #7fd6c9; }
.recon-bad     { background: var(--crimson-dim); border-color: rgba(217,97,76,.5);   color: #eb907c; }
.recon-unknown { background: var(--surface);     border-color: var(--line);          color: var(--muted); }
.recon .fine { color: inherit; opacity: .85; }

.stats { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; }
.stat-label { color: var(--dim); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.stat-figure { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.5rem; font-weight: 600; }
.stat-warn { border-color: rgba(217,97,76,.45); }
.stat-warn .stat-figure { color: #eb907c; }

.drift-ok  { color: var(--dim); }
.drift-bad { color: #eb907c; font-weight: 600; }

.readings { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); margin: .8rem 0; }
.readings .figure { font-size: 1.3rem; }

.admin-actions { border-top: 1px solid var(--line); margin-top: .9rem; padding-top: .7rem; }
.admin-actions > summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.admin-actions > summary:hover { color: var(--text); }
.admin-actions .stack > * + * { margin-top: .6rem; }
.admin-actions form + p, .admin-actions p + form { margin-top: .7rem; }

select {
  width: 100%; padding: .6rem .7rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit;
}
select:focus { border-color: var(--ember); outline: none; }

.pill-role { color: var(--ember); border-color: var(--line-warm); }
.review-card { border-color: rgba(217,97,76,.35); }

/* -- duels ---------------------------------------------------- */

.vs { color: var(--dim); font-weight: 400; font-size: .85em; }

.sides { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); margin: .8rem 0 .4rem; }
.side { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .7rem .8rem; }
.side-won { border-color: rgba(63,183,166,.45); background: var(--teal-dim); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }

/* Share of the pot at a glance. Width is the side's fraction, so the two bars
   read as one split rather than two unrelated figures. */
.side-bar { height: 5px; border-radius: 3px; background: var(--line); margin: .45rem 0; overflow: hidden; }
.side-bar span { display: block; height: 100%; background: var(--ember); transition: width .3s ease; }
.side-won .side-bar span { background: var(--teal); }

.side-figures { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.side-figures .num { font-size: 1.1rem; font-weight: 600; }

.duel-card .bet-form { margin-top: .6rem; }
.queued { align-items: center; margin-bottom: .5rem; }

/* -- notice pop-ups -------------------------------------------- */

.notice-stack {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  display: grid; gap: .6rem; max-width: min(22rem, calc(100vw - 2rem));
}
.notice-pop {
  background: var(--surface); border: 1px solid var(--line-warm);
  border-radius: var(--r); padding: .9rem 1rem;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  animation: notice-in .25s ease;
}
.notice-pop-win { border-color: rgba(63,183,166,.5); background: linear-gradient(180deg, var(--teal-dim), var(--surface) 70%); }
.notice-title { font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.notice-figure {
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600;
  font-size: 1.9rem; line-height: 1.15; color: var(--ember);
}
.notice-pop-win .notice-figure { color: #7fd6c9; }
.notice-body { margin: .2rem 0 .6rem; font-size: .88rem; color: var(--muted); }

@keyframes notice-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .notice-pop { animation: none; } .side-bar span { transition: none; } }

.pill-open      { color: #7fd6c9; border-color: rgba(63,183,166,.42); }
.pill-scheduled { color: #d9b579; border-color: var(--line-warm); }
.pill-closed    { color: var(--muted); }
.pill-cancelled { color: var(--dim); }

.stat-note { color: var(--dim); font-size: .78rem; margin-top: .15rem; }
