/* Neon Bounce — sistema de design
 *
 * Dois temas (escuro e "branco neon"), os mesmos papéis de cor:
 *   acção (ciano) · dinheiro ganho (lima/verde) · perda (vermelho) · carteira (âmbar)
 *   --x  = cor de preenchimento (botões, barras)   --x-ink = a mesma cor para texto sobre o fundo
 * Forma: cantos cortados = carrega-se (botões) · cantos redondos = contém (painéis, folhas)
 * Espaço: escala de 4 px (--s1 … --s6). Letra: 12 / 14 / 16 / 20 / 28 px e o mostrador do multiplicador.
 */

:root,
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #070A1F;
    --surface: rgba(14, 18, 51, 0.9);
    --surface-solid: #0E1233;
    --surface-2: #161B47;
    --field: rgba(0, 0, 0, 0.3);
    --line: #262C66;
    --line-strong: #3A4290;
    --text: #E9ECFF;
    --muted: #9AA1D0;
    --faint: #6A71A6;
    --scrim: rgba(3, 4, 14, 0.72);
    --shadow: 0 24px 64px rgba(0, 0, 0, 0.5);

    --action: #22E6FF;      --on-action: #03202A;  --action-ink: #22E6FF;
    --money: #7CFF4F;       --on-money: #0B2003;   --money-ink: #7CFF4F;
    --loss: #FF4757;        --loss-ink: #FF5C69;   --loss-soft: rgba(255, 71, 87, 0.14);
    --wallet: #FFC23C;      --wallet-ink: #FFC23C; --wallet-soft: rgba(255, 194, 60, 0.1);

    --hud-text: #FFFFFF;
    --hud-glow: 0 0 28px rgba(34, 230, 255, 0.55);
    --topbar: rgba(7, 10, 31, 0.82);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #F2F5FF;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #FFFFFF;
    --surface-2: #EEF2FF;
    --field: #F6F8FF;
    --line: #DCE2F7;
    --line-strong: #B9C3EA;
    --text: #0B1030;
    --muted: #4F5784;
    --faint: #8A91B6;
    --scrim: rgba(20, 26, 60, 0.35);
    --shadow: 0 24px 64px rgba(30, 40, 100, 0.18);

    --action: #00D4F0;      --on-action: #022530;  --action-ink: #0089A6;
    --money: #3FE35A;       --on-money: #06290C;   --money-ink: #13932A;
    --loss: #F0283C;        --loss-ink: #D11A2D;   --loss-soft: rgba(240, 40, 60, 0.1);
    --wallet: #FFB800;      --wallet-ink: #A86F00; --wallet-soft: rgba(255, 184, 0, 0.12);

    --hud-text: #0B1030;
    --hud-glow: 0 0 26px rgba(0, 212, 240, 0.55);
    --topbar: rgba(242, 245, 255, 0.86);
}

:root {
    --font-display: 'Orbitron', system-ui, sans-serif;
    --font-ui: 'Rajdhani', system-ui, sans-serif;

    --fs-12: 0.75rem;
    --fs-14: 0.875rem;
    --fs-16: 1rem;
    --fs-20: 1.25rem;
    --fs-28: 1.75rem;
    --fs-hud: clamp(3.25rem, 9vw, 5.5rem);

    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;

    --h-sm: 36px;
    --h-md: 44px;
    --h-lg: 56px;
    --h-xl: 72px;
    --cut: 8px;
    --radius: 16px;
    --radius-sm: 10px;

    --bar-h: 60px;
    --rail-w: 300px;
    --dock-w: 520px;
    --edge: var(--s4);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: var(--fs-16);
    font-weight: 500;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .3s, color .3s;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--action-ink); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }
.display { font-family: var(--font-display); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-win { color: var(--money-ink); }
.text-loss { color: var(--loss-ink); }
.text-wallet { color: var(--wallet-ink); }
.text-action { color: var(--action-ink); }
.select-text { user-select: text; -webkit-user-select: text; }

/* ---------- Botões: cantos cortados ---------- */

.btn {
    --btn-bg: var(--surface-2);
    --btn-fg: var(--text);
    --btn-line: var(--line-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    min-height: var(--h-md);
    padding: 0 var(--s4);
    border: 0;
    background: var(--btn-bg);
    color: var(--btn-fg);
    box-shadow: inset 0 0 0 1px var(--btn-line);
    font-size: var(--fs-16);
    font-weight: 700;
    white-space: nowrap;
    clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
    transition: background-color .15s, color .15s, box-shadow .15s, transform .08s, opacity .15s;
    user-select: none;
}
.btn:hover:not(:disabled) { --btn-line: var(--action-ink); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn i { font-size: 1.2em; }

.btn-sm { min-height: var(--h-sm); padding: 0 var(--s3); font-size: var(--fs-14); }
.btn-icon { width: var(--h-md); padding: 0; }
.btn-sm.btn-icon { width: var(--h-sm); }
.btn-block { width: 100%; }
.btn-ghost { --btn-bg: transparent; --btn-line: var(--line); }

.btn-action { --btn-bg: var(--action); --btn-fg: var(--on-action); --btn-line: transparent; }
.btn-action:hover:not(:disabled) { --btn-line: transparent; filter: brightness(1.08); }
.btn-money { --btn-bg: var(--money); --btn-fg: var(--on-money); --btn-line: transparent; }
.btn-money:hover:not(:disabled) { --btn-line: transparent; filter: brightness(1.06); }
.btn-danger { --btn-bg: transparent; --btn-fg: var(--loss-ink); --btn-line: var(--loss); }
.btn-danger:hover:not(:disabled) { --btn-bg: var(--loss-soft); --btn-line: var(--loss); }

/* Verbos do jogo */
.btn-verb {
    min-height: var(--h-lg);
    font-family: var(--font-display);
    font-size: var(--fs-16);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    --cut: 12px;
}

/* ---------- Superfícies: cantos redondos ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
}
.panel-title { margin: 0; font-size: var(--fs-16); font-weight: 700; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--s1);
    min-height: 28px;
    padding: 0 var(--s3);
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: var(--fs-14);
    font-weight: 700;
    white-space: nowrap;
}
.chip-win { color: var(--money-ink); }
.chip-loss { color: var(--loss-ink); }

/* ---------- Estrutura ---------- */

#canvas-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
#canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
    -webkit-touch-callout: none;
    user-select: none;
}

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 30;
    height: var(--bar-h);
    display: flex;
    align-items: center;
    gap: var(--s2);
    padding: 0 var(--edge);
    padding-top: env(safe-area-inset-top);
    background: var(--topbar);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.topbar-spacer { flex: 1; }

.wallet {
    display: inline-flex;
    align-items: center;
    gap: var(--s2);
    min-height: var(--h-md);
    padding: 0 var(--s4) 0 var(--s3);
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--wallet) 50%, transparent);
    background: var(--wallet-soft);
}
.wallet i { color: var(--wallet-ink); font-size: 1.15em; }
.wallet-value { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-16); color: var(--wallet-ink); }
.wallet-unit { font-size: var(--fs-12); font-weight: 700; color: var(--wallet-ink); opacity: .75; }

.announcement {
    position: fixed;
    top: calc(var(--bar-h) + var(--s2));
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    width: min(640px, calc(100% - 2 * var(--edge)));
    display: flex;
    align-items: flex-start;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--wallet) 55%, transparent);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    font-size: var(--fs-14);
    font-weight: 600;
}
.announcement i { color: var(--wallet-ink); font-size: 1.3em; flex: none; }

.rail {
    position: fixed;
    z-index: 20;
    top: calc(var(--bar-h) + var(--s4));
    bottom: var(--s4);
    left: var(--s4);
    width: var(--rail-w);
    display: none;
    flex-direction: column;
    gap: var(--s4);
}
.rail .panel { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); min-height: 0; }
.rail .panel-scroll { flex: 1; }
.list { display: flex; flex-direction: column; gap: var(--s2); overflow-y: auto; min-height: 0; }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    min-height: 48px;
    padding: var(--s2) var(--s3);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: var(--fs-14);
    font-weight: 600;
}
button.row { width: 100%; border: 0; text-align: left; }
button.row:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.row-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.row-sub { font-size: var(--fs-12); font-weight: 500; color: var(--muted); }
.row-value { font-family: var(--font-display); font-size: var(--fs-14); font-weight: 700; white-space: nowrap; }
.empty { padding: var(--s4) var(--s1); text-align: center; font-size: var(--fs-14); color: var(--faint); }

/* ---------- HUD ---------- */

.hud {
    position: fixed;
    z-index: 15;
    left: 50%;
    top: calc(var(--bar-h) + var(--s5));
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s;
}
.hud.is-live { opacity: 1; }
.hud-mult {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: var(--fs-hud);
    line-height: 1;
    color: var(--hud-text);
    text-shadow: 0 0 20px rgba(34, 230, 255, 0.65), 0 0 45px rgba(34, 230, 255, 0.35);
    letter-spacing: -0.02em;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5));
    transition: transform .12s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hud-meta { margin-top: var(--s3); display: inline-flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); }

/* ---------- Doca de controlo ---------- */

.dock {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: var(--s4);
    transform: translateX(-50%);
    width: min(var(--dock-w), calc(100% - 2 * var(--s4)));
    padding: var(--s4);
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    border: 1px solid var(--line-strong);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(34, 230, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.strip { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); }
.strip::-webkit-scrollbar { display: none; }

.dock-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 24px; }
.dock-label { font-size: var(--fs-14); font-weight: 700; }
.dock-hint { font-size: var(--fs-12); color: var(--muted); }
.link { background: none; border: 0; padding: 0; color: var(--action-ink); font-size: var(--fs-14); font-weight: 700; }

.amount { display: grid; grid-template-columns: var(--h-lg) 1fr var(--h-lg); gap: var(--s2); }
.amount .btn { min-height: var(--h-lg); font-size: var(--fs-20); }
.amount-field {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--field);
}
.amount-field:focus-within { border-color: var(--action-ink); }
.amount-field input {
    width: 100%;
    height: var(--h-lg);
    padding: 0 44px 0 var(--s4);
    border: 0;
    background: transparent;
    font-family: var(--font-display);
    font-size: var(--fs-28);
    font-weight: 700;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
}
.amount-field input::-webkit-outer-spin-button,
.amount-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount-unit { position: absolute; right: var(--s3); font-size: var(--fs-12); font-weight: 700; color: var(--faint); }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); }

.play { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.play .btn-verb { min-height: var(--h-xl); flex-direction: column; gap: 2px; }
.verb-sub { font-family: var(--font-ui); font-size: var(--fs-14); font-weight: 700; letter-spacing: 0; text-transform: none; opacity: .8; }
.verb-value { font-size: var(--fs-20); letter-spacing: 0.02em; }

.closed { text-align: center; padding: var(--s2) 0; }
.closed h2 { margin: 0 0 var(--s1); font-size: var(--fs-20); }

/* ---------- Menu ---------- */

.menu-list { display: flex; flex-direction: column; gap: var(--s1); }
.menu-item {
    display: flex;
    align-items: center;
    gap: var(--s3);
    width: 100%;
    min-height: 52px;
    padding: 0 var(--s3);
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: var(--fs-16);
    font-weight: 600;
    text-align: left;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item > i:first-child { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--action-ink); font-size: 1.2em; flex: none; }
.menu-item .menu-label { flex: 1; display: flex; flex-direction: column; }
.menu-item .menu-sub { font-size: var(--fs-12); font-weight: 500; color: var(--muted); }
.menu-item > .ph-caret-right { color: var(--faint); }
.menu-item.is-danger, .menu-item.is-danger > i:first-child { color: var(--loss-ink); }
.menu-sep { height: 1px; background: var(--line); margin: var(--s2) 0; }

.menu-user { display: flex; align-items: center; gap: var(--s3); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--action); color: var(--on-action); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-16); flex: none; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 52px; padding: 0 var(--s3); }
.setting-label { display: flex; align-items: center; gap: var(--s3); font-weight: 600; }
.setting-label i { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--action-ink); font-size: 1.2em; }

.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + span { background: var(--action); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--action-ink); outline-offset: 2px; }

.legal { font-size: var(--fs-12); color: var(--faint); text-align: center; margin: 0; }
.legal .link { font-size: inherit; }

.check { display: grid; grid-template-columns: 22px 1fr; gap: var(--s3); align-items: start; font-size: var(--fs-14); color: var(--muted); line-height: 1.45; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--action); }

/* ---------- Modais / folhas ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s4);
    background: var(--scrim);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.modal.hidden { display: none; }
.sheet {
    width: min(480px, 100%);
    max-height: calc(100dvh - 2 * var(--s4));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface-solid);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    animation: sheet-in .22s ease-out;
}
.sheet-wide { width: min(600px, 100%); }
.sheet-grip { display: none; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: var(--s2) auto 0; }
.sheet-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3);
    padding: var(--s4) var(--s5);
    background: var(--surface-solid);
    border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0; font-size: var(--fs-20); font-weight: 700; }
.sheet-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s5); }
.section { display: flex; flex-direction: column; gap: var(--s3); }
.section h3 { margin: 0; font-size: var(--fs-16); font-weight: 700; }
.section p { margin: 0; }
.note { margin: 0; font-size: var(--fs-14); color: var(--muted); line-height: 1.5; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.field { display: flex; flex-direction: column; gap: var(--s2); }
.field > span { font-size: var(--fs-14); font-weight: 600; color: var(--muted); }
.input, .select {
    width: 100%;
    min-height: var(--h-md);
    padding: 0 var(--s3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--field);
    font-size: var(--fs-16);
    outline: none;
}
.input:focus, .select:focus { border-color: var(--action-ink); }
.inline { display: flex; gap: var(--s2); }
.inline > .input, .inline > .select { flex: 1; min-width: 0; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: var(--s1); gap: var(--s1); border-radius: 12px; background: var(--field); border: 1px solid var(--line); }
.segmented button { min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 700; }
.segmented button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: var(--s2); }
.stat { padding: var(--s3); border-radius: var(--radius-sm); background: var(--surface-2); }
.stat-label { font-size: var(--fs-12); font-weight: 600; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-size: var(--fs-16); font-weight: 700; margin-top: 2px; }

.table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.table th { text-align: left; font-weight: 600; font-size: var(--fs-12); color: var(--muted); padding: var(--s2); border-bottom: 1px solid var(--line); }
.table td { padding: var(--s2); border-bottom: 1px solid var(--line); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }

.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--s3); counter-reset: step; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: var(--s3); align-items: start; counter-increment: step; }
.steps li::before {
    content: counter(step);
    display: grid; place-items: center;
    width: 32px; height: 32px; border-radius: 50%;
    border: 1.5px solid var(--action-ink); color: var(--action-ink);
    font-family: var(--font-display); font-weight: 700; font-size: var(--fs-14);
}
.steps strong { display: block; }
.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: var(--s2); font-size: var(--fs-14); color: var(--muted); }
.rules strong { color: var(--text); font-weight: 700; }

.error { margin: 0; font-size: var(--fs-14); font-weight: 600; color: var(--loss-ink); }
.banner-break { padding: var(--s3) var(--s4); border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--wallet) 50%, transparent); background: var(--wallet-soft); font-size: var(--fs-14); font-weight: 600; }

/* Carteira real (K5): título de secção de histórico dentro do modal */
#wallet-modal .section h4 { margin: 0 0 var(--s2); font-size: var(--fs-14); font-weight: 700; color: var(--muted); }

.progress { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--wallet); transition: width .9s linear; }

/* ---------- Drawer de histórico (telemóvel) ---------- */

.drawer {
    position: fixed;
    z-index: 90;
    top: 0; right: 0; bottom: 0;
    width: min(360px, 90vw);
    padding: calc(var(--bar-h) + var(--s3)) var(--s4) var(--s4);
    display: flex; flex-direction: column; gap: var(--s3);
    background: var(--surface-solid);
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateX(105%);
    transition: transform .25s ease;
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Toasts ---------- */

.toasts {
    position: fixed;
    z-index: 200;
    top: calc(var(--bar-h) + var(--s3));
    right: var(--s4);
    display: flex; flex-direction: column; gap: var(--s2);
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: var(--s3);
    min-width: 240px; max-width: 360px;
    padding: var(--s3) var(--s4);
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    border-left: 4px solid var(--action);
    background: var(--surface-solid);
    font-size: var(--fs-14); font-weight: 700;
    box-shadow: var(--shadow);
    animation: toast-in .2s ease-out;
}
.toast i { font-size: 1.3em; color: var(--action-ink); }
.toast-win { border-left-color: var(--money); } .toast-win i { color: var(--money-ink); }
.toast-loss { border-left-color: var(--loss); } .toast-loss i { color: var(--loss-ink); }
.toast-wallet { border-left-color: var(--wallet); } .toast-wallet i { color: var(--wallet-ink); }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: all .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Splash ---------- */

.splash { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--bg); transition: opacity .4s; }
.loader { width: 40px; height: 40px; border: 3px solid var(--action); border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.wordmark { font-family: var(--font-display); font-weight: 900; font-size: var(--fs-20); letter-spacing: 0.14em; color: var(--action-ink); }

/* ---------- Responsivo ---------- */

.only-mobile { display: inline-flex; }
.from-sm { display: none; }

@media (min-width: 640px) {
    .from-sm { display: inline; }
}

@media (min-width: 1024px) {
    .rail { display: flex; }
    .only-mobile { display: none; }
    .dock, .hud { left: calc(50% + (var(--rail-w) + var(--s4)) / 2); }
}

/* Telemóvel: doca e modais como folhas que sobem do fundo */
@media (max-width: 639px) {
    :root { --bar-h: 56px; --edge: var(--s3); }
    .wallet { min-height: 40px; padding: 0 var(--s3) 0 var(--s2); }
    .topbar .btn { min-height: 40px; }
    .topbar .btn-icon { width: 40px; }

    .dock {
        left: 0; right: 0; bottom: 0;
        transform: none;
        width: 100%;
        border-radius: 22px 22px 0 0;
        border-bottom: 0;
        padding: var(--s4) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
    }
    .amount { grid-template-columns: 52px 1fr 52px; }

    .modal { align-items: flex-end; padding: 0; }
    .sheet, .sheet-wide {
        width: 100%;
        max-height: 92dvh;
        border-radius: 22px 22px 0 0;
        border-bottom: 0;
        padding-bottom: env(safe-area-inset-bottom);
        animation: sheet-up .25s ease-out;
    }
    .sheet-grip { display: block; }
    .sheet-head { padding: var(--s3) var(--s4); }
    .sheet-body { padding: var(--s4); gap: var(--s5); }

    .toasts { left: var(--s3); right: var(--s3); align-items: stretch; }
    .toast { max-width: none; min-width: 0; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Páginas de texto (termos, privacidade) ---------- */
body.doc-page { overflow: auto; height: auto; min-height: 100%; }
.doc-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--edge); background: var(--topbar); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.doc { max-width: 680px; margin: 0 auto; padding: var(--s5) var(--edge) var(--s6); font-size: 1.125rem; line-height: 1.6; }
.doc h1 { font-family: var(--font-display); font-size: var(--fs-28); margin: var(--s4) 0 var(--s1); }
.doc h2 { font-size: var(--fs-20); margin: var(--s5) 0 var(--s2); }
.doc p, .doc ul { margin: 0 0 var(--s3); color: var(--muted); }
.doc strong { color: var(--text); }
.doc ul { padding-left: 20px; display: flex; flex-direction: column; gap: var(--s2); }
.doc-date { font-size: var(--fs-14); color: var(--faint) !important; }
