.omok-shell {
    max-width: 1460px;
    margin: 0 auto;
    padding: 24px 18px 40px;
}

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

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

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

.omok-topbar-copy h1 {
    margin: 4px 0 8px;
    font-size: clamp(1.5rem, 2vw, 2.3rem);
}

.omok-topbar-copy p {
    margin: 0;
    max-width: 620px;
}

.omok-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
}

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

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

.omok-hero-main {
    background:
        radial-gradient(circle at top left, rgba(245, 158, 11, 0.18), transparent 42%),
        linear-gradient(135deg, rgba(120, 53, 15, 0.14), rgba(15, 23, 42, 0.08)),
        var(--card-bg);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

.omok-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;
}

.omok-sfx-toggle {
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.omok-sfx-toggle:hover {
    transform: translateY(-1px);
}

.omok-sfx-toggle.muted {
    border-color: rgba(148, 163, 184, 0.2);
    color: rgba(148, 163, 184, 0.86);
}

.omok-sfx-toggle.is-icon {
    background: rgba(15, 23, 42, 0.74);
}

.omok-sfx-toggle.is-icon.muted {
    background: rgba(15, 23, 42, 0.42);
}

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

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

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

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

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

.omok-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;
}

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

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

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

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

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

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

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

.omok-stage {
    min-width: 0;
    background:
        radial-gradient(circle at top left, rgba(16, 185, 129, 0.1), transparent 26%),
        radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.12), transparent 32%),
        var(--card-bg);
}

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

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

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

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

.omok-state-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    color: #60a5fa;
    font-size: 0.78rem;
    font-weight: 700;
}

.omok-room-code-box {
    min-width: 154px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

.omok-room-code-box .label {
    display: block;
    color: var(--text-sub);
    font-size: 0.74rem;
}

.omok-room-code-box strong {
    display: block;
    margin-top: 6px;
    font-size: 1.3rem;
    letter-spacing: 0.16em;
}

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

.omok-room-code-actions .btn,
.omok-code-copy,
.omok-fullscreen-toggle {
    width: 100%;
}

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

.omok-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(16, 185, 129, 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);
}

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

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

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

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

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

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

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

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

.omok-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;
}

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

.omok-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;
}

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

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

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

.omok-stage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 18px;
    margin-top: 18px;
}

.omok-board-pane {
    position: relative;
}

.omok-board {
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    gap: 2px;
    padding: 12px;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(120, 53, 15, 0.94), rgba(146, 64, 14, 0.92)),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 36px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 36px);
    box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.16);
}

.omok-cell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.omok-cell:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.06);
}

.omok-cell:disabled {
    cursor: default;
}

.omok-cell.star::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(51, 25, 12, 0.66);
    position: absolute;
}

.omok-cell .stone {
    display: block;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
    width: 82%;
    aspect-ratio: 1;
    height: auto;
    border-radius: 999px;
    box-shadow: inset 0 6px 10px rgba(255, 255, 255, 0.18), inset 0 -10px 12px rgba(0, 0, 0, 0.22), 0 8px 16px rgba(0, 0, 0, 0.2);
}

.omok-cell.black .stone {
    background: radial-gradient(circle at 35% 35%, #475569, #020617 72%);
}

.omok-cell.white .stone {
    background: radial-gradient(circle at 35% 35%, #ffffff, #cbd5e1 76%);
    border: 1px solid rgba(148, 163, 184, 0.65);
}

.omok-cell.last-move {
    box-shadow: inset 0 0 0 2px rgba(251, 191, 36, 0.75);
}

.omok-result-banner {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.78);
    color: #f8fafc;
    font-weight: 700;
    line-height: 1.5;
    backdrop-filter: blur(12px);
}

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

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

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

.omok-player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.omok-player-card.active-turn {
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.42), 0 0 0 1px rgba(251, 191, 36, 0.16);
    transform: translateY(-1px);
}

.omok-player-card .stone {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.omok-player-card.black .stone {
    color: #f8fafc;
    background: radial-gradient(circle at 30% 30%, #334155, #020617 75%);
}

.omok-player-card.white .stone {
    color: #1e293b;
    background: radial-gradient(circle at 30% 30%, #ffffff, #dbe4ef 75%);
    border: 1px solid rgba(148, 163, 184, 0.6);
}

.omok-player-card .role {
    color: var(--text-sub);
    font-size: 0.78rem;
}

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

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

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

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

.omok-stat-chip strong {
    display: block;
    margin-top: 4px;
}

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

.omok-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;
}

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

.omok-room-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.omok-match-item,
.omok-rank-item {
    display: grid;
    gap: 8px;
}

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

.omok-match-badge,
.omok-rank-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: #4ade80;
    font-size: 0.74rem;
    font-weight: 700;
}

.omok-match-badge.loss {
    background: rgba(248, 113, 113, 0.14);
    color: #f87171;
}

.omok-match-badge.draw {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
}

.omok-rank-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
}

.omok-rank-place {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    font-weight: 800;
}

.omok-rank-place.top3 {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.85), rgba(251, 191, 36, 0.58));
    color: #1f2937;
}

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

.omok-rank-meta {
    margin-top: 4px;
}

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

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

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

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

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

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

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

body.omok-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(16, 185, 129, 0.12), transparent 30%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(7, 18, 37, 0.98));
    animation: omok-focus-enter 0.28s ease;
}

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

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

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

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

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

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

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

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

body.omok-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(34, 197, 94, 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: omok-focus-enter 0.28s ease;
}

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

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

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

body.omok-match-active .omok-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.omok-match-active .omok-room-code-box strong {
    font-size: 1.16rem;
    letter-spacing: 0.2em;
}

body.omok-match-active .omok-stage-grid {
    height: 100%;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    margin-top: 0;
}

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

body.omok-match-active .omok-board {
    width: min(calc(100dvw - 48px), max(300px, calc(100dvh - 280px)));
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: clamp(10px, 1.4vw, 16px);
    gap: clamp(1px, 0.22vw, 3px);
    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.omok-match-active .omok-cell {
    border-radius: 8px;
}

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

body.omok-match-active .omok-side-pane {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    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);
}

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

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

body.omok-match-active .omok-room-stats {
    align-self: center;
}

body.omok-match-active .omok-room-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    gap: 10px;
    min-width: min(100%, 320px);
    align-self: center;
}

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

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

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

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

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

    #activeRoomSection {
        order: 1;
    }
}

@media (max-width: 980px) {
    .omok-hero {
        grid-template-columns: 1fr;
    }

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

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

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

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

    body.omok-match-active .omok-stage-grid {
        grid-template-rows: auto auto;
    }

    body.omok-match-active .omok-board {
        width: min(calc(100dvw - 34px), max(260px, calc(100dvh - 360px)));
    }

    body.omok-match-active .omok-side-pane {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 720px) {
    .omok-shell {
        padding: 16px 12px 30px;
    }

    .omok-topbar {
        align-items: center;
    }

    .omok-topbar-actions {
        align-self: stretch;
        justify-content: flex-end;
    }

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

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

    .omok-stage-head {
        flex-direction: column;
    }

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

    .omok-room-actions {
        flex-direction: column;
    }

    .omok-room-actions .btn {
        width: 100%;
    }

    .omok-rank-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .omok-rank-score {
        grid-column: 2;
        justify-self: start;
    }

    body.omok-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.omok-match-active .omok-room-code-actions,
    body.omok-match-active .omok-room-actions,
    body.omok-match-active .omok-player-stack,
    body.omok-match-active .omok-room-stats {
        grid-template-columns: 1fr;
    }

    body.omok-match-active .omok-board {
        width: min(calc(100dvw - 24px), max(220px, calc(100dvh - 400px)));
        border-radius: 22px;
    }

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

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

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

    body.omok-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.omok-waiting-active .omok-invite-top {
        flex-direction: column;
    }

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

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