:root {
    --alkkagi-focus-sidebar-width: 360px;
    --alkkagi-focus-board-reserve: 250px;
}

.alkkagi-shell {
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px 18px 42px;
}

.alkkagi-topbar {
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.alkkagi-topbar-copy {
    flex: 1;
    min-width: 0;
}

.alkkagi-topbar-copy h1 {
    margin: 4px 0 8px;
    font-size: clamp(1.55rem, 2.2vw, 2.35rem);
}

.alkkagi-topbar-copy p {
    margin: 0;
    max-width: 680px;
}

.alkkagi-topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.alkkagi-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.14);
    color: #fbbf24;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.alkkagi-hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

.alkkagi-hero-main,
.alkkagi-hero-side,
.alkkagi-card-panel,
.alkkagi-stage {
    padding: 18px;
    border-radius: 26px;
}

.alkkagi-hero-main {
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, 0.16), transparent 40%),
        linear-gradient(135deg, rgba(127, 29, 29, 0.12), rgba(15, 23, 42, 0.08)),
        var(--card-bg);
}

.alkkagi-hero-side {
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 38%),
        linear-gradient(180deg, rgba(148, 163, 184, 0.08), transparent 72%),
        var(--card-bg);
}

.alkkagi-hero-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.alkkagi-kicker {
    font-size: 0.78rem;
    color: var(--text-sub);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.alkkagi-student-label {
    margin-top: 6px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.alkkagi-profile-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 116px;
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: #fbbf24;
}

.alkkagi-hero-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.alkkagi-kpi {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.alkkagi-kpi .label {
    display: block;
    color: var(--text-sub);
    font-size: 0.76rem;
}

.alkkagi-kpi strong {
    display: block;
    margin-top: 6px;
    font-size: 1.08rem;
}

.alkkagi-side-title {
    font-size: 1.06rem;
    font-weight: 800;
    color: var(--text-main);
}

.alkkagi-side-note {
    margin-top: 8px;
    color: var(--text-sub);
    line-height: 1.55;
}

.alkkagi-inline-actions,
.alkkagi-inline-code {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 14px;
}

.alkkagi-compact-select,
.alkkagi-inline-code input {
    width: 100%;
}

.alkkagi-global-status {
    margin-top: 14px;
    padding: 11px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-main);
    font-size: 0.88rem;
    line-height: 1.45;
}

.alkkagi-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.62fr) minmax(320px, 0.9fr) minmax(300px, 0.88fr);
    gap: 16px;
    align-items: start;
}

.alkkagi-lobby-column {
    display: grid;
    gap: 16px;
}

.alkkagi-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.alkkagi-panel-head h3 {
    margin: 0;
    font-size: 1.02rem;
}

.alkkagi-panel-head p {
    margin: 6px 0 0;
}

.alkkagi-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    font-size: 0.82rem;
    font-weight: 700;
}

.alkkagi-list {
    display: grid;
    gap: 10px;
}

.alkkagi-empty {
    padding: 18px 14px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.26);
    color: var(--text-sub);
    text-align: center;
}

.alkkagi-room-item,
.alkkagi-match-item,
.alkkagi-rank-item {
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.alkkagi-room-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.alkkagi-room-item h4,
.alkkagi-match-item h4 {
    margin: 0;
    font-size: 0.98rem;
}

.alkkagi-room-meta,
.alkkagi-match-meta,
.alkkagi-rank-meta {
    margin-top: 6px;
    color: var(--text-sub);
    font-size: 0.84rem;
    line-height: 1.5;
}

.alkkagi-stage {
    min-width: 0;
    background:
        radial-gradient(circle at top left, rgba(239, 68, 68, 0.1), transparent 24%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.12), transparent 32%),
        var(--card-bg);
}

.alkkagi-stage-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.alkkagi-stage-head-copy {
    min-width: 0;
}

.alkkagi-stage-head h2 {
    margin: 8px 0 8px;
    font-size: 1.25rem;
}

.alkkagi-stage-head p {
    margin: 0;
}

.alkkagi-state-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-main);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.alkkagi-room-code-box {
    display: grid;
    gap: 8px;
    min-width: 154px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.26);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.alkkagi-room-code-box .label {
    color: var(--text-sub);
    font-size: 0.78rem;
}

.alkkagi-room-code-box strong {
    font-size: 1.18rem;
    letter-spacing: 0.16em;
}

.alkkagi-room-code-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.alkkagi-code-copy,
.alkkagi-sound-toggle,
.alkkagi-fullscreen-toggle {
    width: 100%;
}

.alkkagi-invite-pane {
    margin-top: 18px;
}

.alkkagi-invite-surface {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border-radius: 28px;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 34%),
        radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.14), transparent 28%),
        rgba(15, 23, 42, 0.46);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 44px rgba(2, 6, 23, 0.2);
}

.alkkagi-invite-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.alkkagi-invite-visibility,
.alkkagi-invite-stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.alkkagi-invite-visibility {
    background: rgba(251, 191, 36, 0.16);
    color: #fcd34d;
}

.alkkagi-invite-stage {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
}

.alkkagi-invite-copy {
    margin-top: 18px;
}

.alkkagi-invite-kicker {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: #93c5fd;
    font-weight: 700;
}

.alkkagi-invite-copy h3 {
    margin: 10px 0;
    font-size: clamp(1.6rem, 2.8vw, 2.5rem);
    line-height: 1.14;
}

.alkkagi-invite-copy p,
.alkkagi-invite-hint {
    color: rgba(226, 232, 240, 0.78);
    line-height: 1.65;
}

.alkkagi-invite-code-panel {
    margin-top: 20px;
    padding: 20px 22px;
    border-radius: 24px;
    background: rgba(7, 18, 37, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
}

.alkkagi-invite-code-panel .label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-sub);
}

.alkkagi-invite-code-panel strong {
    display: block;
    margin-top: 10px;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    letter-spacing: 0.28em;
    text-indent: 0.28em;
    color: #f8fafc;
}

.alkkagi-invite-hint {
    margin-top: 18px;
    font-size: 0.96rem;
}

.alkkagi-invite-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.alkkagi-invite-actions .btn {
    width: 100%;
}

.alkkagi-stage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.7fr);
    gap: 18px;
    margin-top: 18px;
    align-items: start;
}

.alkkagi-board-shell {
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.12), transparent 22%),
        linear-gradient(135deg, #8c5a31, #a87445 48%, #7a4f2e);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.alkkagi-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 12 / 7;
    touch-action: none;
    cursor: grab;
}

.alkkagi-canvas.dragging {
    cursor: grabbing;
}

.alkkagi-result-banner {
    position: absolute;
    left: 18px;
    right: 18px;
    top: 18px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(2, 6, 23, 0.72);
    color: #f8fafc;
    font-weight: 700;
    text-align: center;
    backdrop-filter: blur(10px);
}

.alkkagi-result-banner.is-paused {
    top: auto;
    bottom: 18px;
    background: rgba(15, 23, 42, 0.82);
}

.alkkagi-shot-panel {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.26);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.alkkagi-shot-copy {
    display: grid;
    gap: 5px;
}

.alkkagi-shot-copy strong {
    color: var(--text-main);
}

.alkkagi-shot-copy span {
    color: var(--text-sub);
    font-size: 0.9rem;
}

.alkkagi-shot-meter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-sub);
    font-size: 0.82rem;
    font-weight: 700;
}

.alkkagi-shot-meter-head strong {
    color: #f8fafc;
    font-size: 0.92rem;
}

.alkkagi-shot-meter {
    position: relative;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.16);
}

.alkkagi-shot-meter-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #f59e0b, #ef4444);
    transition: width 120ms ease;
}

.alkkagi-side-pane {
    display: grid;
    gap: 14px;
}

.alkkagi-side-pane > * {
    min-width: 0;
}

.alkkagi-player-stack {
    display: grid;
    gap: 10px;
}

.alkkagi-player-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.alkkagi-player-card.active-turn {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 16px 36px rgba(15, 23, 42, 0.18);
}

.alkkagi-player-card .piece-mark {
    font-size: 1.7rem;
    line-height: 1;
}

.alkkagi-player-card.red .piece-mark {
    color: #ef4444;
}

.alkkagi-player-card.blue .piece-mark {
    color: #60a5fa;
}

.alkkagi-player-card .role {
    font-size: 0.78rem;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.alkkagi-player-card .name {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
}

.alkkagi-player-card .sub {
    margin-top: 4px;
    color: var(--text-sub);
    font-size: 0.84rem;
}

.alkkagi-room-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.alkkagi-stat-chip {
    padding: 12px 13px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.alkkagi-stat-chip span {
    display: block;
    color: var(--text-sub);
    font-size: 0.75rem;
}

.alkkagi-stat-chip strong {
    display: block;
    margin-top: 6px;
    font-size: 0.98rem;
}

.alkkagi-guide-text {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.3);
    color: var(--text-main);
    line-height: 1.6;
}

.alkkagi-room-inline-status {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.24);
    color: #bfdbfe;
    font-size: 0.88rem;
    line-height: 1.45;
}

.alkkagi-room-inline-status.is-error {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(252, 165, 165, 0.28);
    color: #fecaca;
}

.alkkagi-room-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.alkkagi-match-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.alkkagi-match-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.alkkagi-match-badge.win {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.alkkagi-match-badge.loss {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
}

.alkkagi-match-badge.draw {
    background: rgba(96, 165, 250, 0.16);
    color: #93c5fd;
}

.alkkagi-ranking-list {
    gap: 12px;
}

.alkkagi-rank-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.alkkagi-rank-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.alkkagi-rank-copy {
    min-width: 0;
}

.alkkagi-rank-place {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.14);
    font-weight: 800;
}

.alkkagi-rank-place.top3 {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.28), rgba(245, 158, 11, 0.18));
    color: #fbbf24;
}

.alkkagi-rank-name {
    font-weight: 700;
}

.alkkagi-rank-avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 20px rgba(2, 6, 23, 0.22);
    font-size: 1rem;
    line-height: 1;
}

.alkkagi-rank-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.alkkagi-rank-item:nth-child(-n + 3) .alkkagi-rank-avatar {
    border-color: rgba(251, 191, 36, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 12px 22px rgba(120, 53, 15, 0.16);
}

.alkkagi-rank-score {
    font-weight: 800;
    color: #fbbf24;
}

.alkkagi-room-join {
    min-width: 88px;
}

.alkkagi-floating-sound {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 14px);
    right: calc(env(safe-area-inset-right) + 14px);
    z-index: 30;
    display: none;
    box-shadow: 0 18px 32px rgba(2, 6, 23, 0.28);
    backdrop-filter: blur(10px);
}

@keyframes alkkagi-focus-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.alkkagi-match-active {
    background:
        radial-gradient(circle at top, rgba(30, 64, 175, 0.24), transparent 30%),
        radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.18), transparent 28%),
        #071225;
}

body.alkkagi-room-focus-active .alkkagi-shell {
    max-width: none;
    width: 100%;
    min-height: 100dvh;
    padding: 0;
}

body.alkkagi-room-focus-active .alkkagi-topbar,
body.alkkagi-room-focus-active .alkkagi-hero,
body.alkkagi-room-focus-active .alkkagi-lobby-column,
body.alkkagi-room-focus-active .alkkagi-ranking-panel {
    display: none;
}

body.alkkagi-room-focus-active .alkkagi-layout {
    display: block;
    min-height: 100dvh;
}

body.alkkagi-waiting-active {
    background:
        radial-gradient(circle at top, rgba(14, 165, 233, 0.22), transparent 30%),
        radial-gradient(circle at bottom left, rgba(239, 68, 68, 0.18), transparent 26%),
        #071225;
}

body.alkkagi-waiting-active #activeRoomSection {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
    margin: 0;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    border-radius: 0;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.14), transparent 26%),
        radial-gradient(circle at bottom right, rgba(239, 68, 68, 0.12), transparent 30%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(7, 18, 37, 0.98));
    animation: alkkagi-focus-enter 0.28s ease;
}

body.alkkagi-waiting-active .alkkagi-stage-head {
    width: min(760px, 100%);
    margin: 0 auto;
    align-items: flex-start;
}

body.alkkagi-waiting-active .alkkagi-room-code-box,
body.alkkagi-waiting-active .alkkagi-stage-grid {
    display: none;
}

body.alkkagi-waiting-active .alkkagi-invite-pane {
    display: grid;
    place-items: center;
    min-height: 0;
}

body.alkkagi-waiting-active .alkkagi-invite-surface {
    width: min(760px, 100%);
    padding: clamp(24px, 4vw, 36px);
    box-shadow: 0 34px 60px rgba(2, 6, 23, 0.32);
}

body.alkkagi-waiting-active .alkkagi-invite-copy {
    text-align: center;
}

body.alkkagi-waiting-active .alkkagi-invite-top {
    justify-content: center;
}

body.alkkagi-waiting-active .alkkagi-invite-hint,
body.alkkagi-waiting-active #roomInviteInlineStatus {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

body.alkkagi-waiting-active #roomInviteInlineStatus {
    margin-top: 18px;
}

body.alkkagi-match-active #activeRoomSection {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100dvh;
    margin: 0;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-radius: 0;
    background:
        radial-gradient(circle at top left, rgba(239, 68, 68, 0.14), transparent 24%),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 28%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(7, 18, 37, 0.98));
    animation: alkkagi-focus-enter 0.28s ease;
    overflow: hidden;
}

body.alkkagi-match-active .alkkagi-stage-head {
    align-items: center;
    gap: 18px;
    padding-bottom: 14px;
}

body.alkkagi-match-active .alkkagi-stage-head h2 {
    margin: 10px 0 6px;
    font-size: clamp(1.2rem, 1.9vw, 1.6rem);
}

body.alkkagi-match-active .alkkagi-stage-head p {
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.94rem;
}

body.alkkagi-match-active .alkkagi-room-code-box {
    min-width: 250px;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.52);
    box-shadow: 0 16px 36px rgba(2, 6, 23, 0.28);
}

body.alkkagi-match-active .alkkagi-room-code-box strong {
    font-size: 1.16rem;
    letter-spacing: 0.2em;
}

body.alkkagi-match-active .alkkagi-stage-grid {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(300px, var(--alkkagi-focus-sidebar-width));
    grid-template-rows: minmax(0, 1fr);
    gap: 16px;
    margin-top: 0;
    align-items: stretch;
}

body.alkkagi-match-active .alkkagi-board-pane {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
}

body.alkkagi-match-active .alkkagi-board-shell,
body.alkkagi-match-active .alkkagi-shot-panel {
    width: min(100%, calc((100dvh - var(--alkkagi-focus-board-reserve)) * 1.714));
    max-width: 100%;
}

body.alkkagi-match-active .alkkagi-board-shell {
    margin: 0 auto;
    border-radius: 30px;
    box-shadow:
        inset 0 10px 30px rgba(0, 0, 0, 0.16),
        0 24px 44px rgba(2, 6, 23, 0.34);
}

body.alkkagi-match-active .alkkagi-result-banner {
    left: 50%;
    right: auto;
    top: auto;
    bottom: 18px;
    width: min(540px, calc(100% - 28px));
    transform: translateX(-50%);
    text-align: center;
}

body.alkkagi-match-active .alkkagi-shot-panel {
    margin-top: 12px;
    background: rgba(15, 23, 42, 0.44);
    border-color: rgba(255, 255, 255, 0.08);
}

body.alkkagi-match-active .alkkagi-side-pane {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
    padding: 16px;
    border-radius: 24px;
    background: rgba(15, 23, 42, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 44px rgba(2, 6, 23, 0.22);
    backdrop-filter: blur(16px);
    min-height: 0;
    height: 100%;
    overflow: auto;
}

body.alkkagi-match-active .alkkagi-player-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

body.alkkagi-match-active .alkkagi-player-card,
body.alkkagi-match-active .alkkagi-stat-chip {
    background: rgba(15, 23, 42, 0.46);
}

body.alkkagi-match-active .alkkagi-room-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.alkkagi-match-active .alkkagi-room-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: 10px;
}

body.alkkagi-match-active .alkkagi-room-actions .btn {
    width: 100%;
}

body.alkkagi-match-active .alkkagi-guide-text,
body.alkkagi-match-active .alkkagi-room-inline-status {
    grid-column: 1 / -1;
}

body.alkkagi-match-active .alkkagi-guide-text {
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.54);
}

body.alkkagi-room-focus-active .alkkagi-floating-sound {
    display: inline-flex;
}

.hidden {
    display: none !important;
}

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

    .alkkagi-lobby-column,
    .alkkagi-ranking-panel {
        order: 2;
    }

    #activeRoomSection {
        order: 1;
    }

    .alkkagi-stage-grid {
        grid-template-columns: 1fr;
    }

    .alkkagi-hero {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    :root {
        --alkkagi-focus-board-reserve: 340px;
    }

    body.alkkagi-match-active #activeRoomSection {
        overflow: auto;
    }

    body.alkkagi-match-active .alkkagi-stage-head {
        flex-direction: column;
        align-items: stretch;
    }

    body.alkkagi-waiting-active .alkkagi-stage-head {
        align-items: stretch;
    }

    body.alkkagi-match-active .alkkagi-room-code-box {
        min-width: 0;
        width: 100%;
    }

    body.alkkagi-match-active .alkkagi-stage-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    body.alkkagi-match-active .alkkagi-board-shell,
    body.alkkagi-match-active .alkkagi-shot-panel {
        width: min(100%, calc((100dvh - var(--alkkagi-focus-board-reserve)) * 1.714));
    }

    body.alkkagi-match-active .alkkagi-side-pane {
        height: auto;
        overflow: visible;
    }

    body.alkkagi-match-active .alkkagi-room-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.alkkagi-waiting-active .alkkagi-invite-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    :root {
        --alkkagi-focus-board-reserve: 400px;
    }

    .alkkagi-shell {
        padding: 18px 12px 34px;
    }

    .alkkagi-stage-head,
    .alkkagi-hero-head,
    .alkkagi-panel-head {
        flex-direction: column;
    }

    .alkkagi-room-code-box {
        width: 100%;
    }

    .alkkagi-hero-kpis,
    .alkkagi-room-stats,
    .alkkagi-room-actions {
        grid-template-columns: 1fr;
    }

    .alkkagi-inline-actions,
    .alkkagi-inline-code,
    .alkkagi-room-item,
    .alkkagi-rank-item,
    .alkkagi-room-code-actions {
        grid-template-columns: 1fr;
    }

    .alkkagi-match-badges {
        align-items: flex-start;
        flex-direction: column;
    }

    body.alkkagi-match-active #activeRoomSection {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    body.alkkagi-match-active .alkkagi-room-code-actions,
    body.alkkagi-match-active .alkkagi-room-actions,
    body.alkkagi-match-active .alkkagi-player-stack,
    body.alkkagi-match-active .alkkagi-room-stats {
        grid-template-columns: 1fr;
    }

    body.alkkagi-match-active .alkkagi-board-shell,
    body.alkkagi-match-active .alkkagi-shot-panel {
        width: min(100%, calc((100dvh - var(--alkkagi-focus-board-reserve)) * 1.714));
    }

    body.alkkagi-match-active .alkkagi-board-shell {
        border-radius: 22px;
    }

    body.alkkagi-match-active .alkkagi-player-card {
        padding: 12px;
    }

    body.alkkagi-match-active .alkkagi-result-banner {
        bottom: 12px;
    }

    .alkkagi-invite-code-panel strong {
        font-size: clamp(1.8rem, 10vw, 2.6rem);
        letter-spacing: 0.18em;
        text-indent: 0.18em;
    }

    body.alkkagi-waiting-active #activeRoomSection {
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    body.alkkagi-waiting-active .alkkagi-invite-top {
        flex-direction: column;
    }

    body.alkkagi-waiting-active .alkkagi-invite-surface {
        padding: 20px 16px;
        border-radius: 24px;
    }

    body.alkkagi-waiting-active .alkkagi-invite-actions {
        grid-template-columns: 1fr;
    }

    body.alkkagi-room-focus-active .alkkagi-floating-sound {
        top: auto;
        bottom: calc(env(safe-area-inset-bottom) + 14px);
    }
}

@keyframes alkkagi-board-sheen {
    from {
        transform: translateX(-120%) skewX(-18deg);
    }

    to {
        transform: translateX(220%) skewX(-18deg);
    }
}

@keyframes alkkagi-board-impact {
    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    30% {
        transform: translate3d(1px, -1px, 0);
    }

    62% {
        transform: translate3d(-1px, 1px, 0);
    }
}

.alkkagi-canvas {
    position: relative;
    z-index: 1;
}

.alkkagi-board-shell::before,
.alkkagi-board-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
}

.alkkagi-board-shell::before {
    right: auto;
    width: 34%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}

.alkkagi-board-shell::after {
    background:
        radial-gradient(circle at 50% 52%, transparent 52%, rgba(2, 6, 23, 0.34)),
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 34%, transparent 68%, rgba(255, 255, 255, 0.07));
}

body.alkkagi-match-active #activeRoomSection {
    grid-template-rows: minmax(0, 1fr);
    padding: 0;
    box-sizing: border-box;
}

body.alkkagi-match-active .alkkagi-stage-head {
    position: fixed;
    inset: max(12px, env(safe-area-inset-top)) max(70px, calc(env(safe-area-inset-right) + 70px)) auto max(12px, env(safe-area-inset-left));
    z-index: 26;
    padding: 0;
    pointer-events: none;
}

body.alkkagi-match-active .alkkagi-stage-head-copy {
    display: none;
}

body.alkkagi-match-active .alkkagi-room-code-box {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: max(70px, calc(env(safe-area-inset-right) + 70px));
    z-index: 27;
    width: min(330px, calc(100vw - 96px));
    min-width: 0;
    pointer-events: auto;
    opacity: 0.86;
    backdrop-filter: blur(18px);
    transition: opacity 160ms ease, transform 160ms ease;
}

body.alkkagi-match-active .alkkagi-room-code-box:hover,
body.alkkagi-match-active .alkkagi-room-code-box:focus-within {
    opacity: 1;
    transform: translateY(1px);
}

body.alkkagi-match-active .alkkagi-stage-grid {
    height: 100dvh;
    min-height: 100dvh;
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    padding: max(48px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(92px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
}

body.alkkagi-match-active .alkkagi-board-pane {
    min-height: 100%;
}

body.alkkagi-match-active .alkkagi-board-shell {
    width: min(calc(100vw - 56px), calc((100dvh - 144px) * 1.714), 1640px);
    max-width: calc(100vw - 56px);
    isolation: isolate;
}

body.alkkagi-match-active .alkkagi-board-shell::before {
    opacity: 0.5;
    animation: alkkagi-board-sheen 4.8s ease-in-out infinite;
}

body.alkkagi-match-active .alkkagi-board-shell::after {
    opacity: 0.78;
}

body.alkkagi-my-turn-active .alkkagi-board-shell {
    box-shadow:
        inset 0 10px 30px rgba(0, 0, 0, 0.16),
        0 0 0 1px rgba(251, 191, 36, 0.2),
        0 28px 54px rgba(2, 6, 23, 0.38),
        0 0 46px rgba(251, 191, 36, 0.18);
}

body.alkkagi-resolving-active .alkkagi-board-shell {
    animation: alkkagi-board-impact 620ms ease-in-out infinite;
}

body.alkkagi-finished-active .alkkagi-board-shell::before {
    opacity: 0.78;
    animation-duration: 2.4s;
}

.alkkagi-board-sound {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    display: none;
    background: rgba(2, 6, 23, 0.58);
    color: #f8fafc;
    box-shadow: 0 16px 34px rgba(2, 6, 23, 0.3);
    backdrop-filter: blur(12px);
}

.alkkagi-board-resign,
.alkkagi-board-pause,
.alkkagi-board-resume {
    position: absolute;
    left: 16px;
    z-index: 5;
    display: none;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    appearance: none;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    backdrop-filter: blur(12px);
}

.alkkagi-board-resign {
    top: 16px;
    border: 1px solid rgba(248, 113, 113, 0.48);
    background: rgba(127, 29, 29, 0.78);
    color: #fff7ed;
    box-shadow: 0 16px 34px rgba(127, 29, 29, 0.24);
}

.alkkagi-board-pause {
    top: 64px;
    border: 1px solid rgba(251, 191, 36, 0.5);
    background: rgba(120, 53, 15, 0.8);
    color: #fffbeb;
    box-shadow: 0 16px 34px rgba(120, 53, 15, 0.2);
}

.alkkagi-board-resume {
    top: 112px;
    border: 1px solid rgba(74, 222, 128, 0.48);
    background: rgba(20, 83, 45, 0.82);
    color: #f0fdf4;
    box-shadow: 0 16px 34px rgba(20, 83, 45, 0.2);
}

.alkkagi-board-resign:hover,
.alkkagi-board-resign:focus-visible {
    background: rgba(153, 27, 27, 0.9);
    border-color: rgba(252, 165, 165, 0.78);
}

.alkkagi-board-pause:hover,
.alkkagi-board-pause:focus-visible {
    background: rgba(146, 64, 14, 0.92);
    border-color: rgba(253, 230, 138, 0.82);
}

.alkkagi-board-resume:hover,
.alkkagi-board-resume:focus-visible {
    background: rgba(22, 101, 52, 0.94);
    border-color: rgba(134, 239, 172, 0.82);
}

.alkkagi-board-resign:disabled,
.alkkagi-board-pause:disabled,
.alkkagi-board-resume:disabled {
    cursor: wait;
    opacity: 0.62;
}

body.alkkagi-match-active .alkkagi-board-sound,
.alkkagi-board-shell:fullscreen .alkkagi-board-sound {
    display: inline-flex;
}

body.alkkagi-match-active .alkkagi-board-resign,
body.alkkagi-match-active .alkkagi-board-pause,
body.alkkagi-match-active .alkkagi-board-resume,
.alkkagi-board-shell:fullscreen .alkkagi-board-resign,
.alkkagi-board-shell:fullscreen .alkkagi-board-pause,
.alkkagi-board-shell:fullscreen .alkkagi-board-resume {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.alkkagi-match-active .alkkagi-shot-panel {
    position: fixed;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 24;
    width: min(660px, calc(100vw - 32px));
    margin-top: 0;
    transform: translateX(-50%);
    background: rgba(2, 6, 23, 0.58);
    box-shadow: 0 18px 38px rgba(2, 6, 23, 0.28);
    backdrop-filter: blur(16px);
    pointer-events: none;
}

body.alkkagi-match-active .alkkagi-side-pane {
    position: fixed;
    top: 50%;
    right: max(16px, env(safe-area-inset-right));
    z-index: 23;
    width: min(330px, calc(100vw - 32px));
    max-height: calc(100dvh - 190px);
    height: auto;
    transform: translateY(-50%);
    opacity: 0.78;
    transition: opacity 160ms ease, transform 160ms ease;
}

body.alkkagi-match-active .alkkagi-side-pane:hover,
body.alkkagi-match-active .alkkagi-side-pane:focus-within {
    opacity: 1;
    transform: translateY(-50%) translateX(-2px);
}

body.alkkagi-browser-fullscreen .alkkagi-stage-head,
body.alkkagi-browser-fullscreen .alkkagi-room-code-box,
body.alkkagi-browser-fullscreen .alkkagi-side-pane,
body.alkkagi-browser-fullscreen .alkkagi-shot-panel,
body.alkkagi-browser-fullscreen .alkkagi-floating-sound {
    display: none !important;
}

.alkkagi-board-shell:fullscreen {
    display: grid;
    place-items: center;
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    padding: clamp(8px, 2vw, 28px);
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(circle at 50% 48%, rgba(37, 99, 235, 0.2), transparent 45%),
        linear-gradient(180deg, #020617, #071225);
    box-shadow: none;
}

.alkkagi-board-shell:fullscreen .alkkagi-canvas {
    width: min(calc(100vw - 24px), calc((100vh - 24px) * 1.714));
    max-width: 100%;
    max-height: 100%;
    border-radius: clamp(12px, 2vw, 30px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.alkkagi-board-shell:fullscreen .alkkagi-result-banner {
    z-index: 6;
}

.alkkagi-board-shell:fullscreen .alkkagi-board-resign {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    z-index: 7;
}

@media (max-width: 980px) {
    body.alkkagi-match-active #activeRoomSection {
        overflow: hidden;
    }

    body.alkkagi-match-active .alkkagi-stage-grid {
        padding: max(58px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(118px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    }

    body.alkkagi-match-active .alkkagi-room-code-box {
        top: max(10px, env(safe-area-inset-top));
        left: max(10px, env(safe-area-inset-left));
        right: max(58px, env(safe-area-inset-right));
        width: auto;
        padding: 10px 12px;
    }

    body.alkkagi-match-active .alkkagi-room-code-box .label {
        display: none;
    }

    body.alkkagi-match-active .alkkagi-room-code-box strong {
        font-size: 0.98rem;
    }

    body.alkkagi-match-active .alkkagi-board-shell {
        width: min(calc(100vw - 20px), calc((100dvh - 180px) * 1.714));
        max-width: calc(100vw - 20px);
    }

    body.alkkagi-match-active .alkkagi-board-pane {
        justify-content: flex-start;
    }

    body.alkkagi-match-active .alkkagi-shot-panel {
        bottom: max(12px, env(safe-area-inset-bottom));
        width: min(560px, calc(100vw - 24px));
        padding: 10px 12px;
    }

    body.alkkagi-match-active .alkkagi-side-pane {
        top: auto;
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: max(88px, calc(env(safe-area-inset-bottom) + 88px));
        width: auto;
        max-height: 24dvh;
        padding: 10px;
        transform: none;
    }

    body.alkkagi-match-active .alkkagi-side-pane:hover,
    body.alkkagi-match-active .alkkagi-side-pane:focus-within {
        transform: none;
    }

    body.alkkagi-match-active .alkkagi-guide-text {
        display: none;
    }
}

@media (max-width: 640px) {
    body.alkkagi-match-active .alkkagi-stage-grid {
        padding-bottom: max(104px, env(safe-area-inset-bottom));
    }

    body.alkkagi-match-active .alkkagi-side-pane {
        display: none;
    }

    body.alkkagi-match-active .alkkagi-board-shell {
        width: min(calc(100vw - 16px), calc((100dvh - 128px) * 1.714));
        border-radius: 18px;
    }

    body.alkkagi-match-active .alkkagi-shot-copy span {
        display: none;
    }

    .alkkagi-board-sound {
        top: 10px;
        right: 10px;
    }

    .alkkagi-board-resign,
    .alkkagi-board-pause,
    .alkkagi-board-resume {
        top: 10px;
        left: 10px;
        min-height: 38px;
        padding: 0 13px;
    }

    .alkkagi-board-pause {
        top: 54px;
    }

    .alkkagi-board-resume {
        top: 98px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.alkkagi-match-active .alkkagi-board-shell,
    body.alkkagi-match-active .alkkagi-board-shell::before {
        animation: none;
    }
}
