/* PlayPVP v1. Mobile first, functional rather than decorative. */

:root {
    --bg: #0f1115;
    --panel: #171a21;
    --panel-edge: #252a34;
    --ink: #e8eaf0;
    --ink-dim: #99a0b0;
    --accent: #4ade80;
    --accent-ink: #06240f;
    --danger: #f87171;
    --warn: #fbbf24;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
    width: 100%;
    max-width: 60rem;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Top bar ---------------------------------------------------------------- */

.topbar {
    border-bottom: 1px solid var(--panel-edge);
    background: var(--panel);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.5rem;
    flex-wrap: wrap;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ink);
    font-size: 1.15rem;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    font-size: 0.9rem;
}

.wallet {
    font-variant-numeric: tabular-nums;
    background: rgba(74, 222, 128, 0.12);
    color: var(--accent);
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    font-weight: 600;
}

.who { color: var(--ink-dim); }

/* Blocks ----------------------------------------------------------------- */

main.shell { padding-top: 1.5rem; padding-bottom: 2.5rem; }

.hero { margin-bottom: 1.75rem; }
.hero h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 0.5rem; }
.lead { color: var(--ink-dim); margin: 0 0 0.75rem; max-width: 44rem; }

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.panel.narrow { max-width: 26rem; margin-left: auto; margin-right: auto; }
.panel h1, .panel h2 { margin-top: 0; font-size: 1.15rem; }

.note {
    color: var(--ink-dim);
    font-size: 0.875rem;
    border-left: 2px solid var(--panel-edge);
    padding-left: 0.75rem;
    margin: 0.75rem 0 0;
}

.hint { color: var(--ink-dim); font-size: 0.8rem; margin: 0.25rem 0 0; }
.optional { color: var(--ink-dim); font-weight: 400; font-size: 0.8rem; }

/* Lists and definition pairs --------------------------------------------- */

.checklist { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.checklist li { padding: 0.2rem 0 0.2rem 1.5rem; position: relative; color: var(--ink-dim); }
.checklist li::before { content: "\25CB"; position: absolute; left: 0; }
.checklist li.done { color: var(--ink); }
.checklist li.done::before { content: "\2713"; color: var(--accent); }

.kv { display: grid; grid-template-columns: 1fr; gap: 0.15rem 1rem; margin: 0; }
.kv dt { color: var(--ink-dim); font-size: 0.85rem; }
.kv dd { margin: 0 0 0.6rem; font-variant-numeric: tabular-nums; }

@media (min-width: 30rem) {
    .kv { grid-template-columns: 12rem 1fr; }
    .kv dd { margin-bottom: 0.25rem; }
    .hero h1 { font-size: 2rem; }
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
}

/* Forms ------------------------------------------------------------------ */

label {
    display: block;
    margin: 0.9rem 0 0.3rem;
    font-size: 0.85rem;
    color: var(--ink-dim);
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--panel-edge);
    background: #10131a;
    color: var(--ink);
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.button, button[type="submit"] {
    display: inline-block;
    margin-top: 1.15rem;
    padding: 0.65rem 1.1rem;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.button.small { padding: 0.35rem 0.7rem; font-size: 0.85rem; margin-top: 0; }
.button:hover { text-decoration: none; filter: brightness(1.08); }

.link-button {
    background: none;
    border: 0;
    color: var(--accent);
    font-size: 0.9rem;
    padding: 0;
    margin: 0;
    cursor: pointer;
}
.link-button:hover { text-decoration: underline; }

form.inline { display: inline; }

.field-error { color: var(--danger); font-size: 0.85rem; margin: 0.3rem 0 0; }
.alt { margin-top: 1.25rem; font-size: 0.9rem; color: var(--ink-dim); }

/* Flash messages --------------------------------------------------------- */

.flashes { margin-bottom: 1rem; }

.flash {
    margin: 0 0 0.5rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid var(--panel-edge);
    background: var(--panel);
}

.flash-success { border-color: rgba(74, 222, 128, 0.4); color: var(--accent); }
.flash-error { border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }
.flash-warning { border-color: rgba(251, 191, 36, 0.4); color: var(--warn); }

/* Footer ----------------------------------------------------------------- */

.footer {
    border-top: 1px solid var(--panel-edge);
    padding-top: 1rem;
    color: var(--ink-dim);
    font-size: 0.8rem;
}

/* ==========================================================================
   Events, lottery, profile and admin
   ========================================================================== */

.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.page-head h1 { margin: 0; font-size: 1.5rem; }
.section { font-size: 1rem; margin: 1.5rem 0 0.75rem; color: var(--ink-dim); }
.empty { color: var(--ink-dim); font-style: italic; }

.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.total-pool { color: var(--ink-dim); font-size: 0.9rem; }
.total-pool strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Cards ------------------------------------------------------------------ */

.cards { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
    display: block; background: var(--panel); border: 1px solid var(--panel-edge);
    border-radius: var(--radius); padding: 1rem; color: var(--ink);
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card h3 { margin: 0.5rem 0 0.35rem; font-size: 1.05rem; }
.card-top { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.card-meta { margin: 0; color: var(--ink-dim); font-size: 0.85rem; }

/* Pills ------------------------------------------------------------------ */

.pill {
    display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.03em; background: rgba(255,255,255,0.08); color: var(--ink-dim);
}
.pill-open, .pill-won, .pill-win, .pill-approved, .pill-ok, .pill-drawn, .pill-released { background: rgba(74,222,128,0.16); color: var(--accent); }
.pill-voided, .pill-lost, .pill-failed, .pill-banned, .pill-rejected { background: rgba(248,113,113,0.16); color: var(--danger); }
.pill-verification, .pill-disputed, .pill-pending, .pill-running, .pill-suspended { background: rgba(251,191,36,0.16); color: var(--warn); }
.pill-muted { background: rgba(255,255,255,0.06); }

/* Pool bars -------------------------------------------------------------- */

.pool-row { padding: 0.6rem 0; border-bottom: 1px solid var(--panel-edge); }
.pool-row:last-child { border-bottom: 0; }
.pool-winner { background: rgba(74,222,128,0.05); border-radius: 8px; padding-left: 0.5rem; padding-right: 0.5rem; }
.pool-label { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.35rem; font-weight: 600; }
.pool-bar { height: 8px; background: rgba(255,255,255,0.07); border-radius: 999px; overflow: hidden; }
.pool-fill { height: 100%; background: var(--accent); transition: width 0.4s ease; }
.pool-figures { display: flex; gap: 0.75rem; margin-top: 0.35rem; font-size: 0.85rem; color: var(--ink-dim); }
.pool-figures strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Tables ----------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.5rem; display: block; overflow-x: auto; }
@media (min-width: 40rem) { .table { display: table; } }
.table th, .table td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--panel-edge); vertical-align: top; }
.table th { color: var(--ink-dim); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot th { border-top: 2px solid var(--panel-edge); border-bottom: 0; color: var(--ink); }
.breakdown td { padding-top: 0.7rem; padding-bottom: 0.7rem; }
.positive { color: var(--accent); }
.negative { color: var(--danger); }

/* Settlement ------------------------------------------------------------- */

.settlement h3 { font-size: 0.95rem; margin: 1.25rem 0 0.25rem; color: var(--ink-dim); }
.proof {
    margin: 0.75rem 0 0; padding: 0.75rem; border-radius: 8px;
    background: rgba(74,222,128,0.08); color: var(--accent); font-size: 0.9rem;
}

.verified { border-color: rgba(74,222,128,0.45); }
.unverified { border-color: rgba(248,113,113,0.55); }
.unverified-note { color: var(--danger); }

/* Lottery ---------------------------------------------------------------- */

.ticket-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
@media (min-width: 34rem) { .ticket-grid { grid-template-columns: repeat(4, 1fr); } }
.ticket { background: rgba(255,255,255,0.04); border-radius: 8px; padding: 0.7rem; text-align: center; }
.ticket-count { display: block; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ticket-tier { display: block; font-size: 0.75rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.04em; }

.hash { font-size: 0.78rem; word-break: break-all; }
.break { display: inline-block; max-width: 100%; }
.code {
    background: #0b0e14; border: 1px solid var(--panel-edge); border-radius: 8px;
    padding: 0.75rem; overflow-x: auto; font-size: 0.8rem; line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre;
}
.snapshot { max-height: 22rem; overflow-y: auto; }

/* Profile ---------------------------------------------------------------- */

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.6rem; }
.badge { text-align: center; padding: 0.75rem 0.4rem; border-radius: 8px; background: rgba(255,255,255,0.04); }
.badge.locked { opacity: 0.35; }
.badge.earned { background: rgba(74,222,128,0.12); }
.badge-icon { display: block; font-size: 1.2rem; font-weight: 700; }
.badge-name { display: block; font-size: 0.75rem; color: var(--ink-dim); margin-top: 0.2rem; }
.badge-dot { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 0.35rem; font-size: 0.7rem; }

.notifications { list-style: none; padding: 0; margin: 0; }
.notifications li { padding: 0.6rem 0; border-bottom: 1px solid var(--panel-edge); display: flex; flex-direction: column; gap: 0.15rem; }
.notifications li.unread { border-left: 2px solid var(--accent); padding-left: 0.6rem; }

/* Timeline, disputes, misc ------------------------------------------------ */

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0.4rem 0 0.4rem 1rem; border-left: 2px solid var(--panel-edge); }
.timeline li strong { display: block; }

.dispute { border-top: 1px solid var(--panel-edge); padding-top: 0.9rem; margin-top: 0.9rem; }
.dispute:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.quote { border-left: 2px solid var(--panel-edge); padding-left: 0.75rem; color: var(--ink-dim); font-style: italic; }

.disclaimer { border: 1px solid var(--warn); border-radius: 8px; padding: 0.9rem; margin-top: 1.25rem; }
.disclaimer h3 { margin-top: 0; font-size: 0.95rem; color: var(--warn); }
.disclaimer blockquote { margin: 0.5rem 0; padding-left: 0.75rem; border-left: 2px solid var(--panel-edge); font-size: 0.85rem; color: var(--ink-dim); }
.disclaimer blockquote em { display: block; margin-top: 0.4rem; color: var(--warn); }
.checkbox { display: flex; gap: 0.5rem; align-items: flex-start; color: var(--ink); }
.checkbox input { width: auto; margin-top: 0.2rem; }

.subnav { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; font-size: 0.9rem; }
.button-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline-row { display: flex; gap: 0.6rem; align-items: center; margin: 0.35rem 0; }
.link-button.danger { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.narrow-wide { max-width: 36rem; margin-left: auto; margin-right: auto; }
textarea { width: 100%; font-family: inherit; }

/* ==========================================================================
   Landing page
   ========================================================================== */

.hero-lead { padding: 1.5rem 0 2rem; }
.eyebrow {
    margin: 0 0 0.6rem; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent);
}
.hero-lead h1 {
    margin: 0 0 0.9rem; font-size: 2rem; line-height: 1.12;
    letter-spacing: -0.02em; font-weight: 800;
}
@media (min-width: 40rem) { .hero-lead h1 { font-size: 3rem; } }
.hero-lead .lead { font-size: 1.05rem; max-width: 38rem; }

.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.4rem; }
.hero-actions .button { margin-top: 0; }
.button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--panel-edge); }
.button.ghost:hover { border-color: var(--accent); filter: none; }
.hero-lead .hint { margin-top: 0.85rem; }

/* Live figures ------------------------------------------------------------ */

.stat-strip {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
    background: var(--panel-edge); border: 1px solid var(--panel-edge);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 0.5rem;
}
@media (min-width: 46rem) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--panel); padding: 1rem 0.9rem; }
.stat-value {
    display: block; font-size: 1.5rem; font-weight: 700;
    font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.stat-label { display: block; font-size: 0.78rem; color: var(--ink-dim); margin-top: 0.15rem; }
.strip-note { margin: 0 0 1.5rem; font-size: 0.75rem; color: var(--ink-dim); }

/* Steps ------------------------------------------------------------------- */

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0.5rem 0 0; }
.steps li {
    counter-increment: step; position: relative;
    padding: 0.55rem 0 0.55rem 2.4rem; display: flex; flex-direction: column; gap: 0.1rem;
}
.steps li::before {
    content: counter(step); position: absolute; left: 0; top: 0.55rem;
    width: 1.6rem; height: 1.6rem; border-radius: 999px;
    background: rgba(74, 222, 128, 0.14); color: var(--accent);
    font-size: 0.8rem; font-weight: 700; display: grid; place-items: center;
}
.steps li span { color: var(--ink-dim); font-size: 0.9rem; }

/* The split bar ----------------------------------------------------------- */

.split-bar {
    display: flex; height: 2rem; border-radius: 8px; overflow: hidden;
    margin: 1rem 0 0.9rem; background: var(--panel-edge);
}
/* A 0.2% slice is sub pixel on a phone, so give every segment a floor. The
   90% segment shrinks to absorb it, which keeps the bar honest to the eye
   without misrepresenting the numbers printed beside it. */
.split-seg { display: block; height: 100%; min-width: 4px; }
.seg-return   { background: var(--accent); }
.seg-platform { background: #60a5fa; }
.seg-host     { background: #c084fc; }
.seg-lottery  { background: var(--warn); }
.seg-charity  { background: #f472b6; }

.split-key { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; font-size: 0.9rem; }
@media (min-width: 40rem) { .split-key { grid-template-columns: 1fr 1fr; } }
.split-key li { display: flex; align-items: center; gap: 0.5rem; color: var(--ink-dim); }
.split-key strong { color: var(--ink); font-variant-numeric: tabular-nums; min-width: 3.2rem; }
.key-dot { width: 0.7rem; height: 0.7rem; border-radius: 3px; flex: none; }

/* Trust ------------------------------------------------------------------- */

.trust-grid { display: grid; gap: 1rem; margin-top: 0.5rem; }
@media (min-width: 40rem) { .trust-grid { grid-template-columns: 1fr 1fr; } }
.trust h3 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.trust p { margin: 0 0 0.4rem; color: var(--ink-dim); font-size: 0.9rem; }

.cta { text-align: center; }
.cta h2 { font-size: 1.3rem; }
.cta p { color: var(--ink-dim); }

.legal { font-size: 0.78rem; color: var(--ink-dim); max-width: 44rem; margin: 1.5rem 0 0; }
.footer-links { display: flex; gap: 1rem; margin: 0.4rem 0 0; }

/* ==========================================================================
   Mobile
   --------------------------------------------------------------------------
   The real product is an app, so the phone layout is the one that matters and
   the desktop layout is the adaptation, not the other way round.
   ========================================================================== */

/* Respect the notch and the home indicator on iPhones. */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Nothing may push the page sideways. This is deliberately handled at the
   source rather than with overflow-x: hidden on html or body, because that
   breaks position: sticky in Safari and the top bar is sticky on every page.
   Instead: no fixed pixel widths anywhere, tables scroll inside their own
   container, and long unbroken strings wrap. */
html, body { max-width: 100%; }

/* Bottom tab bar ---------------------------------------------------------- */

.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    display: flex; background: var(--panel);
    border-top: 1px solid var(--panel-edge);
    padding-bottom: env(safe-area-inset-bottom);
}

.tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.1rem; padding: 0.5rem 0.25rem; min-height: 3.25rem;
    color: var(--ink-dim); font-size: 0.68rem; position: relative;
    -webkit-tap-highlight-color: transparent;
}
.tab:hover { text-decoration: none; }
.tab.is-active { color: var(--accent); }
.tab-icon { font-size: 0.9rem; line-height: 1; }
.tab-label { letter-spacing: 0.01em; }
.tab-dot {
    position: absolute; top: 0.45rem; right: 50%; margin-right: -1rem;
    width: 0.45rem; height: 0.45rem; border-radius: 999px; background: var(--danger);
}

/* Clear the bar so the last element on a page is never trapped underneath it. */
main.shell { padding-bottom: 5rem; }
.footer { padding-bottom: 5rem; }

@media (min-width: 40rem) {
    .tabbar { display: none; }
    main.shell { padding-bottom: 2.5rem; }
    .footer { padding-bottom: 1rem; }
}

/* Top bar ----------------------------------------------------------------- */

.desktop-only { display: none; }

@media (min-width: 40rem) {
    .desktop-only { display: inline-block; }
    form.inline.desktop-only { display: inline; }
}

.topbar-inner { flex-wrap: nowrap; min-height: 3.25rem; }
.topnav { gap: 0.6rem; }
.topnav a.is-active { color: var(--ink); }
.wallet { white-space: nowrap; }

@media (min-width: 40rem) { .topnav { gap: 0.85rem; } }

/* Touch targets ----------------------------------------------------------- */

/* Anything tappable gets a comfortable target on a touch screen. */
@media (pointer: coarse) {
    .button, button[type="submit"] { min-height: 2.75rem; }
    .button.small { min-height: 2.25rem; }
    .topnav a, .link-button, .subnav a { min-height: 2.25rem; display: inline-flex; align-items: center; }
    .table td a { display: inline-block; padding: 0.15rem 0; }
}

/* Inputs at 16px or above, otherwise iOS zooms the whole page on focus. */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea { font-size: 16px; }

/* Scrollable tables ------------------------------------------------------- */

.table {
    -webkit-overflow-scrolling: touch;
    /* A right hand fade hints that there is more to see, and disappears once
       the table is scrolled to the end. */
    background:
        linear-gradient(to right, var(--panel) 30%, rgba(23, 26, 33, 0)) left center / 2rem 100% no-repeat,
        linear-gradient(to left, var(--panel) 30%, rgba(23, 26, 33, 0)) right center / 2rem 100% no-repeat;
    background-attachment: local, local;
}

@media (max-width: 39.99rem) {
    .table th, .table td { padding: 0.45rem 0.5rem; white-space: nowrap; }
    /* The first column carries the label, so let it wrap rather than forcing
       the whole row wider than the screen. */
    .table td:first-child { white-space: normal; min-width: 8rem; }
    .breakdown td:first-child { min-width: 11rem; }
}

/* Landing page on a phone -------------------------------------------------- */

@media (max-width: 39.99rem) {
    .hero-lead { padding: 1rem 0 1.5rem; }
    .hero-lead h1 { font-size: 1.9rem; }
    /* The forced break is a desktop nicety. On a phone it makes the line ragged. */
    .hero-lead h1 br { display: none; }
    .hero-actions .button { flex: 1 1 auto; text-align: center; }
    .panel { padding: 1rem; }
    .stat { padding: 0.85rem 0.75rem; }
    .stat-value { font-size: 1.25rem; }
    .split-key { font-size: 0.85rem; }
    .page-head h1 { font-size: 1.3rem; }
}

/* Forms and bet slip ------------------------------------------------------- */

@media (max-width: 39.99rem) {
    .grid-2 { grid-template-columns: 1fr; }
    .bet-slip .button { width: 100%; }
    .button-row .button { flex: 1 1 auto; }
    .ticket-grid { grid-template-columns: repeat(2, 1fr); }
    .trust-grid { gap: 1.25rem; }
}

/* Long strings ------------------------------------------------------------- */

.hash, code { overflow-wrap: anywhere; }
.code { font-size: 0.72rem; }
@media (min-width: 40rem) { .code { font-size: 0.8rem; } }
