/* Star Quest Party - Mobile-first stylesheet */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: #f0f0f5;
    line-height: 1.4;
    background: #1a1a2e;
    min-height: 100vh;
    overscroll-behavior: contain;
}

a { color: #ffd166; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Backgrounds */
.auth-bg { background: #1a1a2e; }
.dashboard-bg { background: #1a1a2e; }

/* Layout */
.container { max-width: 720px; margin: 0 auto; padding: 1rem; padding-bottom: 4rem; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem; background: rgba(0,0,0,0.3); position: sticky; top: 0; z-index: 10;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { font-weight: 700; font-size: 1.1rem; }

/* Auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card {
    background: rgba(255,255,255,0.05); padding: 2rem 1.5rem; border-radius: 16px;
    width: 100%; max-width: 400px; backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}
.logo { text-align: center; margin-bottom: 1.5rem; }
.logo-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.logo h1 { font-size: 1.5rem; }
.tagline { color: #aaa; font-size: 0.9rem; margin-top: 0.25rem; }

/* Forms */
form label { display: block; font-size: 0.85rem; margin-top: 1rem; margin-bottom: 0.35rem; color: #ccc; }
form input, form select {
    width: 100%; padding: 0.75rem 1rem; font-size: 1rem;
    background: rgba(0,0,0,0.3); color: #fff; border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px; outline: none;
}
form input:focus, form select:focus { border-color: #ffd166; }

/* Buttons */
.btn {
    display: inline-block; padding: 0.7rem 1.2rem; border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
    transition: transform 0.1s, opacity 0.2s; min-height: 44px; line-height: 1.2;
    font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #ffd166, #f4a52a); color: #1a1a2e; }
.btn.secondary { background: linear-gradient(135deg, #4a90c2, #2563eb); color: #fff; }
.btn.danger { background: #e63946; color: #fff; }
.btn.ghost { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.btn.big { display: block; width: 100%; padding: 1rem; font-size: 1.1rem; margin-top: 1.25rem; }
.btn.small { padding: 0.4rem 0.8rem; font-size: 0.85rem; min-height: 36px; }

/* Alerts */
.alert { padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.95rem; }
.alert.error { background: rgba(230,57,70,0.2); border: 1px solid #e63946; color: #ffb3b8; }
.alert.success { background: rgba(58,200,100,0.2); border: 1px solid #3ac864; color: #b3ffc8; }

/* Cards */
.card {
    background: rgba(255,255,255,0.04); padding: 1.25rem;
    border-radius: 14px; margin-bottom: 1rem; border: 1px solid rgba(255,255,255,0.08);
}
.card h2 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.muted { color: #999; }
.small { font-size: 0.85rem; }
.center { text-align: center; margin-top: 1rem; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; background: rgba(255,209,102,0.2); color: #ffd166; border-radius: 999px; font-size: 0.75rem; font-weight: 600; margin-left: 0.5rem; }

/* Hero */
.hero-card {
    display: flex; align-items: center; gap: 1rem; padding: 1.25rem;
    border-radius: 14px; margin-bottom: 1rem; color: #fff;
    position: relative; overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,0.55);
}
/* Dark overlay so white + muted text always reads cleanly, regardless
   of the character's signature color (e.g. light pinks like Daisy). */
.hero-card::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.15), rgba(0,0,0,0.55));
    border-radius: inherit; pointer-events: none; z-index: 0;
}
.hero-card > * { position: relative; z-index: 1; }
.hero-card .muted { color: rgba(255,255,255,0.85); }
.hero-emoji { font-size: 3rem; line-height: 1; }
.hero-card h1 { font-size: 1.3rem; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.stat-card {
    background: rgba(255,255,255,0.04); padding: 1rem; border-radius: 12px; text-align: center;
    border: 1px solid rgba(255,255,255,0.08);
}
.stat-num { font-size: 1.6rem; font-weight: 700; color: #ffd166; }
.stat-label { font-size: 0.8rem; color: #aaa; margin-top: 0.25rem; }

/* Action grid */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.action-btn {
    display: block; background: rgba(255,255,255,0.06); padding: 1.25rem 0.75rem;
    border-radius: 12px; text-align: center; color: #fff; text-decoration: none;
    border: 1px solid rgba(255,255,255,0.1); transition: transform 0.1s;
}
.action-btn:active { transform: scale(0.97); }
.action-btn:hover { text-decoration: none; background: rgba(255,255,255,0.1); }
.action-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.action-title { font-weight: 600; font-size: 0.95rem; }
.action-sub { font-size: 0.75rem; color: #aaa; margin-top: 0.25rem; }

/* Character grid */
.char-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin-top: 0.75rem; }
.char-tile {
    background: rgba(255,255,255,0.05); padding: 0.75rem; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1); cursor: pointer;
    text-align: center; color: #fff; font-family: inherit;
}
.char-tile.selected { border-color: var(--char-color); background: rgba(255,255,255,0.12); }
.char-emoji { font-size: 2rem; line-height: 1; }
.char-name { font-weight: 600; margin-top: 0.25rem; font-size: 0.95rem; }
.char-tag { font-size: 0.72rem; color: #aaa; margin-top: 0.15rem; }

/* Map grid */
.map-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.map-tile-radio { display: block; cursor: pointer; }
.map-tile-radio input { display: none; }
.map-tile-radio input:checked + .map-tile { box-shadow: 0 0 0 3px #ffd166; transform: scale(1.02); }
.map-tile {
    padding: 1rem; border-radius: 12px; color: #fff; transition: transform 0.15s;
    position: relative; overflow: hidden;
}
.map-feature { position: absolute; right: 0.75rem; top: 0.5rem; font-size: 2.5rem; opacity: 0.5; }
.map-name { font-weight: 700; font-size: 1.05rem; }
.map-diff { font-size: 0.75rem; opacity: 0.7; margin-top: 0.15rem; }
.map-desc { font-size: 0.85rem; margin-top: 0.5rem; opacity: 0.9; }

/* Lobby */
.game-code-box { background: rgba(255,209,102,0.1); padding: 1rem; border-radius: 12px; text-align: center; margin: 0.75rem 0; }
.game-code-label { font-size: 0.75rem; color: #ccc; }
.game-code { font-size: 2rem; font-weight: 800; color: #ffd166; letter-spacing: 0.4rem; margin-top: 0.25rem; }
.player-row {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem;
    background: rgba(255,255,255,0.04); border-radius: 10px; margin-bottom: 0.5rem;
}
.player-emoji { font-size: 2rem; }
.player-info { flex: 1; }
.action-row { margin-top: 1rem; display: flex; gap: 0.5rem; flex-direction: column; }
.game-row {
    display: flex; align-items: center; justify-content: space-between; padding: 0.75rem;
    background: rgba(255,255,255,0.04); border-radius: 10px; margin-bottom: 0.5rem;
}

/* Game screen */
body.game-body { background: #0a0a18; overflow: hidden; height: 100vh; }
.game-shell { display: flex; flex-direction: column; height: 100vh; }
.game-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0.75rem; background: rgba(0,0,0,0.5); flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.game-topbar .turn-info { font-size: 0.85rem; color: #ccc; }
.game-topbar .turn-info strong { color: #ffd166; font-size: 1.1rem; }

.board-area {
    flex: 1; position: relative; overflow: hidden; touch-action: none;
    background: var(--map-bg, #0a0a18);
}
.board-svg { width: 100%; height: 100%; display: block; cursor: grab; }
.board-svg:active { cursor: grabbing; }

/* Player stats */
.players-strip {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    background: rgba(0,0,0,0.5); padding: 4px; flex-shrink: 0;
}
.player-card {
    background: rgba(255,255,255,0.04); padding: 0.4rem 0.3rem; border-radius: 8px;
    border-top: 3px solid var(--p-color, #888); text-align: center; font-size: 0.75rem;
    transition: background 0.2s; position: relative;
}
.player-card .kick-ai-btn {
    position: absolute; top: 2px; right: 2px;
    background: rgba(0,0,0,0.5); border: 1px solid #555; color: #fff;
    width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
    font-size: 0.7rem; padding: 0; line-height: 1; opacity: 0.55;
    transition: opacity 0.15s;
}
.player-card .kick-ai-btn:hover, .player-card .kick-ai-btn:focus { opacity: 1; }
.player-card.current { background: rgba(255,209,102,0.2); animation: pulse 1.5s infinite; }
.player-card.is-me { box-shadow: inset 0 0 0 1px #ffd166; }
.player-card .pc-emoji { font-size: 1.3rem; line-height: 1; }
.player-card .pc-name { font-weight: 600; font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-card .pc-stats { display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.15rem; font-weight: 600; }
.player-card .pc-stars { color: #ffd166; }
.player-card .pc-coins { color: #ffd700; }
.player-card .pc-items { font-size: 0.65rem; color: #aaa; }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,209,102,0.5); }
    50% { box-shadow: 0 0 0 4px rgba(255,209,102,0); }
}

/* Action bar */
.action-bar {
    background: rgba(0,0,0,0.7); padding: 0.5rem; flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.1); display: flex; gap: 0.5rem; align-items: center;
}
.action-bar .turn-status { flex: 1; font-size: 0.85rem; padding: 0 0.5rem; }
.dice-btn {
    background: linear-gradient(135deg, #ffd166, #f4a52a); color: #1a1a2e;
    border: none; padding: 0.75rem 1.25rem; border-radius: 12px; font-size: 1rem;
    font-weight: 700; cursor: pointer; min-width: 110px; min-height: 50px;
}
.dice-btn:disabled { opacity: 0.4; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
    background: #1f1f3d; padding: 1.5rem; border-radius: 16px; max-width: 400px;
    width: 100%; max-height: 90vh; overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.1);
}
.modal h3 { font-size: 1.2rem; margin-bottom: 0.75rem; color: #ffd166; }
.modal p { margin-bottom: 1rem; color: #ddd; }
.modal .btn-grid { display: grid; gap: 0.5rem; }

/* Dice */
.dice-display {
    width: 80px; height: 80px; background: #fff; color: #1a1a2e;
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; font-weight: 800; margin: 1rem auto;
    box-shadow: 0 8px 0 rgba(0,0,0,0.3);
}
.dice-display.rolling { animation: shake 0.5s; }
@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-8px) rotate(-15deg); }
    75% { transform: translateX(8px) rotate(15deg); }
}

/* Game log */
/* Events ticker — replaces the old slide-out log panel.
   A horizontal strip of recent notable events sitting just under the topbar. */
.events-ticker {
    display: flex; align-items: stretch; gap: 0.4rem;
    padding: 0.4rem 0.6rem; min-height: 2.5rem;
    background: rgba(0,0,0,0.45);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.events-ticker::-webkit-scrollbar { height: 4px; }
.events-ticker::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.ticker-empty { color: #888; font-size: 0.78rem; padding: 0.25rem 0.5rem; }
.ticker-chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.3rem 0.7rem; border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border-left: 3px solid #ffd166;
    font-size: 0.78rem; line-height: 1.3;
    white-space: nowrap;
    flex-shrink: 0; max-width: 360px;
    overflow: hidden; text-overflow: ellipsis;
}
.ticker-chip.ticker-good    { border-left-color: #4caf50; background: rgba(20,40,28,0.55); }
.ticker-chip.ticker-bad     { border-left-color: #f44336; background: rgba(50,20,20,0.55); }
.ticker-chip.ticker-ominous { border-left-color: #b153d8; background: rgba(40,15,55,0.55); }
.ticker-chip.ticker-newest {
    animation: ticker-flash 0.6s ease-out;
}
.ticker-icon { font-size: 1rem; flex-shrink: 0; }
.ticker-msg { overflow: hidden; text-overflow: ellipsis; }
@keyframes ticker-flash {
    0%   { transform: translateX(40px); opacity: 0; }
    50%  { background: rgba(255,209,102,0.45); }
    100% { transform: translateX(0); opacity: 1; }
}

/* Item tile in modal */
.item-tile {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem;
    background: rgba(255,255,255,0.05); border-radius: 10px; margin-bottom: 0.5rem;
    border: 1px solid rgba(255,255,255,0.08);
}
.item-tile .item-emoji { font-size: 1.8rem; }
.item-tile .item-info { flex: 1; }
.item-tile .item-name { font-weight: 600; }
.item-tile .item-desc { font-size: 0.78rem; color: #aaa; }
.item-tile .item-price { color: #ffd166; font-weight: 600; }

/* Player picker */
.player-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.player-pick-btn {
    background: rgba(255,255,255,0.06); padding: 0.6rem; border-radius: 10px;
    border: 2px solid transparent; cursor: pointer; color: #fff; font-family: inherit;
    text-align: center;
}
.player-pick-btn:hover { background: rgba(255,255,255,0.12); }
.player-pick-btn .pp-emoji { font-size: 1.5rem; }
.player-pick-btn .pp-name { font-size: 0.8rem; font-weight: 600; }
.player-pick-btn .pp-stats { font-size: 0.7rem; color: #aaa; }

/* Bonus star animation */
.bonus-banner {
    background: linear-gradient(135deg, #ffd700, #ff6b6b);
    padding: 1rem; border-radius: 12px; text-align: center; margin-bottom: 1rem;
    color: #1a1a2e; font-weight: 700;
}

/* End screen */
.end-screen { text-align: center; padding: 2rem 1rem; }
.end-screen h1 { font-size: 2rem; color: #ffd166; }
.end-trophy { font-size: 5rem; margin: 1rem 0; }
.standings { margin-top: 1.5rem; }
.standing-row {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.05); border-radius: 10px; margin-bottom: 0.5rem;
    text-align: left;
}
.standing-rank { font-size: 1.3rem; font-weight: 700; min-width: 30px; }

/* Tablet+ */
@media (min-width: 600px) {
    .char-grid { grid-template-columns: repeat(4, 1fr); }
    .map-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .action-row { flex-direction: row; }
}

/* ========== v3 additions: events, cursed items, press-luck, roll-order, map quirks ========== */

/* Map quirk preview on the dashboard map tiles */
.map-quirk {
    margin-top: 0.5rem; padding: 0.4rem 0.6rem;
    background: rgba(255,255,255,0.08); border-radius: 6px;
    font-size: 0.7rem; line-height: 1.3;
}

/* Topbar right-side cluster (cancel + log buttons) */
.topbar-right { display: flex; gap: 0.4rem; align-items: center; }

/* Event banner — sits above the board when a board-wide event is active */
.event-banner {
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.75rem; background: linear-gradient(90deg, #ff6347, #ffd166);
    color: #1a1a2e; font-weight: 600; font-size: 0.8rem;
    border-bottom: 1px solid rgba(0,0,0,0.2);
}
.event-banner .event-turns-left {
    background: rgba(0,0,0,0.2); padding: 0.15rem 0.5rem; border-radius: 10px;
    font-size: 0.7rem; white-space: nowrap;
}

/* Cursed item panel inside the store */
.cursed-panel {
    margin: 0.75rem 0; padding: 0.5rem; border: 2px dashed #b94a4a;
    border-radius: 10px; background: rgba(80,10,10,0.25);
}
.cursed-banner {
    text-align: center; font-size: 0.75rem; font-weight: 700;
    letter-spacing: 0.05em; color: #ff8b8b; margin-bottom: 0.4rem;
}
.item-tile.cursed { background: rgba(140,40,40,0.2); }
.btn.danger {
    background: #b94a4a; color: #fff; border: 1px solid #d36e6e;
}
.btn.danger:hover { background: #d36e6e; }

/* Press-your-luck modal */
.press-luck-info {
    list-style: none; padding: 0; margin: 0.75rem 0;
    background: rgba(255,255,255,0.05); border-radius: 8px; padding: 0.75rem 1rem;
}
.press-luck-info li {
    padding: 0.25rem 0; font-size: 0.85rem;
}

/* Cursed-target / general player picker tiles */
.player-picker {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.75rem 0;
}
.player-pick-tile {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15);
    border-top: 3px solid var(--p-color, #888); border-radius: 10px;
    padding: 0.6rem 0.4rem; cursor: pointer; color: #fff; text-align: center;
    transition: background 0.15s, transform 0.1s;
}
.player-pick-tile:hover { background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.player-pick-tile .pick-emoji { font-size: 1.6rem; line-height: 1; }
.player-pick-tile .pick-name { font-weight: 600; font-size: 0.85rem; margin-top: 0.2rem; }
.player-pick-tile .pick-stats { font-size: 0.75rem; color: #ccc; margin-top: 0.15rem; }

/* Roll-for-turn-order rows */
.order-row {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem;
    background: rgba(255,255,255,0.04); border-radius: 8px; margin-bottom: 0.4rem;
    border-left: 4px solid var(--p-color, #888);
}
.order-row .order-emoji { font-size: 1.3rem; }
.order-row .order-name { flex: 1; font-weight: 600; }
.order-row .order-roll {
    font-size: 1.1rem; font-weight: 700; color: #ffd166;
    background: rgba(0,0,0,0.3); padding: 0.15rem 0.6rem; border-radius: 6px;
    min-width: 2.2rem; text-align: center;
}

/* Toast notifications for API errors */
.toast-host {
    position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);
    z-index: 1000; display: flex; flex-direction: column; gap: 0.5rem;
    pointer-events: none; max-width: 90vw;
}
.toast {
    background: #b94a4a; color: #fff; padding: 0.75rem 1rem;
    border-radius: 10px; font-size: 0.85rem; line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    pointer-events: auto; max-width: 460px;
    animation: toast-in 0.25s ease-out;
}
.toast.fade { opacity: 0; transition: opacity 0.4s; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Board panning — no text selection during drag, friendly cursor */
.board-area, .board-svg {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}
.board-svg { cursor: grab; }
.board-svg:active { cursor: grabbing; }

/* Chance space slot machine */
.chance-blocks {
    display: flex; flex-direction: column; gap: 0.6rem;
    margin: 0.75rem 0;
}
@media (min-width: 600px) {
    .chance-blocks { flex-direction: row; justify-content: center; }
}
.chance-block {
    flex: 1; min-width: 0; padding: 0.85rem 0.6rem;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 12px; text-align: center;
    transition: background 0.2s, border-color 0.2s;
    opacity: 0.5;
}
.chance-block.spinning {
    opacity: 1; cursor: pointer;
    background: rgba(255,209,102,0.08);
    border-color: rgba(255,209,102,0.5);
}
.chance-block.active {
    /* Box-shadow pulse only — no scale transform, so the block doesn't
       grow/shrink and push the whole modal around. */
    animation: chance-pulse 1s ease-in-out infinite;
}
.chance-block.stopped {
    opacity: 1; background: rgba(102,255,153,0.1);
    border-color: rgba(102,255,153,0.5);
    animation: none;
}
.chance-block .block-label {
    font-size: 0.7rem; color: #aaa; text-transform: uppercase;
    letter-spacing: 0.05em; margin-bottom: 0.4rem; font-weight: 600;
}
.chance-block .block-content {
    min-height: 3.4rem; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 0.15rem;
}
.chance-block .bcontent-emoji { font-size: 1.7rem; line-height: 1; }
.chance-block .bcontent-name { font-size: 0.78rem; font-weight: 600; }
.chance-block .bcontent-big { font-size: 1.05rem; font-weight: 700; }
.chance-block .bcontent-arrow { font-size: 1.2rem; color: #ffd166; font-weight: 700; }
.chance-block .block-hint {
    font-size: 0.65rem; color: #ffd166; margin-top: 0.4rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    min-height: 1em;
}
/* Reserve enough vertical space for the summary + Continue button so the
   modal doesn't grow when the result appears. */
.chance-result {
    min-height: 6rem; text-align: center;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 0.6rem;
}
.chance-summary {
    background: rgba(255,209,102,0.15); padding: 0.6rem 0.85rem;
    border-radius: 8px; font-weight: 600;
    animation: chance-pop 0.3s ease-out;
}
@keyframes chance-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,209,102,0.55); }
    50%      { box-shadow: 0 0 0 8px rgba(255,209,102,0); }
}
@keyframes chance-pop {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ===== v3-patch4: junction picker with directional arrows + path preview ===== */
.junction-options {
    display: flex; flex-direction: column; gap: 0.75rem; margin: 0.75rem 0;
}
@media (min-width: 600px) {
    .junction-options { flex-direction: row; align-items: stretch; }
}
.junction-option {
    flex: 1; padding: 1rem 0.85rem;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.18);
    border-radius: 14px; color: #fff; cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    font-family: inherit;
}
.junction-option:hover {
    background: rgba(255,209,102,0.12);
    border-color: #ffd166;
    transform: translateY(-2px);
}
.junction-option:active { transform: translateY(0); }

/* Wrapper holds the pulse animation; inner element holds the rotation. */
.junction-arrow-wrap {
    display: inline-block; line-height: 1; margin-bottom: 0.45rem;
    animation: junction-arrow-flash 0.85s ease-in-out infinite;
}
.junction-arrow {
    display: inline-block; font-size: 3rem; color: #ffd166; line-height: 1;
    text-shadow: 0 0 14px rgba(255,209,102,0.85), 0 0 6px rgba(255,209,102,0.6);
}
@keyframes junction-arrow-flash {
    0%, 100% { opacity: 0.55; transform: scale(1.0); }
    50%      { opacity: 1; transform: scale(1.15); }
}

.junction-direction {
    font-size: 0.85rem; color: #ffd166; font-weight: 700;
    margin-bottom: 0.5rem; letter-spacing: 0.02em;
}

.junction-path {
    display: flex; align-items: center; justify-content: center;
    gap: 0.18rem; flex-wrap: wrap; margin: 0.5rem 0 0.6rem;
}
.path-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.7rem; height: 1.7rem; padding: 0 0.32rem;
    border-radius: 50%; color: #fff; font-weight: 700; font-size: 0.78rem;
    border: 2px solid rgba(255,255,255,0.35);
    position: relative;
}
.path-pill.landing {
    border-color: #ffd166; border-width: 3px;
    box-shadow: 0 0 0 3px rgba(255,209,102,0.25);
    transform: scale(1.18);
}
.path-pill.has-star { border-color: #ffd700; }
.path-pill .path-star {
    position: absolute; top: -8px; right: -8px;
    font-size: 0.85rem; line-height: 1;
}
.path-arrow { color: #888; font-size: 0.95rem; padding: 0 0.05rem; }
.path-more {
    color: #888; font-size: 0.7rem; font-style: italic;
    padding-left: 0.4rem; align-self: center;
}

.junction-cta {
    margin-top: 0.5rem; font-size: 0.8rem;
    color: rgba(255,255,255,0.75);
    border-top: 1px dashed rgba(255,255,255,0.15);
    padding-top: 0.5rem;
}

/* ===== v3-patch5: on-screen event notifications ===== */
/* Sits above modal-overlay (z-index 100) and below error toasts (1000)
   so notifications don't hide behind a chance/store modal. */
.event-notif-host {
    position: fixed;
    top: 4rem;
    left: 50%; transform: translateX(-50%);
    z-index: 950;
    display: flex; flex-direction: column;
    gap: 0.5rem; pointer-events: none;
    max-width: 92vw; width: 480px;
}
.event-notif {
    pointer-events: auto;
    background: rgba(26, 26, 46, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid #ffd166;
    border-left-width: 6px;
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    display: flex; align-items: center; gap: 0.7rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.55);
    animation: enotif-slide 0.3s ease-out;
    cursor: pointer;
    font-size: 0.92rem;
    line-height: 1.35;
    color: #fff;
    transition: opacity 0.4s, transform 0.4s;
}
.event-notif.event-good    { border-color: #4caf50; background: rgba(20,40,28,0.95); }
.event-notif.event-bad     { border-color: #f44336; background: rgba(50,20,20,0.95); }
.event-notif.event-ominous { border-color: #b153d8; background: rgba(40,15,55,0.95); }
.event-notif.event-neutral { border-color: #ffd166; }
.event-notif .enotif-icon  { font-size: 1.7rem; line-height: 1; flex-shrink: 0; }
.event-notif .enotif-msg   { flex: 1; word-break: break-word; }
.event-notif.enotif-fade {
    opacity: 0;
    transform: translateY(-10px);
}
@keyframes enotif-slide {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== v4.0 additions: junction arrows on the map, ghost step labels ===== */
.junction-board-arrow polygon {
    filter: drop-shadow(0 0 14px rgba(255, 209, 102, 0.95));
    animation: jba-pulse 0.7s ease-in-out infinite;
}
@keyframes jba-pulse {
    0%, 100% { opacity: 0.65; }
    50%      { opacity: 1; }
}

/* Ghost target picker — highlights the picked option clearly */
.player-pick-tile.picked {
    background: rgba(255,209,102,0.28);
    border-color: #ffd166;
    box-shadow: 0 0 0 3px rgba(255,209,102,0.35);
}
.ghost-step {
    font-size: 0.78rem; color: #ffd166; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin: 0.5rem 0 0.3rem;
}

/* Reduce duplicate vertical spacing on the game-shell now that the
   ticker eats some height. Also keep the action bar firmly at bottom. */
.events-ticker + .event-banner { border-top: none; }
