/* ============================================================================
   Orion Skill Tree — game-console aesthetic
   ========================================================================== */

:root {
    --bg-0: #05030d;
    --bg-1: #100a24;
    --bg-2: #1a0f38;

    --panel: rgba(26, 16, 50, 0.78);
    --panel-2: rgba(38, 22, 70, 0.6);
    --edge: rgba(158, 122, 255, 0.22);
    --edge-strong: rgba(158, 122, 255, 0.55);

    --text: #f1ecff;
    --muted: #a99cd0;

    --violet: #a855f7;
    --violet-2: #6d28d9;
    --magenta: #ec4899;
    --teal: #2dd4bf;
    --teal-2: #0d9488;
    --cyan: #38bdf8;
    --amber: #fbbf24;
    --gold: #f59e0b;
    --danger: #fb7185;
    --lime: #a3e635;

    /* per-section accent, overridden on section panels */
    --accent: var(--violet);
    --accent-soft: rgba(168, 85, 247, 0.16);

    --shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    --radius: 16px;
    --hex: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Inter, system-ui, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1100px 560px at 12% -8%, rgba(168, 85, 247, 0.26), transparent 62%),
        radial-gradient(900px 520px at 88% 4%, rgba(45, 212, 191, 0.18), transparent 58%),
        radial-gradient(700px 500px at 50% 108%, rgba(236, 72, 153, 0.16), transparent 62%),
        linear-gradient(168deg, var(--bg-0) 0%, var(--bg-1) 52%, var(--bg-2) 100%);
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(158, 122, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(158, 122, 255, 0.045) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle at 50% 20%, #000 0%, transparent 78%);
}

a { color: var(--teal); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3 { margin: 0 0 6px; letter-spacing: 0.01em; display: flex; align-items: center; gap: 9px; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.08rem; }

.page-shell { position: relative; z-index: 1; max-width: 1620px; margin: 0 auto; padding: 14px 18px 34px; }
.content-shell { position: relative; z-index: 1; max-width: 1620px; margin: 0 auto; padding: 14px 18px 34px; }
.muted { color: var(--muted); }
.small { font-size: 0.83rem; }
.tiny { font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; }
.row { display: flex; gap: 9px; align-items: flex-end; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }

.accent-dot {
    width: 10px; height: 11px;
    clip-path: var(--hex);
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent);
    flex: 0 0 auto;
}

/* ------------------------------------------------------------------ panels */

.panel {
    position: relative;
    background: linear-gradient(165deg, var(--panel), rgba(14, 8, 28, 0.85));
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(7px);
    animation: fadeUp 0.28s ease-out both;
}

.panel::before {
    content: "";
    position: absolute; inset: 0 0 auto 0;
    height: 2px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.85;
}

.section-panel { margin-top: 12px; }
.narrow-panel { max-width: 620px; margin: 40px auto; }

.mood-check, .mood-room { --accent: var(--cyan); --accent-soft: rgba(56, 189, 248, 0.14); }
.last-level { --accent: var(--amber); --accent-soft: rgba(251, 191, 36, 0.14); }
.game-menu { --accent: var(--magenta); --accent-soft: rgba(236, 72, 153, 0.14); }
.lobby { --accent: var(--teal); --accent-soft: rgba(45, 212, 191, 0.14); }
.mods-panel { --accent: var(--teal); }
.results-panel { --accent: var(--amber); border-color: rgba(251, 191, 36, 0.4); }
.craft-panel { --accent: var(--violet); }
.buff-panel { --accent: var(--gold); }
.inspector { --accent: var(--violet); margin-top: 12px; }

/* ------------------------------------------------------------------ inputs */

input[type="text"], select, textarea {
    background: rgba(6, 4, 14, 0.72);
    border: 1px solid var(--edge);
    border-radius: 10px;
    padding: 9px 11px;
    width: 100%;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
input[type="text"]:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled, select:disabled { opacity: 0.45; cursor: not-allowed; }

label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; margin-bottom: 5px; }
label.field.inline { margin-bottom: 0; }

/* ----------------------------------------------------------------- buttons */

.btn {
    position: relative;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--edge);
    border-radius: 10px;
    padding: 9px 14px;
    font-weight: 650;
    font-size: 0.87rem;
    letter-spacing: 0.01em;
    transition: transform 0.1s ease, box-shadow 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--edge-strong); filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-primary { background: linear-gradient(160deg, var(--violet), var(--violet-2)); border-color: transparent; box-shadow: 0 6px 20px rgba(168, 85, 247, 0.35); }
.btn-teal { background: linear-gradient(160deg, var(--teal), var(--teal-2)); border-color: transparent; color: #032420; box-shadow: 0 6px 20px rgba(45, 212, 191, 0.32); }
.btn-gold { background: linear-gradient(160deg, var(--amber), var(--gold)); border-color: transparent; color: #2b1c00; box-shadow: 0 6px 20px rgba(251, 191, 36, 0.3); }
.btn-warn { background: rgba(251, 191, 36, 0.16); border-color: rgba(251, 191, 36, 0.45); color: #ffe6a8; }
.btn-danger { background: rgba(251, 113, 133, 0.16); border-color: rgba(251, 113, 133, 0.45); color: #ffd7de; }
.btn-mini { padding: 5px 9px; font-size: 0.76rem; border-radius: 8px; }
.btn-wide { width: 100%; margin-top: 18px; padding: 12px; font-size: 0.98rem; }

.feedback {
    margin: 10px 0;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.87rem;
    border: 1px solid transparent;
    animation: fadeUp 0.2s ease-out both;
}
.feedback-success { background: rgba(45, 212, 191, 0.13); border-color: rgba(45, 212, 191, 0.4); }
.feedback-error { background: rgba(251, 113, 133, 0.13); border-color: rgba(251, 113, 133, 0.42); }

.hidden-note {
    border: 1px dashed var(--edge);
    border-radius: 10px;
    padding: 12px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

/* --------------------------------------------------------------------- hud */

.hud {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 10px 15px;
    background: linear-gradient(165deg, rgba(30, 18, 58, 0.9), rgba(12, 7, 26, 0.9));
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: sticky; top: 8px; z-index: 40;
    backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 10px; padding-right: 14px; border-right: 1px solid var(--edge); }
.brand-mark {
    font-size: 1.5rem; line-height: 1;
    color: var(--violet);
    text-shadow: 0 0 18px rgba(168, 85, 247, 0.8);
    animation: breathe 4s ease-in-out infinite;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { letter-spacing: 0.14em; font-size: 0.98rem; }

.hud-where, .hud-who { display: flex; flex-direction: column; line-height: 1.15; }
.hud-who { text-align: right; }

.section-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.menu-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--edge);
    border-radius: 10px;
    padding: 7px 13px;
    font-size: 0.82rem; font-weight: 650;
    transition: transform 0.1s ease, background 0.16s ease, border-color 0.16s ease;
}
.menu-btn:hover { transform: translateY(-1px); }
.menu-btn .count { color: var(--amber); margin-left: 6px; }
.section-moodcheck.is-open { background: rgba(56, 189, 248, 0.2); border-color: var(--cyan); box-shadow: 0 0 16px rgba(56, 189, 248, 0.3); }
.section-lastlevel.is-open { background: rgba(251, 191, 36, 0.2); border-color: var(--amber); box-shadow: 0 0 16px rgba(251, 191, 36, 0.3); }
.section-skills.is-open { background: rgba(168, 85, 247, 0.24); border-color: var(--violet); box-shadow: 0 0 16px rgba(168, 85, 247, 0.35); }

.menu-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------- onboarding */

.gate { position: relative; max-width: 720px; margin: 6vh auto; }
.gate-glow {
    position: absolute; inset: -70px -40px;
    background: radial-gradient(circle at 50% 30%, rgba(168, 85, 247, 0.3), transparent 62%);
    filter: blur(24px);
    pointer-events: none;
    animation: breathe 6s ease-in-out infinite;
}
.gate-inner { position: relative; }
.gate-title {
    font-size: 2.1rem; font-weight: 850; letter-spacing: 0.14em;
    background: linear-gradient(100deg, var(--teal), var(--violet) 45%, var(--magenta));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-sub { color: var(--muted); margin: 4px 0 20px; }

.roster-picks { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 4px; }

.role-block { margin-top: 16px; }
.role-toggle { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 6px; }
.role-card {
    text-align: left;
    border: 1px solid var(--edge);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    border-radius: 14px;
    padding: 15px;
    display: flex; flex-direction: column; gap: 6px;
    transition: transform 0.12s ease, border-color 0.16s ease, box-shadow 0.2s ease;
}
.role-card span:not(.role-glyph) { color: var(--muted); font-size: 0.8rem; }
.role-glyph { font-size: 1.4rem; line-height: 1; }
.role-player .role-glyph { color: var(--teal); }
.role-admin .role-glyph { color: var(--amber); }
.role-card:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--edge-strong); }
.role-player.is-on { border-color: var(--teal); box-shadow: 0 0 24px rgba(45, 212, 191, 0.28) inset, 0 8px 22px rgba(0,0,0,0.35); }
.role-admin.is-on { border-color: var(--amber); box-shadow: 0 0 24px rgba(251, 191, 36, 0.28) inset, 0 8px 22px rgba(0,0,0,0.35); }
.role-card:disabled { opacity: 0.45; cursor: not-allowed; }

/* ------------------------------------------------------------------ lobby */

.lobby-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 9px; margin-top: 14px; }
.lobby-card {
    border: 1px solid var(--edge);
    border-left: 3px solid var(--teal);
    border-radius: 11px;
    padding: 11px 13px;
    background: linear-gradient(160deg, rgba(255,255,255,0.045), rgba(255,255,255,0.01));
    animation: fadeUp 0.26s ease-out both;
}
.lobby-card .name { font-weight: 700; }
.lobby-card.is-admin { border-left-color: var(--amber); box-shadow: 0 0 18px rgba(251, 191, 36, 0.16) inset; }
.lobby-card.is-me { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); }

/* -------------------------------------------------------------- game menu */

.menu-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-top: 18px; }
.menu-card {
    position: relative; overflow: hidden;
    text-align: left;
    border: 1px solid var(--edge);
    border-radius: 18px;
    padding: 20px;
    background: linear-gradient(165deg, rgba(52, 30, 92, 0.8), rgba(16, 9, 34, 0.92));
    display: flex; flex-direction: column; gap: 7px;
    min-height: 172px;
    transition: transform 0.14s ease, border-color 0.18s ease, box-shadow 0.22s ease;
}
.menu-card::after {
    content: ""; position: absolute; inset: auto -30% -60% -30%; height: 120px;
    background: radial-gradient(ellipse at 50% 0%, var(--accent), transparent 70%);
    opacity: 0.22; transition: opacity 0.2s ease;
}
.menu-moodcheck { --accent: var(--cyan); }
.menu-lastlevel { --accent: var(--amber); }
.menu-skills { --accent: var(--violet); }
.menu-card:hover:not(:disabled) { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 18px 40px rgba(0,0,0,0.5); }
.menu-card:hover:not(:disabled)::after { opacity: 0.4; }
.menu-card:disabled { opacity: 0.6; cursor: default; }
.menu-glyph { font-size: 2rem; line-height: 1; color: var(--accent); text-shadow: 0 0 20px var(--accent); }
.menu-card strong { font-size: 1.1rem; }
.menu-blurb { color: var(--muted); font-size: 0.83rem; flex: 1 1 auto; }
.menu-meta { color: var(--accent); font-size: 0.76rem; font-weight: 700; }

/* ------------------------------------------------------------- mood check */

.mood-picker { display: grid; grid-template-columns: 1fr 270px; gap: 16px; margin-top: 14px; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 9px; }
.effect-card {
    text-align: left;
    border: 1px solid var(--edge);
    background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    border-radius: 12px;
    padding: 10px 12px;
    transition: transform 0.12s ease, border-color 0.16s ease, box-shadow 0.2s ease;
}
.effect-card:hover { transform: translateY(-2px); border-color: var(--cyan); }
.effect-card.is-selected {
    border-color: var(--cyan);
    background: linear-gradient(160deg, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0.06));
    box-shadow: 0 0 22px rgba(56, 189, 248, 0.3);
}
.effect-card .glyph { font-size: 1.15rem; margin-right: 7px; color: var(--cyan); }
.effect-card .blurb { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 3px; }

.mood-side { border-left: 1px solid var(--edge); padding-left: 16px; }
.signal-picker { display: flex; gap: 6px; margin-top: 6px; }
.signal-step {
    width: 42px; height: 38px;
    border: 1px solid var(--edge);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    font-weight: 800;
    transition: transform 0.1s ease, background 0.16s ease;
}
.signal-step:hover { transform: translateY(-2px); }
.signal-step.on {
    background: linear-gradient(160deg, var(--cyan), #0284c7);
    border-color: transparent; color: #04202e;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
}

.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 9px; margin-top: 12px; }
.roster-card {
    border: 1px solid var(--edge);
    border-radius: 12px;
    padding: 10px 12px;
    background: linear-gradient(160deg, rgba(255,255,255,0.045), rgba(255,255,255,0.01));
    font-size: 0.85rem;
    animation: fadeUp 0.24s ease-out both;
}
.roster-card.is-waiting { opacity: 0.45; }
.roster-card .name { font-weight: 700; }
.mood-line { font-size: 1rem; margin: 3px 0 5px; color: var(--cyan); }

.signal-bars { display: inline-flex; gap: 3px; align-items: flex-end; height: 18px; }
.signal-bars .bar { width: 5px; background: rgba(255, 255, 255, 0.16); border-radius: 1px; }
.signal-bars .bar:nth-child(1) { height: 5px; }
.signal-bars .bar:nth-child(2) { height: 8px; }
.signal-bars .bar:nth-child(3) { height: 11px; }
.signal-bars .bar:nth-child(4) { height: 14px; }
.signal-bars .bar:nth-child(5) { height: 18px; }
.signal-bars .bar.on { background: var(--cyan); box-shadow: 0 0 8px rgba(56, 189, 248, 0.6); }

/* ------------------------------------------------------------- last level */

.prev-list { display: grid; gap: 10px; margin-top: 12px; }
.prev-item {
    border: 1px solid var(--edge);
    border-left: 3px solid var(--muted);
    border-radius: 12px;
    padding: 12px 14px;
    background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    animation: fadeUp 0.24s ease-out both;
}
.prev-head { display: flex; align-items: flex-start; gap: 12px; }
.prev-item.outcome-Done { border-left-color: var(--teal); }
.prev-item.outcome-NotDone { border-left-color: var(--danger); }
.prev-item.outcome-Zombie { border-left-color: var(--amber); }
.prev-note { margin-top: 7px; color: var(--muted); font-size: 0.84rem; font-style: italic; }
.prev-actions { margin-top: 10px; }
.prev-actions input { max-width: 260px; }

.outcome-pill {
    font-size: 0.68rem; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 800;
    padding: 3px 9px; border-radius: 999px;
    border: 1px solid var(--edge); white-space: nowrap;
}
.outcome-pill.outcome-Pending { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.outcome-pill.outcome-Done { background: rgba(45, 212, 191, 0.2); border-color: var(--teal); color: #b6fff5; }
.outcome-pill.outcome-NotDone { background: rgba(251, 113, 133, 0.18); border-color: var(--danger); color: #ffd7de; }
.outcome-pill.outcome-Zombie { background: rgba(251, 191, 36, 0.2); border-color: var(--amber); color: #ffe9b3; }

.add-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; }
.add-row select { min-width: 180px; }

/* --------------------------------------------------------------- step bar */

.step-bar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 12px; padding: 11px 15px;
    border: 1px solid var(--edge); border-radius: var(--radius);
    background: linear-gradient(165deg, rgba(30, 18, 58, 0.85), rgba(12, 7, 26, 0.85));
    box-shadow: var(--shadow);
}
.step-now { display: flex; flex-direction: column; line-height: 1.15; }
.step-track { display: flex; gap: 5px; flex-wrap: wrap; }
.step-dot {
    font-size: 0.72rem; padding: 5px 11px; border-radius: 999px;
    border: 1px solid var(--edge); color: var(--muted);
    transition: all 0.2s ease;
}
.step-dot.is-done { color: var(--text); background: rgba(45, 212, 191, 0.1); border-color: rgba(45, 212, 191, 0.3); }
.step-dot.is-current {
    color: #032420; font-weight: 800; border-color: transparent;
    background: linear-gradient(160deg, var(--teal), var(--teal-2));
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.45);
}

.meter { display: flex; flex-direction: column; gap: 4px; }
.pip-row, .slot-row { display: flex; gap: 5px; }
.pip {
    width: 15px; height: 16px;
    clip-path: var(--hex);
    background: rgba(255, 255, 255, 0.13);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.pip.is-live { background: var(--amber); box-shadow: 0 0 12px rgba(251, 191, 36, 0.75); animation: pipPop 0.3s ease-out; }
.slot { width: 30px; height: 8px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.slot.is-filled { background: var(--teal); box-shadow: 0 0 12px rgba(45, 212, 191, 0.6); }

/* ----------------------------------------------------------- modificators */

.mods-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 11px; margin-top: 12px; }
.mod-card {
    position: relative; overflow: hidden;
    border: 1px solid var(--teal);
    border-radius: 13px;
    padding: 13px;
    background: linear-gradient(165deg, rgba(13, 148, 136, 0.32), rgba(6, 40, 44, 0.8));
    display: flex; flex-direction: column; gap: 5px;
    min-height: 104px;
    box-shadow: 0 0 26px rgba(45, 212, 191, 0.22);
    animation: winnerPop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}
.mod-card::after {
    content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.14), transparent);
    animation: shimmer 3.4s ease-in-out infinite;
}
.mod-card.is-empty {
    border: 1px dashed var(--edge);
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
    align-items: center; justify-content: center;
    font-size: 0.8rem;
    box-shadow: none; animation: none;
}
.mod-card.is-empty::after { display: none; }
.mod-badge {
    align-self: flex-start;
    font-size: 0.6rem; letter-spacing: 0.13em; text-transform: uppercase; font-weight: 850;
    background: var(--teal); color: #032420;
    padding: 3px 8px; border-radius: 999px;
}
.mod-owner { color: #7ff3e4; font-size: 0.84rem; font-weight: 750; }

/* ---------------------------------------------------------------- results */

.results-list { display: grid; gap: 9px; margin-top: 11px; }
.result-row {
    display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-left: 3px solid var(--amber);
    border-radius: 11px; padding: 10px 13px;
    background: linear-gradient(160deg, rgba(251, 191, 36, 0.1), rgba(251, 191, 36, 0.02));
    animation: fadeUp 0.24s ease-out both;
}
.result-row.is-muted { border-color: var(--edge); border-left-color: var(--muted); background: rgba(255,255,255,0.03); }
.result-row select { max-width: 200px; }
.result-score {
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    clip-path: var(--hex);
    background: var(--amber); color: #2b1c00;
    font-weight: 850;
}
.result-row.is-muted .result-score { background: rgba(255,255,255,0.16); color: var(--text); }
.tie-break { margin-top: 14px; }
.tie-break summary { cursor: pointer; }

/* ------------------------------------------------------------------- tree */

.tree-canvas {
    position: relative; overflow: hidden;
    margin-top: 12px;
    padding: 22px 18px 26px;
    border: 1px solid var(--edge);
    border-radius: 20px;
    background:
        radial-gradient(760px 340px at 50% -6%, rgba(168, 85, 247, 0.22), transparent 70%),
        radial-gradient(500px 300px at 8% 100%, rgba(45, 212, 191, 0.12), transparent 68%),
        rgba(8, 4, 20, 0.6);
    box-shadow: inset 0 0 110px rgba(0, 0, 0, 0.6);
}
.tree-canvas::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(158, 122, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(158, 122, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

.core { position: relative; z-index: 1; text-align: center; margin-bottom: 4px; }
.core-hex {
    width: 148px; height: 86px; margin: 0 auto;
    clip-path: var(--hex);
    background: linear-gradient(160deg, var(--violet), var(--violet-2) 60%, #3b0764);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: 0 0 46px rgba(168, 85, 247, 0.6);
    animation: breathe 5s ease-in-out infinite;
}
.core-mark { font-weight: 850; letter-spacing: 0.16em; font-size: 1.02rem; }
.core-sub { font-size: 0.62rem; letter-spacing: 0.2em; opacity: 0.75; }
.core-stem { width: 2px; height: 24px; margin: 0 auto; background: linear-gradient(var(--violet), transparent); }

.nodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 26px 16px;
    position: relative; z-index: 1;
    align-items: start;
}
.node-column { display: flex; flex-direction: column; align-items: center; }

.hex {
    position: relative; z-index: 0; isolation: isolate;
    width: 152px; height: 166px;
    cursor: pointer;
    background: none; border: none; padding: 0;
    transition: transform 0.14s ease;
}
.hex:hover { transform: translateY(-3px) scale(1.02); }
.hex-face, .hex-outline, .hex-glow { pointer-events: none; }
.hex-outline {
    position: absolute; inset: 0; z-index: 0;
    clip-path: var(--hex);
    background: linear-gradient(160deg, var(--violet), var(--magenta));
    transform: scale(1.03);
    opacity: 0.85;
}
.hex-face {
    position: absolute; inset: 0; z-index: 1;
    clip-path: var(--hex);
    background: linear-gradient(165deg, rgba(58, 34, 104, 0.97), rgba(18, 10, 38, 0.98));
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; padding: 26px 16px; text-align: center;
}
.hex-glow {
    position: absolute; inset: -16px; z-index: 0;
    clip-path: var(--hex);
    background: radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.6), transparent 66%);
    filter: blur(7px);
    opacity: 0.35;
}
.hex-title { font-weight: 750; font-size: 0.9rem; line-height: 1.2; max-height: 3.6em; overflow: hidden; }
.hex-meta { font-size: 0.68rem; color: var(--muted); }
.hex-meta.accent { color: var(--amber); font-weight: 700; }
.hex.has-winner .hex-outline { background: linear-gradient(160deg, var(--amber), var(--gold)); }
.hex.has-winner .hex-glow { opacity: 0.7; background: radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.6), transparent 66%); }
.hex.is-selected .hex-outline { background: #fff; }
.hex.is-drop .hex-outline { background: var(--teal); }
.hex.is-drop .hex-glow { opacity: 1; background: radial-gradient(circle at 50% 50%, rgba(45, 212, 191, 0.7), transparent 66%); animation: dropPulse 0.9s ease-in-out infinite; }
.hex:focus-visible { outline: none; }
.hex:focus-visible .hex-outline { background: #fff; }

/* the branch: a chain descending from the hex's bottom point, one link per ticket */
.branch {
    position: relative;
    width: 100%;
    max-width: 268px;
    margin-top: 2px;
    display: flex; flex-direction: column;
    gap: 26px;
}

.ticket {
    position: relative;
    border: 1px solid var(--edge);
    border-radius: 11px;
    padding: 10px 12px;
    background: linear-gradient(160deg, rgba(40, 24, 74, 0.92), rgba(16, 9, 34, 0.92));
    font-size: 0.84rem;
    animation: ticketIn 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.22) both;
    transition: transform 0.12s ease, border-color 0.16s ease, box-shadow 0.2s ease, opacity 0.3s ease, filter 0.3s ease;
}

/* the link up to whatever sits above: the hex for the first, the previous ticket after */
.branch > .ticket::before {
    content: "";
    position: absolute;
    left: 50%; top: -26px;
    width: 2px; height: 26px;
    transform: translateX(-1px);
    background: linear-gradient(rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.9));
}

.ticket-node {
    position: absolute;
    left: 50%; top: -7px;
    transform: translateX(-50%);
    width: 13px; height: 14px;
    clip-path: var(--hex);
    background: var(--violet);
    box-shadow: 0 0 13px rgba(168, 85, 247, 0.95);
}

.ticket.is-draggable { cursor: grab; }
.ticket.is-draggable:hover { transform: translateY(-2px); border-color: var(--edge-strong); }
.ticket.is-draggable:active { cursor: grabbing; transform: scale(1.04) rotate(-1.4deg); box-shadow: 0 16px 32px rgba(0,0,0,0.55); }
.ticket.is-mine { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }

.ticket-text { line-height: 1.35; }
.ticket-foot { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.ticket-author { color: var(--muted); font-size: 0.72rem; }
.ticket-pips { display: inline-flex; gap: 3px; }
.vote-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 9px rgba(251, 191, 36, 0.85); animation: pipPop 0.3s ease-out; }
.ticket-score {
    min-width: 26px; height: 26px;
    display: inline-flex; align-items: center; justify-content: center;
    clip-path: var(--hex);
    background: var(--amber); color: #2b1c00;
    font-weight: 850; font-size: 0.8rem;
}
.ticket-owner { color: var(--teal); font-weight: 700; font-size: 0.76rem; }
.ticket-vote { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ticket-vote select { max-width: 160px; }

.ticket-badge {
    position: absolute; top: -9px; right: 9px;
    font-size: 0.56rem; letter-spacing: 0.12em; font-weight: 850;
    padding: 3px 8px; border-radius: 999px;
    background: var(--amber); color: #2b1c00;
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.7);
}

.ticket.is-winner {
    border-color: var(--amber);
    background: linear-gradient(160deg, rgba(251, 191, 36, 0.2), rgba(40, 24, 10, 0.9));
    animation: winnerPop 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.25) both,
               winnerGlow 2.8s ease-in-out 0.42s infinite;
}
.ticket.is-committed {
    border-color: var(--teal);
    background: linear-gradient(160deg, rgba(45, 212, 191, 0.22), rgba(6, 40, 44, 0.9));
    animation: winnerPop 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
    box-shadow: 0 0 26px rgba(45, 212, 191, 0.32);
}
.ticket.is-committed .ticket-badge { background: var(--teal); color: #032420; box-shadow: 0 0 14px rgba(45, 212, 191, 0.7); }

/* the losers: greyed out and no longer selectable, like a spent skill tree */
.ticket.is-rejected {
    opacity: 0.32;
    filter: grayscale(1);
    pointer-events: none;
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    animation: rejectFade 0.5s ease-out both;
}
.ticket.is-rejected .ticket-node,
.branch > .ticket.is-rejected::before { background: rgba(255, 255, 255, 0.18); box-shadow: none; }
.ticket.is-winner .ticket-node { background: var(--amber); box-shadow: 0 0 15px rgba(251, 191, 36, 0.95); }
.branch > .ticket.is-winner::before { background: linear-gradient(rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.9)); }
.ticket.is-committed .ticket-node { background: var(--teal); box-shadow: 0 0 15px rgba(45, 212, 191, 0.95); }
.branch > .ticket.is-committed::before { background: linear-gradient(rgba(45, 212, 191, 0.2), rgba(45, 212, 191, 0.9)); }
.ticket.is-loose::before, .ticket.is-loose .ticket-node { display: none; }

.ghost-slot {
    width: 152px; height: 166px;
    clip-path: var(--hex);
    border: none;
    background:
        repeating-linear-gradient(135deg, rgba(158, 122, 255, 0.12) 0 6px, transparent 6px 12px),
        rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 0.74rem;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 26px 16px; text-align: center;
    transition: color 0.16s ease, background 0.2s ease;
}
.ghost-plus { font-size: 1.7rem; line-height: 1; }
.ghost-slot:hover { color: var(--teal); background: rgba(45, 212, 191, 0.1); }
.ghost-slot.is-drop { color: var(--teal); background: rgba(45, 212, 191, 0.18); animation: dropPulse 0.9s ease-in-out infinite; }

/* ------------------------------------------------------- craft and buffs */

.craft-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-top: 12px; align-items: start; }
.craft-write { margin-top: 12px; }
.loose-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 9px; margin-top: 13px;
    border: 1px dashed var(--edge); border-radius: 13px; padding: 11px;
    min-height: 118px;
    transition: border-color 0.16s ease, background 0.2s ease;
}
.loose-cards.is-drop {
    border-color: var(--teal); border-style: solid;
    background: rgba(45, 212, 191, 0.09);
    animation: dropPulse 0.9s ease-in-out infinite;
}
.ticket.is-loose { align-self: start; }

.buff-list { display: grid; gap: 9px; margin-top: 13px; }
.buff {
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-left: 3px solid var(--amber);
    border-radius: 11px; padding: 10px 12px;
    background: linear-gradient(160deg, rgba(251, 191, 36, 0.11), rgba(251, 191, 36, 0.02));
    font-size: 0.85rem;
    animation: ticketIn 0.3s ease-out both;
}
.buff-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.buff-target { font-weight: 850; color: var(--amber); text-shadow: 0 0 12px rgba(251, 191, 36, 0.5); }
.buff .author { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 5px; }

/* ------------------------------------------------------------- animations */

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ticketIn {
    0% { opacity: 0; transform: translateX(-14px) scale(0.94); }
    60% { opacity: 1; transform: translateX(0) scale(1.03); }
    100% { opacity: 1; transform: none; }
}
@keyframes winnerPop {
    0% { transform: scale(0.9); }
    55% { transform: scale(1.06); }
    100% { transform: none; }
}
@keyframes winnerGlow {
    0%, 100% { box-shadow: 0 0 18px rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 34px rgba(251, 191, 36, 0.62); }
}
@keyframes rejectFade { from { opacity: 1; filter: grayscale(0); } to { opacity: 0.32; filter: grayscale(1); } }
@keyframes dropPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(45, 212, 191, 0.35); }
    50% { box-shadow: 0 0 28px rgba(45, 212, 191, 0.75); }
}
@keyframes pipPop { 0% { transform: scale(0.5); } 60% { transform: scale(1.25); } 100% { transform: none; } }
@keyframes breathe { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.22); } }
@keyframes shimmer { 0% { left: -60%; } 55%, 100% { left: 130%; } }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1200px) {
    .craft-grid { grid-template-columns: 1fr; }
    .mood-picker { grid-template-columns: 1fr; }
    .mood-side { border-left: none; padding-left: 0; border-top: 1px solid var(--edge); padding-top: 14px; }
}

@media (max-width: 760px) {
    .page-shell { padding: 10px; }
    .hud { position: static; }
    .role-toggle { grid-template-columns: 1fr; }
    .nodes-grid { grid-template-columns: 1fr; }
    .hud-who { text-align: left; }
}
