:root {
    --bg-a: #30136d;
    --bg-b: #6625c7;
    --bg-c: #ffdd57;
    --card: #ffffff;
    --card-soft: #f7f2ff;
    --ink: #1f1646;
    --muted: #6b6388;
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --secondary: #ffcf3f;
    --danger: #ef4444;
    --ok: #16a34a;
    --line: #e7dcff;
    --shadow: 0 20px 60px rgba(18, 9, 50, 0.22);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(255, 221, 87, 0.9), transparent 26rem),
        radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.42), transparent 28rem),
        linear-gradient(135deg, var(--bg-a), var(--bg-b));
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

input,
textarea,
select {
    width: 100%;
    border: 2px solid var(--line);
    border-radius: 16px;
    padding: 0.95rem 1rem;
    color: var(--ink);
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.13);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

a {
    color: inherit;
}

.home-body {
    display: grid;
    place-items: center;
    padding: 26px;
}

.home-shell {
    width: min(1100px, 100%);
}

.hero-card,
.panel {
    background: var(--card);
    border: 4px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.hero-card {
    padding: clamp(1.4rem, 4vw, 3rem);
    overflow: hidden;
    position: relative;
}

.hero-card::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -70px;
    top: -80px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.75), rgba(236, 72, 153, 0.28));
    z-index: 0;
}

.hero-card > * {
    position: relative;
    z-index: 1;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    background: var(--card-soft);
    color: var(--primary-dark);
    padding: 0.55rem 0.9rem;
    font-weight: 900;
    letter-spacing: 0.02em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.8rem;
    font-size: clamp(2.3rem, 7vw, 5.2rem);
    line-height: 0.92;
    letter-spacing: -0.06em;
}

h2 {
    margin-bottom: 1rem;
    font-size: 1.45rem;
}

.hero-copy {
    max-width: 720px;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.55;
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 2rem;
}

.panel {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.form-panel label,
.option-grid label,
.join-card label {
    display: block;
    margin: 0.8rem 0 0.4rem;
    color: var(--muted);
    font-weight: 800;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.tool-btn {
    border: 0;
    border-radius: 999px;
    padding: 0.95rem 1.25rem;
    font-weight: 950;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.primary-btn {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    box-shadow: 0 10px 24px rgba(124, 58, 237, 0.32);
}

.secondary-btn {
    color: #2d1b00;
    background: linear-gradient(135deg, var(--secondary), #ffeb86);
    box-shadow: 0 10px 24px rgba(250, 204, 21, 0.28);
}

.ghost-btn,
.tool-btn {
    color: var(--primary-dark);
    background: var(--card-soft);
    border: 2px solid var(--line);
}

.danger-btn {
    color: white;
    background: var(--danger);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.tool-btn:hover,
.danger-btn:hover {
    transform: translateY(-1px);
}

.form-panel button {
    margin-top: 1rem;
    width: 100%;
}

.tiny-note,
.help-text {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.error-message {
    margin: 1rem 0 0;
    border-radius: 16px;
    padding: 0.9rem 1rem;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 800;
}

.success-message {
    margin: 1rem 0 0;
    border-radius: 16px;
    padding: 0.9rem 1rem;
    background: #dcfce7;
    color: #166534;
    font-weight: 800;
}

.room-body {
    min-height: 100vh;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem clamp(0.8rem, 2.8vw, 1.5rem);
    background: rgba(35, 13, 86, 0.72);
    backdrop-filter: blur(14px);
    color: #fff;
}

.logo-link {
    text-decoration: none;
    font-weight: 1000;
    font-size: 1.2rem;
    letter-spacing: -0.04em;
}

.room-code-box {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
    padding: 0.45rem 0.75rem;
}

.room-code-box span {
    opacity: 0.75;
    font-size: 0.82rem;
}

.main-view {
    width: min(1220px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 2vw, 1.4rem);
    flex: 1;
}

.loading-card {
    display: grid;
    place-items: center;
    min-height: 300px;
    text-align: center;
}

.loader {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    border: 7px solid var(--line);
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.join-overlay {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(25, 9, 62, 0.65);
    backdrop-filter: blur(10px);
}

.join-card {
    width: min(500px, 100%);
}

.join-card button {
    width: 100%;
    margin-top: 1rem;
}

.lobby-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 18px;
    align-items: start;
}

.big-code {
    display: grid;
    place-items: center;
    min-height: 230px;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top left, rgba(255, 221, 87, 0.55), transparent 13rem),
        linear-gradient(135deg, #7c3aed, #c026d3);
    color: white;
    text-align: center;
    padding: 1.6rem;
}

.big-code span {
    text-transform: uppercase;
    letter-spacing: 0.24em;
    opacity: 0.8;
    font-weight: 900;
}

.big-code strong {
    display: block;
    font-size: clamp(3rem, 12vw, 7rem);
    letter-spacing: 0.08em;
    line-height: 1;
}

.player-list {
    display: grid;
    gap: 0.65rem;
    margin: 1rem 0 0;
}

.player-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 2px solid var(--line);
    border-radius: 18px;
    background: #fff;
}

.player-dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.player-name {
    font-weight: 900;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-tags {
    margin-left: auto;
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: var(--card-soft);
    color: var(--primary-dark);
    padding: 0.25rem 0.5rem;
    font-size: 0.76rem;
    font-weight: 900;
}

.offline {
    opacity: 0.45;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.option-grid .wide {
    grid-column: 1 / -1;
}

.toggle-line {
    display: flex !important;
    align-items: center;
    gap: 0.7rem;
    margin: 0 !important;
    padding: 0.85rem;
    border: 2px solid var(--line);
    border-radius: 16px;
    background: #fff;
    color: var(--ink) !important;
}

.toggle-line input {
    width: auto;
    transform: scale(1.15);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
    margin-top: 1rem;
}

.action-row > button {
    flex: 1 1 180px;
}

.game-layout {
    display: grid;
    gap: 16px;
}

.status-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
}

.round-title {
    font-size: clamp(1.5rem, 4vw, 2.4rem);
    letter-spacing: -0.045em;
    margin-bottom: 0.25rem;
}

.timer-pill {
    min-width: 130px;
    text-align: center;
    padding: 0.8rem 1rem;
    border-radius: 999px;
    background: var(--card-soft);
    border: 2px solid var(--line);
    font-weight: 1000;
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.task-card {
    overflow: hidden;
}

.prompt-box,
.previous-card {
    border-radius: var(--radius-lg);
    border: 2px dashed #c8b5ff;
    background: var(--card-soft);
    padding: 1rem;
    margin-bottom: 1rem;
}

.prompt-box strong,
.previous-card strong {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--primary-dark);
}

.prompt-text {
    font-size: clamp(1.3rem, 4vw, 2.2rem);
    line-height: 1.12;
    font-weight: 950;
    word-break: break-word;
}

.prompt-text.small-prompt {
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    line-height: 1.25;
    font-weight: 900;
}

.previous-image,
.reveal-image,
.draft-image {
    display: block;
    max-width: 100%;
    border-radius: 18px;
    border: 2px solid var(--line);
    background: #fff;
}

.text-submit-grid {
    display: grid;
    gap: 0.9rem;
}

.submit-area {
    position: sticky;
    bottom: calc(0.8rem + var(--safe-bottom));
    z-index: 10;
    display: flex;
    gap: 0.7rem;
    padding: 0.75rem;
    margin: 1rem -0.75rem -0.75rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
}

.submit-area button {
    flex: 1;
}

.wait-card {
    text-align: center;
    min-height: 320px;
    display: grid;
    place-items: center;
}

.wait-emoji {
    font-size: 4rem;
}

.canvas-shell {
    display: grid;
    gap: 1rem;
}

.canvas-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 0.92fr) minmax(300px, 1.08fr);
    gap: 0.9rem;
    align-items: start;
}

.color-panel,
.tool-panel {
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.78);
    padding: 0.8rem;
    box-shadow: 0 12px 26px rgba(18, 9, 50, 0.08);
}

.toolbar-title {
    color: var(--primary-dark);
    font-weight: 1000;
    margin: 0 0 0.55rem;
}

.color-row,
.tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    align-items: center;
}

.color-row {
    max-height: 104px;
    overflow: auto;
    padding: 0.2rem;
    overscroll-behavior: contain;
}

.color-swatch {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 999px;
    border: 4px solid #fff;
    box-shadow: 0 0 0 2px var(--line), 0 5px 12px rgba(0, 0, 0, 0.12);
    padding: 0;
}

.color-swatch.active {
    box-shadow: 0 0 0 4px var(--primary), 0 6px 16px rgba(0, 0, 0, 0.18);
    transform: translateY(-1px) scale(1.04);
}

.custom-color-control {
    margin-top: 0.7rem;
    display: grid;
    grid-template-columns: 1fr 58px auto;
    gap: 0.55rem;
    align-items: center;
    font-weight: 900;
    color: var(--muted);
}

.custom-color-control input[type="color"] {
    width: 58px;
    min-width: 58px;
    height: 44px;
    padding: 3px;
    border-radius: 14px;
}

.size-control,
.toggle-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-radius: 999px;
    background: var(--card-soft);
    border: 2px solid var(--line);
    font-weight: 900;
    min-height: 46px;
}

.size-control input {
    width: 120px;
    padding: 0;
}

.toggle-chip input {
    width: auto;
    min-width: 18px;
}

.tool-row + .tool-row {
    margin-top: 0.65rem;
}

.compact-tools {
    gap: 0.5rem;
}

.tool-btn.active,
.tool-btn[aria-pressed="true"] {
    color: #fff;
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), #a855f7);
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.24);
}

.tool-btn.mini {
    min-height: 42px;
    padding: 0.55rem 0.8rem;
}

.canvas-help {
    margin: -0.15rem 0 0;
    color: var(--muted);
    font-weight: 700;
}

.canvas-wrap {
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 3px solid var(--line);
    background:
        linear-gradient(45deg, #f6f0ff 25%, transparent 25%),
        linear-gradient(-45deg, #f6f0ff 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f6f0ff 75%),
        linear-gradient(-45deg, transparent 75%, #f6f0ff 75%);
    background-size: 26px 26px;
    background-position: 0 0, 0 13px, 13px -13px, -13px 0;
    touch-action: none;
    overscroll-behavior: contain;
}

.drawing-canvas {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: #fff;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.canvas-wrap {
    position: relative;
}

.canvas-wrap.trace-mode {
    background: #fff;
}

.trace-reference-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    pointer-events: none;
    background: #fff;
}

.trace-reference-layer img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: var(--trace-opacity, 0.32);
    filter: saturate(0.9) contrast(1.04);
}

.drawing-canvas.is-tracing {
    position: relative;
    z-index: 2;
    background: transparent;
}

.trace-controls {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 2px dashed var(--line);
}

.trace-opacity-control input {
    width: 150px;
}

.trace-prompt {
    border-style: solid;
}


.reveal-layout {
    display: grid;
    gap: 18px;
}

.reveal-chain {
    display: grid;
    gap: 0.9rem;
}

.reveal-card {
    border: 2px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1rem;
    background: #fff;
}

.reveal-card h3 {
    margin: 0 0 0.5rem;
    color: var(--primary-dark);
}

.reveal-entry-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    color: var(--muted);
    font-weight: 800;
    font-size: 0.88rem;
    margin-bottom: 0.55rem;
}

.reveal-text {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    line-height: 1.18;
    font-weight: 950;
    word-break: break-word;
}

.placeholder {
    color: var(--muted);
    font-style: italic;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.2rem + var(--safe-bottom));
    transform: translateX(-50%);
    z-index: 50;
    max-width: min(92vw, 520px);
    border-radius: 999px;
    background: rgba(31, 22, 70, 0.94);
    color: #fff;
    padding: 0.85rem 1.1rem;
    font-weight: 900;
    box-shadow: var(--shadow);
}

[hidden] {
    display: none !important;
}

@media (max-width: 850px) {
    .home-grid,
    .lobby-layout,
    .option-grid,
    .status-card,
    .canvas-toolbar {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .room-code-box {
        margin-left: 0;
    }

    .submit-area {
        flex-direction: column;
    }

    .ghost-btn,
    .primary-btn,
    .secondary-btn,
    .danger-btn,
    .tool-btn {
        padding: 0.9rem 1rem;
    }
}

@media (max-width: 540px) {
    .home-body,
    .main-view {
        padding: 0.75rem;
    }

    .hero-card,
    .panel {
        border-radius: 22px;
    }

    .big-code strong {
        letter-spacing: 0.03em;
    }

    .color-swatch {
        width: 34px;
        height: 34px;
    }

    .tool-row .tool-btn {
        flex: 1 1 calc(50% - 0.55rem);
    }
}

.danger-time {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

@media (max-width: 700px) {
    .canvas-toolbar {
        gap: 0.75rem;
    }

    .color-panel,
    .tool-panel {
        padding: 0.7rem;
    }

    .custom-color-control {
        grid-template-columns: 1fr 54px;
    }

    .custom-color-control .tool-btn {
        grid-column: 1 / -1;
    }

    .tool-row .draw-tool {
        flex: 1 1 calc(50% - 0.55rem);
        min-height: 48px;
    }

    .compact-tools > * {
        flex: 1 1 100%;
    }

    .size-control input {
        flex: 1;
        width: auto;
    }

    .canvas-help {
        font-size: 0.92rem;
    }
}

@media (pointer: coarse) {
    .color-swatch {
        width: 42px;
        height: 42px;
    }

    .tool-btn,
    .danger-btn,
    .ghost-btn,
    .primary-btn,
    .secondary-btn {
        min-height: 48px;
    }
}

/* Ambiance Zilli Gartic : fond plus vivant + transitions plus fluides */
body::before,
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
    width: min(44vw, 520px);
    height: min(44vw, 520px);
    border-radius: 38% 62% 60% 40% / 45% 37% 63% 55%;
    filter: blur(2px);
    opacity: 0.42;
    animation: floatBlob 15s ease-in-out infinite;
}

body::before {
    left: -120px;
    bottom: -140px;
    background: radial-gradient(circle, rgba(255, 221, 87, 0.82), rgba(255, 221, 87, 0));
}

body::after {
    right: -150px;
    top: 90px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.54), rgba(124, 58, 237, 0));
    animation-delay: -5s;
}

.hero-card,
.panel,
.toast,
.join-card {
    animation: softPop 0.38s ease both;
}

.player-pill,
.reveal-card,
.color-swatch,
.tool-btn,
.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
    will-change: transform;
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.danger-btn:active,
.tool-btn:active,
.color-swatch:active {
    transform: translateY(1px) scale(0.985);
}

.hero-card::before {
    content: "";
    position: absolute;
    z-index: 0;
    inset: auto 12% -90px auto;
    width: 220px;
    height: 220px;
    border-radius: 60% 40% 48% 52% / 52% 60% 40% 48%;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(6, 182, 212, 0.22));
    animation: wobbleBlob 12s ease-in-out infinite;
}

.security-note {
    margin-top: 1rem;
    opacity: 0.82;
}

.admin-shell {
    width: min(1380px, 100%);
}

.admin-hero h1 {
    font-size: clamp(2.2rem, 5vw, 4.4rem);
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin: 1rem 0;
}

.admin-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.log-filter {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.8rem;
    align-items: end;
    margin: 1rem 0;
}

.log-filter label {
    color: var(--muted);
    font-weight: 900;
}

.log-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.log-stat {
    border-radius: 18px;
    border: 2px solid var(--line);
    background: rgba(255,255,255,0.9);
    padding: 0.85rem;
    box-shadow: 0 10px 24px rgba(18, 9, 50, 0.09);
}

.log-stat strong {
    display: block;
    font-size: 1.7rem;
    color: var(--primary-dark);
}

.log-stat span {
    color: var(--muted);
    font-weight: 900;
    font-size: 0.88rem;
}

.log-table-wrap {
    width: 100%;
    overflow: auto;
    border-radius: 18px;
    border: 2px solid var(--line);
}

.log-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: #fff;
}

.log-table th,
.log-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

.log-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card-soft);
    color: var(--primary-dark);
}

.log-table pre {
    max-width: 520px;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 14px;
    background: #1f1646;
    color: #fff;
    padding: 0.75rem;
}

@keyframes softPop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.992);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes floatBlob {
    0%, 100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
    50% {
        transform: translate3d(38px, -26px, 0) rotate(14deg) scale(1.08);
    }
}

@keyframes wobbleBlob {
    0%, 100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
        border-radius: 60% 40% 48% 52% / 52% 60% 40% 48%;
    }
    50% {
        transform: translate3d(-22px, -12px, 0) rotate(-13deg);
        border-radius: 40% 60% 63% 37% / 44% 39% 61% 56%;
    }
}

@media (max-width: 850px) {
    .log-filter {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/* Version modération + animations de chargement */
.page-enter {
    animation: pageRise 0.52s cubic-bezier(.2,.9,.2,1) both;
}

.home-grid .panel,
.lobby-layout .panel,
.game-layout .panel,
.reveal-chain {
    animation: panelIn 0.34s cubic-bezier(.2,.9,.2,1) both;
}

.home-grid .panel:nth-child(2),
.lobby-layout .panel:nth-child(2) {
    animation-delay: 0.05s;
}

.conduct-box {
    display: grid;
    gap: 0.35rem;
    margin: 1.1rem 0 0;
    padding: 0.95rem 1rem;
    border: 2px solid rgba(250, 204, 21, 0.7);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255, 245, 190, 0.95), rgba(255, 255, 255, 0.88));
    color: #4a3510;
    box-shadow: 0 12px 28px rgba(250, 204, 21, 0.13);
}

.conduct-box strong {
    font-size: 1rem;
    font-weight: 1000;
}

.conduct-box span {
    line-height: 1.42;
    font-weight: 750;
}

.conduct-box.compact {
    margin: 0.9rem 0 1rem;
    padding: 0.8rem 0.9rem;
    font-size: 0.94rem;
}

.invite-line {
    margin: 0.85rem 0 0;
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    border: 2px solid var(--line);
    background: var(--card-soft);
    color: var(--primary-dark);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.inline-message {
    margin: 0.85rem 0 0;
    border-radius: 16px;
    padding: 0.75rem 0.85rem;
    background: var(--card-soft);
    color: var(--primary-dark);
    font-weight: 900;
}

.mode-choice-grid,
.mode-card,
.reveal-note,
.option-autosave-status {
    margin: 0.85rem 0;
    border-radius: 18px;
    padding: 0.85rem 0.95rem;
    border: 2px solid var(--line);
    background: linear-gradient(135deg, rgba(247, 242, 255, 0.98), rgba(255, 255, 255, 0.9));
    color: var(--primary-dark);
    font-weight: 850;
}

.mode-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem;
    padding: 0;
    border: 0;
    background: transparent;
}

.mode-card {
    display: grid;
    gap: 0.32rem;
    cursor: pointer;
    border-color: rgba(124, 58, 237, 0.28);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.mode-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-card strong {
    font-weight: 1000;
    color: var(--primary-dark);
}

.mode-card span {
    color: var(--muted);
    line-height: 1.35;
    font-size: 0.92rem;
}

.mode-card.active {
    border-color: rgba(124, 58, 237, 0.72);
    box-shadow: 0 14px 32px rgba(124, 58, 237, 0.14);
    transform: translateY(-1px);
}

.option-autosave-status {
    font-size: 0.92rem;
    color: var(--ok);
}

.option-autosave-status.is-pending {
    color: var(--primary-dark);
}

.reveal-note {
    margin-top: -0.25rem;
    color: var(--muted);
}

.imitation-reference {
    border-color: rgba(250, 204, 21, 0.85);
    background: linear-gradient(135deg, rgba(255, 248, 214, 0.95), rgba(255, 255, 255, 0.98));
}

.imitation-prompt {
    border-color: rgba(250, 204, 21, 0.85);
}

@media (max-width: 720px) {
    .mode-choice-grid {
        grid-template-columns: 1fr;
    }
}

.round-subtitle {
    margin: 0;
    color: var(--muted);
    font-weight: 850;
    line-height: 1.35;
}

button.is-busy,
.form-panel.is-loading button {
    position: relative;
    overflow: hidden;
}

button.is-busy::after,
.form-panel.is-loading button::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.34), transparent);
    animation: buttonSweep 0.95s linear infinite;
}

.loader-orbit {
    position: relative;
    width: 78px;
    height: 78px;
    display: inline-grid;
    place-items: center;
    margin-bottom: 0.85rem;
}

.loader-orbit::before {
    content: "";
    width: 54px;
    height: 54px;
    border-radius: 999px;
    border: 7px solid var(--line);
    border-top-color: var(--primary);
    border-right-color: #a855f7;
    animation: spin 0.8s linear infinite;
}

.loader-orbit span {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--secondary);
    box-shadow: 0 0 20px rgba(250, 204, 21, 0.55);
    animation: dotPulse 1.05s ease-in-out infinite;
}

.loader-orbit span:nth-child(1) { top: 4px; left: 33px; }
.loader-orbit span:nth-child(2) { right: 6px; bottom: 18px; animation-delay: 0.16s; background: #ec4899; }
.loader-orbit span:nth-child(3) { left: 6px; bottom: 18px; animation-delay: 0.32s; background: #06b6d4; }

.loader-orbit.small {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.65rem;
}

.loader-orbit.small::before {
    width: 38px;
    height: 38px;
    border-width: 5px;
}

.loader-orbit.small span {
    width: 9px;
    height: 9px;
}

.loading-dots i {
    font-style: normal;
    opacity: 0.15;
    animation: dotFade 1.1s ease-in-out infinite;
}

.loading-dots i:nth-child(2) { animation-delay: 0.18s; }
.loading-dots i:nth-child(3) { animation-delay: 0.36s; }

.loading-card p,
.wait-card p {
    font-weight: 900;
}

body {
    background-size: 120% 120%, 120% 120%, 100% 100%;
    animation: ambientShift 16s ease-in-out infinite alternate;
}

.hero-card::after {
    animation: wobbleBlob 13s ease-in-out infinite;
}

@keyframes pageRise {
    from { opacity: 0; transform: translateY(16px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes buttonSweep {
    to { transform: translateX(100%); }
}

@keyframes dotPulse {
    0%, 100% { transform: scale(0.75); opacity: 0.45; }
    50% { transform: scale(1.25); opacity: 1; }
}

@keyframes dotFade {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 1; }
}

@keyframes ambientShift {
    from { background-position: 0% 0%, 100% 100%, 0 0; }
    to { background-position: 12% 8%, 88% 92%, 0 0; }
}

@media (max-width: 540px) {
    .conduct-box {
        border-radius: 18px;
        font-size: 0.92rem;
    }

    .invite-line {
        font-size: 0.86rem;
    }
}

/* Multi-jeux + Bombe syllabe */
.home-game-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.85rem;
    margin: 0.9rem 0 1.1rem;
}

.home-game-card {
    display: grid;
    gap: 0.35rem;
    padding: 0.95rem;
    border-radius: 20px;
    border: 2px solid rgba(124, 58, 237, 0.24);
    background: linear-gradient(135deg, rgba(247, 242, 255, 0.98), rgba(255, 255, 255, 0.94));
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.home-game-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.home-game-card strong {
    font-weight: 1000;
    color: var(--primary-dark);
}

.home-game-card span {
    color: var(--muted);
    font-weight: 800;
    line-height: 1.35;
    font-size: 0.92rem;
}

.home-game-card.active,
.home-game-card:focus-within {
    transform: translateY(-1px);
    border-color: rgba(124, 58, 237, 0.72);
    box-shadow: 0 14px 32px rgba(124, 58, 237, 0.14);
}

.game-type-grid {
    margin-bottom: 1.1rem;
}

.bomb-mode-card.active,
.home-game-card:nth-child(2).active {
    border-color: rgba(239, 68, 68, 0.58);
    box-shadow: 0 16px 36px rgba(239, 68, 68, 0.14);
}


.multi-game-options {
    display: block;
}

.option-section {
    margin: 0.85rem 0;
    padding: 1rem;
    border: 2px solid var(--line);
    border-radius: 22px;
    background: rgba(247, 242, 255, 0.58);
}

.option-section[hidden] {
    display: none;
}

.option-section h3 {
    margin: 0 0 0.85rem;
    color: var(--primary-dark);
}

.inner-option-grid {
    box-shadow: none;
    padding: 0;
    border: 0;
    background: transparent;
}

.bomb-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.75fr);
    gap: 18px;
    align-items: start;
}

.bomb-status-card,
.bomb-core-card,
.bomb-history-card {
    grid-column: 1;
}

.bomb-side-card {
    grid-column: 2;
    grid-row: 2 / span 2;
    position: sticky;
    top: 88px;
}

.bomb-timer {
    border-color: rgba(239, 68, 68, 0.28);
    background: rgba(254, 242, 242, 0.92);
    color: #991b1b;
}

.bomb-arena-line {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(1rem, 3vw, 2rem);
    align-items: center;
}

.bomb-visual {
    width: clamp(112px, 18vw, 180px);
    height: clamp(112px, 18vw, 180px);
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92), rgba(254, 226, 226, 0.92) 35%, rgba(239, 68, 68, 0.16));
    border: 4px solid rgba(239, 68, 68, 0.22);
    font-size: clamp(4rem, 10vw, 7rem);
    box-shadow: 0 26px 50px rgba(127, 29, 29, 0.16);
    animation: bombPulse 0.8s ease-in-out infinite alternate;
}

.bomb-syllable-card {
    min-height: 150px;
    display: grid;
    place-items: center;
    text-align: center;
    border-radius: 28px;
    border: 3px solid rgba(250, 204, 21, 0.88);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 255, 255, 0.96));
}

.bomb-syllable-card span {
    color: var(--muted);
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.bomb-syllable-card strong {
    display: block;
    font-size: clamp(4rem, 12vw, 8rem);
    line-height: 0.92;
    color: #991b1b;
    letter-spacing: 0.02em;
}

.bomb-event-box {
    margin: 1rem 0;
    display: flex;
    gap: 0.7rem;
    align-items: center;
    border-radius: 18px;
    border: 2px solid rgba(124, 58, 237, 0.16);
    background: var(--card-soft);
    padding: 0.85rem 1rem;
    color: var(--primary-dark);
}

.bomb-event-box strong {
    font-weight: 950;
}

.bomb-word-form {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.bomb-word-form label {
    color: var(--primary-dark);
    font-weight: 950;
}

.bomb-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
}

.bomb-input-row input {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 950;
    letter-spacing: 0.02em;
}

.bomb-wait-card {
    min-height: 170px;
    display: grid;
    place-items: center;
    text-align: center;
    border: 2px dashed rgba(124, 58, 237, 0.24);
    border-radius: 24px;
    background: rgba(247, 242, 255, 0.62);
    padding: 1.2rem;
}

.bomb-wait-card h2 {
    margin: 0 0 0.45rem;
}

.bomb-wait-card.eliminated {
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(254, 242, 242, 0.78);
}

.bomb-player-list {
    display: grid;
    gap: 0.6rem;
}

.bomb-player-pill {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
        "dot name lives"
        "dot tags tags";
    gap: 0.12rem 0.65rem;
    align-items: center;
    padding: 0.7rem 0.75rem;
    border-radius: 18px;
    border: 2px solid var(--line);
    background: #fff;
}

.bomb-player-pill .player-dot {
    grid-area: dot;
}

.bomb-player-pill .player-name {
    grid-area: name;
    font-weight: 950;
}

.bomb-player-pill .bomb-lives {
    grid-area: lives;
    font-weight: 900;
    white-space: nowrap;
}

.bomb-player-pill .player-tags {
    grid-area: tags;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.bomb-player-pill.current {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.12);
}

.bomb-player-pill.dead {
    opacity: 0.62;
    background: #f8fafc;
}

.danger-tag {
    background: rgba(254, 226, 226, 0.92) !important;
    color: #991b1b !important;
}

.bomb-word-history {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.bomb-word-chip {
    display: inline-grid;
    gap: 0.12rem;
    padding: 0.62rem 0.78rem;
    border-radius: 16px;
    border: 2px solid var(--line);
    background: #fff;
}

.bomb-word-chip strong {
    color: var(--primary-dark);
    font-weight: 1000;
}

.bomb-word-chip span,
.bomb-word-chip em {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 850;
    font-style: normal;
}

.bomb-word-chip em::before {
    content: "syllabe ";
}

.bomb-winner-card {
    border-color: rgba(250, 204, 21, 0.78);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.98), rgba(255, 255, 255, 0.98));
}

@keyframes bombPulse {
    from { transform: rotate(-2deg) scale(0.98); }
    to { transform: rotate(2deg) scale(1.025); }
}

@media (max-width: 860px) {
    .bomb-layout {
        grid-template-columns: 1fr;
    }

    .bomb-status-card,
    .bomb-core-card,
    .bomb-side-card,
    .bomb-history-card {
        grid-column: auto;
        grid-row: auto;
        position: static;
    }
}

@media (max-width: 720px) {
    .home-game-picker,
    .bomb-arena-line,
    .bomb-input-row {
        grid-template-columns: 1fr;
    }

    .bomb-visual {
        margin: 0 auto;
    }
}

/* Bombe syllabe v2 : arène centrale, dictionnaire et chrono accéléré */
.bomb-layout-v2 {
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.72fr);
}

.bomb-layout-v2 .bomb-status-card {
    grid-column: 1 / -1;
}

.bomb-stage-card {
    grid-column: 1;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 42%, rgba(250, 204, 21, 0.24), transparent 20rem),
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 242, 255, 0.92));
}

.bomb-stage-card::before,
.bomb-stage-card::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.bomb-stage-card::before {
    width: 220px;
    height: 220px;
    right: -90px;
    top: -110px;
    background: rgba(239, 68, 68, 0.16);
}

.bomb-stage-card::after {
    width: 180px;
    height: 180px;
    left: -90px;
    bottom: -100px;
    background: rgba(250, 204, 21, 0.18);
}

.bomb-stage-card > * {
    position: relative;
    z-index: 1;
}

.bomb-timer {
    position: relative;
    overflow: hidden;
    min-width: 148px;
    border-color: rgba(239, 68, 68, 0.28);
    background: linear-gradient(90deg, rgba(254, 226, 226, 0.95), rgba(255, 251, 235, 0.95));
    color: #7f1d1d;
    box-shadow: inset 0 -5px 0 rgba(239, 68, 68, 0.08), 0 12px 24px rgba(127, 29, 29, 0.1);
}

.bomb-timer::before {
    content: "";
    position: absolute;
    inset: 0;
    width: calc(var(--timer-ratio, 1) * 100%);
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.22), rgba(250, 204, 21, 0.28), rgba(239, 68, 68, 0.18));
    transition: width 0.25s linear;
    z-index: 0;
}

.bomb-timer {
    isolation: isolate;
}

.bomb-timer::after {
    content: attr(data-seconds) "s";
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.bomb-timer.danger-time {
    animation: timerDangerPulse 0.45s ease-in-out infinite alternate;
}

.bomb-arena {
    --arena-radius: clamp(118px, 24vw, 230px);
    min-height: clamp(360px, 54vw, 560px);
    position: relative;
    display: grid;
    place-items: center;
    margin: 0 auto 1rem;
    border-radius: 32px;
    border: 3px solid rgba(31, 22, 70, 0.08);
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.9) 0 5rem, transparent 5.1rem),
        radial-gradient(circle at 50% 50%, rgba(250, 204, 21, 0.22), transparent 16rem),
        linear-gradient(135deg, rgba(31, 22, 70, 0.92), rgba(75, 31, 130, 0.86));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 22px 55px rgba(31, 22, 70, 0.18);
    overflow: hidden;
}

.bomb-arena::before {
    content: "";
    position: absolute;
    inset: 24px;
    border-radius: 999px;
    border: 2px dashed rgba(255, 255, 255, 0.14);
    animation: arenaSpin 28s linear infinite;
}

.bomb-arena::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.3), transparent 68%);
    filter: blur(4px);
    animation: arenaGlow 1.2s ease-in-out infinite alternate;
}

.bomb-arena[data-speed-level="3"]::after,
.bomb-arena[data-speed-level="4"]::after,
.bomb-arena[data-speed-level="5"]::after {
    animation-duration: 0.72s;
}

.bomb-arena[data-speed-level="5"] {
    animation: arenaShake 0.22s linear infinite;
}

.bomb-arena-orbit {
    position: absolute;
    width: calc(var(--arena-radius) * 2 + 96px);
    height: calc(var(--arena-radius) * 2 + 96px);
    border-radius: 999px;
    background:
        conic-gradient(from 0deg, transparent, rgba(250, 204, 21, 0.16), transparent 25%, rgba(239, 68, 68, 0.14), transparent 55%, rgba(124, 58, 237, 0.18), transparent);
    mask: radial-gradient(circle, transparent 58%, #000 60%, #000 61.5%, transparent 64%);
    animation: arenaSpin 10s linear infinite reverse;
}

.bomb-target-beam {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--arena-radius);
    height: 10px;
    transform-origin: left center;
    transform: rotate(var(--target-angle, -90deg));
    z-index: 2;
    opacity: 0.92;
    pointer-events: none;
}

.bomb-target-beam span {
    display: block;
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.95), rgba(250, 204, 21, 0.34), transparent);
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.48);
    animation: beamPulse 0.5s ease-in-out infinite alternate;
}

.bomb-target-beam span::after {
    content: "";
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 24px solid rgba(250, 204, 21, 0.95);
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.55));
}

.bomb-arena-player {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(112px, 16vw, 170px);
    display: grid;
    justify-items: center;
    gap: 0.25rem;
    transform: rotate(var(--angle)) translate(var(--arena-radius)) rotate(var(--angle-inverse)) translate(-50%, -50%);
    z-index: 4;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.bomb-arena-name {
    max-width: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--ink);
    padding: 0.22rem 0.58rem;
    font-weight: 1000;
    font-size: clamp(0.78rem, 1.5vw, 1rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.16);
}

.bomb-arena-avatar {
    width: clamp(62px, 9vw, 92px);
    height: clamp(62px, 9vw, 92px);
    display: grid;
    place-items: center;
    border-radius: 20px;
    border: 4px solid rgba(255, 255, 255, 0.72);
    background: linear-gradient(135deg, var(--avatar-color), rgba(255,255,255,0.36));
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.24);
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.bomb-arena-lives {
    min-height: 1.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #be123c;
    padding: 0.18rem 0.5rem;
    font-size: clamp(0.78rem, 1.5vw, 0.96rem);
    font-weight: 1000;
    letter-spacing: -0.08em;
}

.bomb-arena-player.current .bomb-arena-avatar {
    border-color: rgba(250, 204, 21, 0.98);
    animation: currentPlayerBounce 0.55s ease-in-out infinite alternate;
    box-shadow: 0 0 0 8px rgba(250, 204, 21, 0.2), 0 20px 34px rgba(250, 204, 21, 0.22);
}

.bomb-arena-player.me .bomb-arena-name {
    background: rgba(237, 233, 254, 0.96);
    color: var(--primary-dark);
}

.bomb-arena-player.dead {
    opacity: 0.48;
    filter: grayscale(1);
}

.bomb-shell {
    position: relative;
    z-index: 5;
    width: clamp(142px, 22vw, 220px);
    height: clamp(142px, 22vw, 220px);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.14rem;
    border-radius: 999px;
    border: clamp(7px, 1.1vw, 12px) solid rgba(0, 0, 0, 0.32);
    background:
        radial-gradient(circle at 34% 26%, rgba(255,255,255,0.96) 0 11%, rgba(255,255,255,0.12) 12% 20%, transparent 21%),
        radial-gradient(circle at 50% 56%, rgba(62, 50, 42, 1), rgba(24, 24, 27, 1) 64%, #050505 100%);
    color: #fff;
    box-shadow:
        inset -18px -24px 28px rgba(0, 0, 0, 0.34),
        inset 12px 14px 24px rgba(255, 255, 255, 0.08),
        0 26px 48px rgba(0, 0, 0, 0.34),
        0 0 0 16px rgba(255, 255, 255, 0.08);
    animation: bombBreathing 0.75s ease-in-out infinite alternate;
}

.bomb-shell::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: inherit;
    background: conic-gradient(rgba(34,197,94,0.9) calc(var(--timer-ratio, 1) * 360deg), rgba(239, 68, 68, 0.26) 0deg);
    z-index: -1;
    filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.26));
}

.bomb-shell::after {
    content: "";
    position: absolute;
    width: 28%;
    height: 22%;
    border-radius: 999px 999px 0 0;
    top: -13%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #27272a, #050505);
    border: 5px solid rgba(0,0,0,0.28);
    box-shadow: inset 0 7px 0 rgba(255,255,255,0.08);
}

.bomb-fuse {
    position: absolute;
    width: 76px;
    height: 42px;
    left: 57%;
    top: -28%;
    border-top: 8px solid #2f241c;
    border-right: 8px solid #2f241c;
    border-radius: 0 40px 0 0;
    transform: rotate(-10deg);
    z-index: 1;
}

.bomb-spark {
    position: absolute;
    left: calc(57% + 64px);
    top: calc(-28% - 14px);
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #facc15;
    font-size: 2.2rem;
    text-shadow: 0 0 12px rgba(250, 204, 21, 0.92), 0 0 22px rgba(239, 68, 68, 0.8);
    animation: sparkFlash 0.16s linear infinite alternate;
}

.bomb-label {
    font-size: clamp(0.72rem, 1.5vw, 0.9rem);
    font-weight: 1000;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.bomb-shell strong {
    display: block;
    font-size: clamp(2.8rem, 8vw, 5.2rem);
    line-height: 0.92;
    color: #fff;
    letter-spacing: 0.03em;
    text-shadow: 0 4px 0 rgba(0,0,0,0.28), 0 0 24px rgba(250, 204, 21, 0.32);
}

.bomb-current-player {
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 950;
    font-size: clamp(0.76rem, 1.6vw, 0.98rem);
    color: rgba(255, 255, 255, 0.82);
}

.bomb-shell.my-turn {
    box-shadow:
        inset -18px -24px 28px rgba(0, 0, 0, 0.34),
        inset 12px 14px 24px rgba(255, 255, 255, 0.08),
        0 0 0 18px rgba(250, 204, 21, 0.16),
        0 28px 54px rgba(250, 204, 21, 0.2);
}

.bomb-shell.danger-time {
    animation: bombDanger 0.28s linear infinite alternate;
}

.bomb-shell.critical-time {
    animation: bombCritical 0.12s linear infinite alternate;
}

.bomb-arena.event-explosion .bomb-shell,
.bomb-arena.event-eliminated .bomb-shell {
    animation: bombExplosionKick 0.48s cubic-bezier(.2,.8,.2,1) 1;
}

.bomb-arena-meta {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    z-index: 7;
}

.bomb-arena-meta span,
.bomb-dictionary-note {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-dark);
    padding: 0.38rem 0.68rem;
    font-size: 0.82rem;
    font-weight: 950;
}

.bomb-dictionary-note {
    display: inline-block;
    margin: 0.6rem 0 0;
    border: 1px solid rgba(124, 58, 237, 0.14);
}

.bomb-event-box {
    animation: eventPop 0.24s ease-out 1;
}

.bomb-event-box.event-word {
    border-color: rgba(34, 197, 94, 0.26);
    background: rgba(240, 253, 244, 0.92);
    color: #166534;
}

.bomb-event-box.event-explosion {
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(254, 242, 242, 0.94);
    color: #991b1b;
}

.bomb-event-box.event-winner {
    border-color: rgba(250, 204, 21, 0.58);
    background: rgba(255, 251, 235, 0.96);
    color: #854d0e;
}

.bomb-word-form.active-turn {
    border: 3px solid rgba(250, 204, 21, 0.72);
    border-radius: 26px;
    padding: 1rem;
    background: rgba(255, 251, 235, 0.74);
    box-shadow: 0 16px 32px rgba(250, 204, 21, 0.15);
}

.bomb-word-form.active-turn label strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.2rem;
    margin-left: 0.22rem;
    border-radius: 0.8rem;
    background: #111827;
    color: #fff;
    padding: 0.16rem 0.46rem;
    letter-spacing: 0.04em;
}

.bomb-input-row input {
    text-transform: none;
}

.bomb-input-row input:focus {
    border-color: rgba(239, 68, 68, 0.52);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.12);
}

.bomb-player-pill.current {
    border-color: rgba(250, 204, 21, 0.92);
    background: linear-gradient(135deg, rgba(255, 251, 235, 0.96), #fff);
    animation: playerPillPulse 0.62s ease-in-out infinite alternate;
}

.bomb-word-chip:first-child {
    animation: wordChipIn 0.28s ease-out 1;
    border-color: rgba(34, 197, 94, 0.32);
}

@keyframes timerDangerPulse {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-1px) scale(1.035); }
}

@keyframes arenaSpin {
    to { transform: rotate(360deg); }
}

@keyframes arenaGlow {
    from { transform: scale(0.86); opacity: 0.5; }
    to { transform: scale(1.18); opacity: 0.95; }
}

@keyframes arenaShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 1px); }
    75% { transform: translate(1px, 1px); }
}

@keyframes beamPulse {
    from { opacity: 0.48; transform: scaleX(0.92); }
    to { opacity: 1; transform: scaleX(1.04); }
}

@keyframes currentPlayerBounce {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-6px) scale(1.045); }
}

@keyframes bombBreathing {
    from { transform: rotate(-1deg) scale(0.985); }
    to { transform: rotate(1.4deg) scale(1.02); }
}

@keyframes sparkFlash {
    from { transform: rotate(0deg) scale(0.86); opacity: 0.72; }
    to { transform: rotate(18deg) scale(1.16); opacity: 1; }
}

@keyframes bombDanger {
    from { transform: translate(-1px, 0) rotate(-2deg) scale(1.015); }
    to { transform: translate(2px, -1px) rotate(2deg) scale(1.045); }
}

@keyframes bombCritical {
    from { transform: translate(-3px, 1px) rotate(-4deg) scale(1.04); }
    to { transform: translate(3px, -2px) rotate(4deg) scale(1.08); }
}

@keyframes bombExplosionKick {
    0% { transform: scale(1) rotate(0deg); filter: brightness(1); }
    35% { transform: scale(1.18) rotate(-6deg); filter: brightness(1.8); }
    100% { transform: scale(1) rotate(2deg); filter: brightness(1); }
}

@keyframes eventPop {
    from { transform: translateY(6px) scale(0.98); opacity: 0.4; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes playerPillPulse {
    from { box-shadow: 0 10px 22px rgba(250, 204, 21, 0.12); }
    to { box-shadow: 0 14px 28px rgba(250, 204, 21, 0.28); }
}

@keyframes wordChipIn {
    from { transform: translateY(8px) scale(0.96); opacity: 0.2; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

@media (max-width: 980px) {
    .bomb-layout-v2 {
        grid-template-columns: 1fr;
    }

    .bomb-layout-v2 .bomb-status-card,
    .bomb-stage-card,
    .bomb-side-card,
    .bomb-history-card {
        grid-column: auto;
        grid-row: auto;
        position: static;
    }
}

@media (max-width: 680px) {
    .bomb-arena {
        --arena-radius: clamp(92px, 34vw, 138px);
        min-height: 430px;
        border-radius: 24px;
    }

    .bomb-arena-player {
        width: 98px;
    }

    .bomb-arena-name {
        font-size: 0.74rem;
        max-width: 92px;
    }

    .bomb-arena-avatar {
        width: 58px;
        height: 58px;
        border-radius: 16px;
        font-size: 1.7rem;
    }

    .bomb-arena-lives {
        font-size: 0.72rem;
        letter-spacing: -0.12em;
    }

    .bomb-shell {
        width: 132px;
        height: 132px;
    }

    .bomb-spark {
        left: calc(57% + 44px);
        top: calc(-28% - 10px);
        font-size: 1.7rem;
    }

    .bomb-fuse {
        width: 56px;
        height: 34px;
    }

    .bomb-arena-meta {
        bottom: 10px;
        font-size: 0.74rem;
    }
}

.bomb-word-form.word-error-shake {
    animation: wordErrorShake 0.34s ease both;
}

@keyframes wordErrorShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.site-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 1.1rem 0 0;
}

.site-stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.2rem 0.55rem;
    min-height: 86px;
    padding: 0.95rem 1rem;
    border: 2px solid rgba(231, 220, 255, 0.95);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(247, 242, 255, 0.96), rgba(255, 255, 255, 0.92));
    box-shadow: 0 14px 30px rgba(31, 22, 70, 0.08);
}

.site-stat-card strong {
    grid-column: 1 / -1;
    font-size: clamp(1.55rem, 3vw, 2.25rem);
    line-height: 1;
    letter-spacing: -0.05em;
    font-weight: 1000;
    color: var(--primary-dark);
}

.site-stat-card small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-weight: 900;
}

.site-stat-card.live-stat {
    grid-template-columns: auto 1fr;
}

.site-stat-card.live-stat strong {
    grid-column: 2;
}

.site-stat-card.live-stat small {
    grid-column: 1 / -1;
}

.live-dot {
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 999px;
    background: var(--ok);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.35);
    animation: livePulse 1.6s ease-out infinite;
}

.stat-pop {
    animation: statPop 0.28s cubic-bezier(.2,.9,.2,1) both;
}

@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.35); }
    70% { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

@keyframes statPop {
    0% { transform: scale(0.96); }
    60% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

@media (max-width: 850px) {
    .site-stats {
        grid-template-columns: 1fr;
    }

    .site-stat-card {
        min-height: 76px;
    }
}
