/* Ouroboros — serpent-ring board game theme */

:root {
    --void: #F7F8FA;
    --void-2: #FFFFFF;
    --scale: #EFF6FF;
    --scale-2: #DBEAFE;
    --gold: #3B82F6;
    --gold-bright: #2563EB;
    --ivory: #111827;
    --ivory-dim: #6B7280;
    --danger: #EF4444;
    --ob-shadow: 0 8px 24px rgba(17, 24, 39, .08);
}

.ob-main {
    background:
        radial-gradient(circle at 20% -10%, rgba(59, 130, 246, .08), transparent 50%),
        radial-gradient(circle at 80% -10%, rgba(250, 204, 21, .07), transparent 50%),
        var(--void);
    color: var(--ivory);
    font-family: 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ob-app {
    width: 100%;
    max-width: 900px;
}

#app h1, #app h2, #app h3, #app .display {
    font-family: 'Cinzel', serif;
    letter-spacing: .02em;
}

.card {
    background: linear-gradient(180deg, var(--void-2), var(--void));
    border: 1px solid rgba(59, 130, 246, .18);
    border-radius: 14px;
    padding: 28px;
    box-shadow: var(--ob-shadow);
}

.eyebrow {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .18em;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 6px;
}

h1.display {
    font-size: 34px;
    margin: 0 0 4px;
    color: var(--ivory);
    font-weight: 700;
}

.sub {
    color: var(--ivory-dim);
    margin: 0 0 22px;
    font-size: 14px;
}

.howto {
    margin-top: 6px;
    padding: 14px 16px;
    background: var(--void-2);
    border: 1px solid rgba(59, 130, 246, .16);
    border-radius: 12px;
    text-align: left;
}

.howto-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 10px;
}

.howto-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.howto-step {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    color: var(--ivory-dim);
    line-height: 1.5;
}

.howto-step .num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(59, 130, 246, .1);
    border: 1px solid rgba(59, 130, 246, .35);
    color: var(--gold-bright);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.board-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.board-head-row h2.display {
    margin: 0;
}

.direction-pill {
    white-space: nowrap;
}

#app button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    background: transparent;
    color: var(--ivory);
    border: 1px solid rgba(17, 24, 39, .18);
    border-radius: 10px;
    padding: 12px 18px;
    cursor: pointer;
    transition: all .15s ease;
}

#app button:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold-bright);
}

#app button:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

#app button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

#app button.primary {
    background: var(--gold);
    color: #FFFFFF;
    border: none;
}

#app button.primary:hover:not(:disabled) {
    background: var(--gold-bright);
    color: #FFFFFF;
}

#app button.danger {
    border-color: rgba(239, 68, 68, .4);
    color: var(--danger);
}

#app input, #app select {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--void);
    color: var(--ivory);
    border: 1px solid rgba(17, 24, 39, .15);
    border-radius: 8px;
    padding: 10px 12px;
    width: 100%;
}

#app input:focus, #app select:focus {
    outline: 2px solid var(--gold);
    border-color: var(--gold);
}

#app label {
    font-size: 12px;
    color: var(--ivory-dim);
    display: block;
    margin: 14px 0 6px;
}

.player-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.player-row .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.die-used {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--gold-bright);
    background: rgba(59, 130, 246, .06);
    border: 1px solid rgba(59, 130, 246, .25);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.die-used.dim {
    color: var(--ivory-dim);
    font-weight: 400;
    font-style: italic;
    background: transparent;
    border-color: rgba(17, 24, 39, .1);
}

.grid-wrap {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 20px;
    overflow-x: auto;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, .06), transparent 60%),
        var(--void-2);
    border: 1px solid rgba(59, 130, 246, .14);
    border-radius: 16px;
}

#board {
    position: relative;
    background: radial-gradient(circle at 50% 50%, rgba(59, 130, 246, .05), transparent 62%), var(--void);
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, .18);
    box-shadow: inset 0 0 24px rgba(17, 24, 39, .06);
    flex-shrink: 0;
}

/* faint coiled ring in the dead center, echoing the ouroboros motif */
#board::after {
    content: '';
    position: absolute;
    inset: 16%;
    border-radius: 50%;
    border: 1px dashed rgba(59, 130, 246, .16);
    pointer-events: none;
}

.eat-callout {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 20;
    padding: 12px;
}

.eat-callout-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid rgba(239, 68, 68, .4);
    border-radius: 12px;
    padding: 14px 20px;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 0 24px rgba(239, 68, 68, .25), 0 8px 24px rgba(17, 24, 39, .18);
    animation: eatPop .3s cubic-bezier(.3, 0, .2, 1);
}

.eat-callout-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.eat-callout-line {
    font-size: 13px;
    color: #DC2626;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    letter-spacing: .01em;
}

.eat-callout-line + .eat-callout-line {
    margin-top: 4px;
}

@keyframes eatPop {
    0% { transform: scale(.5); opacity: 0; }
    60% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.tile {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    border-radius: 6px;
    background: linear-gradient(150deg, var(--scale) 0%, var(--scale-2) 100%);
    border: 1px solid rgba(59, 130, 246, .12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 2px 5px rgba(17, 24, 39, .1);
}

.tile-glyph {
    filter: drop-shadow(0 1px 1px rgba(17, 24, 39, .25));
}

.tile.special {
    border-color: var(--tile-accent, var(--gold));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 0 10px var(--tile-glow, rgba(59, 130, 246, .3)), 0 2px 5px rgba(17, 24, 39, .1);
}

.tile.kind-bonus { --tile-accent: #16A34A; --tile-glow: rgba(34, 197, 94, .35); }
.tile.kind-penalty { --tile-accent: #EF4444; --tile-glow: rgba(239, 68, 68, .35); }
.tile.kind-chaos { --tile-accent: #CA8A04; --tile-glow: rgba(250, 204, 21, .4); }

.tile.start {
    background: radial-gradient(circle at 50% 50%, rgba(37, 99, 235, .22), var(--scale) 72%);
    border-color: var(--gold-bright);
    box-shadow: 0 0 12px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255, 255, 255, .6);
    color: var(--gold-bright);
    font-weight: 700;
}

.legend {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--void-2);
    border: 1px solid rgba(59, 130, 246, .14);
    border-radius: 12px;
}

.legend-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 10px;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    border-left: 3px solid var(--legend-accent, var(--gold));
    background: rgba(59, 130, 246, .03);
}

.legend-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.legend-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ivory);
    line-height: 1.3;
}

.legend-desc {
    font-size: 10.5px;
    color: var(--ivory-dim);
    line-height: 1.3;
    margin-top: 1px;
}

.legend-item.kind-bonus { --legend-accent: #16A34A; }
.legend-item.kind-penalty { --legend-accent: #EF4444; }
.legend-item.kind-chaos { --legend-accent: #CA8A04; }
.legend-item.legend-start { --legend-accent: var(--gold-bright); }

.token {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #FFFFFF;
    text-shadow: 0 1px 2px rgba(17, 24, 39, .35);
    background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .5), transparent 58%), var(--token-color, var(--gold));
    border: 2px solid #FFFFFF;
    box-shadow: 0 3px 8px rgba(17, 24, 39, .3), 0 0 0 1px rgba(17, 24, 39, .1);
    transition: left .22s cubic-bezier(.3, 0, .2, 1), top .22s cubic-bezier(.3, 0, .2, 1), opacity .4s ease, transform .4s ease;
    z-index: 5;
}

.token.eaten,
.token-tail.eaten {
    opacity: 0;
    transform: scale(.2) rotate(25deg);
}

/* the snake's tail — a dimmer, smaller marker left behind at the tile a
   player stood on before their most recent move, until the next round
   catches it up to the head. Makes a catch legible: the tail is still
   visibly sitting where the hunter's head just arrived. */
.token-tail {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--token-color, var(--gold));
    opacity: .45;
    border: 1.5px solid #FFFFFF;
    box-shadow: 0 2px 5px rgba(17, 24, 39, .2);
    transition: left .22s ease, top .22s ease, opacity .3s ease, transform .3s ease;
    z-index: 4;
}

.die-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 96px;
    padding: 16px 12px 14px;
    position: relative;
    background: linear-gradient(180deg, rgba(59, 130, 246, .04), transparent);
    border-radius: 14px;
}

.die-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 14px;
    right: 14px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--die-accent, var(--gold)), transparent);
    opacity: .7;
}

.die-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .8), var(--void-2) 70%);
    border: 1px solid var(--die-accent, var(--gold));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 4px 12px rgba(17, 24, 39, .12);
    color: var(--die-accent, var(--gold-bright));
    transition: transform .2s ease, box-shadow .2s ease;
}

.die-btn:hover:not(:disabled) .die-icon {
    transform: translateY(-2px) scale(1.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5), 0 6px 16px rgba(17, 24, 39, .16), 0 0 16px var(--die-glow, rgba(37, 99, 235, .4));
}

.die-btn:disabled .die-icon {
    filter: grayscale(.7);
    opacity: .45;
    box-shadow: none;
}

.die-label {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    letter-spacing: .02em;
    color: var(--ivory);
}

.die-faces {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    letter-spacing: .03em;
    color: var(--ivory-dim);
    text-align: center;
    line-height: 1.4;
}

.die-btn small {
    color: var(--ivory-dim);
    font-weight: 400;
    font-size: 11px;
}

.die-d6 { --die-accent: #3B82F6; --die-glow: rgba(59, 130, 246, .45); }
.die-d4 { --die-accent: #16A34A; --die-glow: rgba(34, 197, 94, .4); }
.die-even { --die-accent: #CA8A04; --die-glow: rgba(250, 204, 21, .45); }
.die-odd { --die-accent: #EF4444; --die-glow: rgba(239, 68, 68, .4); }

.cooldown-badge {
    font-size: 10px;
    color: #fff;
    background: var(--danger);
    font-weight: 700;
    letter-spacing: .02em;
    padding: 2px 9px;
    border-radius: 999px;
    margin-top: 2px;
}

.log {
    max-height: 160px;
    overflow-y: auto;
    font-size: 13px;
    color: var(--ivory-dim);
    border-top: 1px solid rgba(17, 24, 39, .1);
    margin-top: 18px;
    padding-top: 12px;
}

.log div {
    margin-bottom: 4px;
}

.log .kill {
    color: #DC2626;
}

.log .bonus {
    color: var(--gold-bright);
}

.overlay-shield {
    position: fixed;
    inset: 0;
    background: var(--void);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    text-align: center;
    padding: 24px;
}

.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    border: 1px solid rgba(59, 130, 246, .35);
    color: var(--gold-bright);
}

.mode-card {
    flex: 1;
    min-width: 220px;
    text-align: left;
    cursor: pointer;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(17, 24, 39, .12);
    background: rgba(59, 130, 246, .02);
}

.mode-card:hover {
    border-color: var(--gold);
}

.mode-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.mode-card p {
    margin: 0;
    font-size: 13px;
    color: var(--ivory-dim);
}

#app code {
    background: rgba(17, 24, 39, .06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.room-code {
    font-family: 'Cinzel', serif;
    font-size: 32px;
    letter-spacing: .15em;
    color: var(--gold-bright);
}

.join-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin: 16px 0;
}

.qr-box {
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-box svg {
    width: 100%;
    height: 100%;
    display: block;
}

.link-box {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-box label {
    margin: 0;
}

.link-box input {
    font-size: 12px;
    cursor: text;
}

.waiting-list {
    font-size: 13px;
    color: var(--ivory-dim);
}

.waiting-list .picked {
    color: var(--gold-bright);
}

@media (max-width: 480px) {
    .ob-main {
        padding: 12px;
    }

    .card {
        padding: 20px;
    }
}
