.othello-shell {
    max-width: 1460px;
    margin: 0 auto;
    padding: 24px 18px 40px;
}

.othello-topbar {
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.othello-topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.othello-topbar-copy {
    flex: 1;
    min-width: 0;
}

.othello-topbar-copy h1 {
    margin: 4px 0 8px;
    font-size: clamp(1.5rem, 2vw, 2.3rem);
}

.othello-topbar-copy p {
    margin: 0;
    max-width: 620px;
}

.othello-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;
}

.othello-hero {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

.othello-hero-main,
.othello-hero-side,
.othello-card-panel,
.othello-stage {
    padding: 18px;
    border-radius: 24px;
}

.othello-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);
}

.othello-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);
}

.othello-hero-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.othello-kicker {
    font-size: 0.78rem;
    color: var(--text-sub);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.othello-student-label {
    margin-top: 6px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.othello-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;
}

.othello-hero-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.othello-kpi {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.othello-kpi .label {
    display: block;
    color: var(--text-sub);
    font-size: 0.76rem;
}

.othello-kpi strong {
    display: block;
    margin-top: 6px;
    font-size: 1.08rem;
}

.othello-side-title {
    font-size: 1.06rem;
    font-weight: 800;
    color: var(--text-main);
}

.othello-side-note {
    margin-top: 8px;
    color: var(--text-sub);
    line-height: 1.55;
}

.othello-inline-actions,
.othello-inline-code {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.othello-inline-actions {
    grid-template-columns: minmax(0, 1fr) auto;
}

.othello-practice-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.othello-inline-code {
    grid-template-columns: minmax(0, 1fr) auto;
}

.othello-compact-select,
.othello-inline-code input {
    width: 100%;
}

.othello-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;
}

.othello-tournament-invite {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px;
}

.othello-tournament-invite.hidden {
    display: none;
}

.othello-tournament-invite__scrim {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgba(2, 6, 23, 0.68);
    cursor: pointer;
}

.othello-tournament-invite__card {
    position: relative;
    z-index: 1;
    width: min(460px, 100%);
    padding: 22px;
    border-radius: 22px;
    border: 1px solid rgba(251, 191, 36, 0.28);
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.38);
    color: #f8fafc;
}

.othello-tournament-invite__eyebrow {
    color: #fbbf24;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
}

.othello-tournament-invite__card h2 {
    margin: 8px 0 8px;
    font-size: 1.35rem;
    line-height: 1.25;
}

.othello-tournament-invite__card p {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.55;
}

.othello-tournament-invite__meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.othello-tournament-invite__meta span {
    min-width: 0;
    color: #e2e8f0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.othello-tournament-invite__meta strong {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #fde68a;
    letter-spacing: 0.12em;
}

.othello-tournament-invite__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.othello-sfx-toggle {
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.othello-sfx-toggle:hover {
    transform: translateY(-1px);
}

.othello-sfx-toggle.muted {
    border-color: rgba(148, 163, 184, 0.2);
    color: rgba(148, 163, 184, 0.86);
}

.othello-sfx-toggle.is-icon {
    background: rgba(15, 23, 42, 0.74);
}

.othello-sfx-toggle.is-icon.muted {
    background: rgba(15, 23, 42, 0.42);
}

.othello-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr) minmax(300px, 0.85fr);
    gap: 16px;
    align-items: start;
}

.othello-layout:has(#activeRoomSection.hidden) {
    grid-template-columns: minmax(0, 1fr);
}

.othello-lobby-column {
    display: grid;
    gap: 16px;
}

.othello-ranking-panel {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: 820px;
    background:
        linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(59, 130, 246, 0.06) 42%, rgba(15, 23, 42, 0)),
        linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(10, 18, 32, 0.94)),
        var(--card-bg);
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.16);
}

.othello-ranking-panel::before,
.othello-ranking-panel::after {
    content: "";
    display: none;
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.othello-ranking-panel::before {
    inset: -80px auto auto -70px;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.22), transparent 68%);
    opacity: 0.9;
}

.othello-ranking-panel::after {
    inset: auto -70px -90px auto;
    width: 240px;
    height: 240px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
    opacity: 0.78;
}

.othello-ranking-panel > * {
    position: relative;
    z-index: 1;
}

.othello-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.othello-panel-head h3 {
    margin: 0;
    font-size: 1.02rem;
}

.othello-panel-head p {
    margin: 6px 0 0;
}

.othello-ranking-panel .othello-panel-head {
    margin: -18px -18px 18px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(15, 23, 42, 0)),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
}

.othello-ranking-panel .othello-panel-head h3 {
    font-size: 1.18rem;
    color: #f8fafc;
}

.othello-ranking-panel .othello-panel-head p {
    max-width: 280px;
    color: rgba(226, 232, 240, 0.8);
}

.othello-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;
}

.othello-list {
    display: grid;
    gap: 10px;
}

.othello-show-more-btn {
    width: 100%;
    margin-top: 12px;
    justify-content: center;
}

.othello-ranking-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 12px;
}

.othello-layout:has(#activeRoomSection.hidden) .othello-ranking-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.othello-layout:has(#activeRoomSection.hidden) .othello-lobby-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.othello-ranking-card {
    min-width: 0;
    contain: layout paint;
    content-visibility: auto;
    contain-intrinsic-size: 250px;
    padding: 14px;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
        rgba(8, 15, 30, 0.48);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 18px rgba(2, 6, 23, 0.1);
}

.othello-ranking-card.is-primary {
    border-color: rgba(251, 191, 36, 0.18);
    background:
        linear-gradient(135deg, rgba(251, 191, 36, 0.11), rgba(59, 130, 246, 0.035)),
        rgba(8, 15, 30, 0.56);
}

.othello-ranking-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.othello-ranking-card-head h4 {
    margin: 0;
    color: #f8fafc;
    font-size: 0.94rem;
    line-height: 1.25;
}

.othello-ranking-card-head p {
    margin: 5px 0 0;
    color: rgba(203, 213, 225, 0.72);
    font-size: 0.78rem;
    line-height: 1.35;
}

.othello-ranking-card-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: rgba(226, 232, 240, 0.88);
    font-size: 0.7rem;
    font-weight: 800;
}

.othello-empty {
    padding: 18px 14px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.26);
    color: var(--text-sub);
    text-align: center;
}

.othello-room-item,
.othello-match-item,
.othello-rank-item {
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.othello-room-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.othello-room-item h4,
.othello-match-item h4 {
    margin: 0;
    font-size: 0.98rem;
}

.othello-room-meta,
.othello-match-meta,
.othello-rank-meta {
    margin-top: 6px;
    color: var(--text-sub);
    font-size: 0.84rem;
    line-height: 1.5;
}

.othello-room-join {
    min-width: 88px;
}

.othello-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);
}

.othello-stage-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.othello-stage-head-copy {
    min-width: 0;
}

.othello-stage-head h2 {
    margin: 8px 0 8px;
    font-size: 1.25rem;
}

.othello-stage-head p {
    margin: 0;
}

.othello-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;
}

.othello-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;
}

.othello-room-code-box .label {
    display: block;
    color: var(--text-sub);
    font-size: 0.74rem;
}

.othello-room-code-box strong {
    display: block;
    margin-top: 6px;
    font-size: 1.3rem;
    letter-spacing: 0.16em;
}

.othello-stage-action-stack {
    display: grid;
    gap: 10px;
    min-width: min(100%, 260px);
}

.othello-stage-action-stack .othello-room-code-box {
    width: 100%;
}

.othello-room-code-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.othello-room-code-actions .btn,
.othello-code-copy,
.othello-fullscreen-toggle {
    width: 100%;
}

.othello-invite-pane {
    margin-top: 18px;
}

.othello-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);
}

.othello-invite-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.othello-invite-visibility,
.othello-invite-stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.othello-invite-visibility {
    background: rgba(251, 191, 36, 0.16);
    color: #fcd34d;
}

.othello-invite-stage {
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
}

.othello-invite-copy {
    margin-top: 18px;
}

.othello-invite-kicker {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: #93c5fd;
    font-weight: 700;
}

.othello-invite-copy h3 {
    margin: 10px 0 10px;
    font-size: clamp(1.6rem, 2.8vw, 2.5rem);
    line-height: 1.14;
}

.othello-invite-copy p,
.othello-invite-hint {
    color: rgba(226, 232, 240, 0.78);
    line-height: 1.65;
}

.othello-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;
}

.othello-invite-code-panel .label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-sub);
}

.othello-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;
}

.othello-invite-hint {
    margin-top: 18px;
    font-size: 0.96rem;
}

.othello-invite-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.othello-invite-actions .btn {
    width: 100%;
}

.othello-stage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 18px;
    margin-top: 18px;
}

.othello-board-pane {
    position: relative;
}

.othello-board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    aspect-ratio: 1;
    padding: 10px;
    border-radius: 20px;
    overflow: hidden;
    background:
        radial-gradient(circle at 24% 18%, rgba(16, 185, 129, 0.24), transparent 28%),
        linear-gradient(135deg, #166534 0%, #15803d 48%, #065f46 100%);
    box-shadow:
        inset 0 12px 28px rgba(2, 44, 34, 0.34),
        inset 0 -12px 24px rgba(2, 20, 14, 0.24),
        0 18px 32px rgba(2, 6, 23, 0.2);
}

.othello-board::after {
    content: "";
    position: absolute;
    z-index: 0;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 18px),
        repeating-linear-gradient(0deg, rgba(2, 44, 34, 0.12) 0 1px, transparent 1px 24px);
    mix-blend-mode: soft-light;
    pointer-events: none;
}

.othello-cell {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: 1px solid rgba(3, 44, 34, 0.68);
    border-radius: 0;
    background: rgba(21, 128, 61, 0.42);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    perspective: 640px;
    transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.othello-board.interactive .othello-cell:not(.black):not(.white):hover,
.othello-board.interactive .othello-cell:not(.black):not(.white):focus-visible {
    background: rgba(52, 211, 153, 0.32);
    box-shadow: inset 0 0 0 2px rgba(250, 204, 21, 0.42);
}

.othello-cell[aria-disabled="true"] {
    cursor: default;
    opacity: 1;
}

.othello-board:not(.interactive) .othello-cell:not(.black):not(.white) {
    pointer-events: none;
}

.othello-cell.legal-move::after {
    content: "";
    position: absolute;
    z-index: 0;
    width: 24%;
    height: 24%;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.32);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.42);
}

.othello-cell .stone {
    display: block;
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
    width: min(84%, 54px);
    aspect-ratio: 1;
    height: auto;
    border-radius: 999px;
    overflow: visible;
    transform-style: preserve-3d;
}

.othello-cell .stone-face {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow:
        inset 0 6px 10px rgba(255, 255, 255, 0.18),
        inset 0 -10px 12px rgba(0, 0, 0, 0.24),
        0 7px 12px rgba(38, 17, 7, 0.32);
}

.othello-cell .stone-face--previous {
    transform: rotateX(180deg);
}

.othello-cell.black .stone-face--current,
.othello-cell.flip-from-black .stone-face--previous {
    background: radial-gradient(circle at 34% 30%, #64748b 0%, #111827 42%, #020617 76%);
}

.othello-cell.white .stone-face--current,
.othello-cell.flip-from-white .stone-face--previous {
    background: radial-gradient(circle at 34% 30%, #ffffff 0%, #edf2f7 46%, #cbd5e1 82%);
    border: 1px solid rgba(100, 116, 139, 0.68);
    box-shadow:
        inset 0 5px 9px rgba(255, 255, 255, 0.54),
        inset 0 -9px 12px rgba(100, 116, 139, 0.22),
        0 7px 12px rgba(38, 17, 7, 0.24);
}

.othello-cell.is-new-stone .stone {
    animation: othello-stone-place 0.28s cubic-bezier(0.2, 0.86, 0.36, 1.24);
}

.othello-cell.is-flipping .stone {
    animation: othello-stone-flip 0.46s cubic-bezier(0.2, 0.78, 0.28, 1);
}

@keyframes othello-stone-place {
    0% {
        opacity: 0;
        transform: scale(0.52);
    }

    72% {
        opacity: 1;
        transform: scale(1.08);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes othello-stone-flip {
    0% {
        transform: rotateX(-180deg) translateY(-2px) scale(1.02);
        filter: brightness(1);
    }

    50% {
        transform: rotateX(-90deg) translateY(-5px) scale(1.05);
        filter: brightness(1.12);
    }

    100% {
        transform: rotateX(0deg) translateY(0) scale(1);
        filter: brightness(1);
    }
}

.othello-cell.last-move::before {
    content: "";
    position: absolute;
    z-index: 4;
    inset: 5%;
    border: 2px solid rgba(250, 204, 21, 0.86);
    border-radius: 999px;
    pointer-events: none;
}

.othello-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);
}

.othello-result-banner.is-paused {
    background: rgba(14, 116, 144, 0.92);
    border: 1px solid rgba(125, 211, 252, 0.44);
}

.othello-side-pane {
    display: grid;
    gap: 14px;
}

.othello-side-pane > * {
    min-width: 0;
}

.othello-player-stack {
    display: grid;
    gap: 10px;
}

.othello-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);
}

.othello-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);
}

.othello-player-card .stone {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.othello-player-card.black .stone {
    color: #f8fafc;
    background: radial-gradient(circle at 30% 30%, #334155, #020617 75%);
}

.othello-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);
}

.othello-player-card .role {
    color: var(--text-sub);
    font-size: 0.78rem;
}

.othello-player-card .name {
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
}

.othello-room-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.othello-stat-chip {
    padding: 12px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.othello-stat-chip span {
    display: block;
    color: var(--text-sub);
    font-size: 0.72rem;
}

.othello-stat-chip strong {
    display: block;
    margin-top: 4px;
}

.othello-timer-chip.warning {
    border-color: rgba(251, 191, 36, 0.38);
    background: rgba(245, 158, 11, 0.16);
}

.othello-timer-chip.warning strong {
    color: #facc15;
}

.othello-timer-chip.expired {
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.14);
}

.othello-timer-chip.expired strong {
    color: #fca5a5;
}

.othello-guide-text {
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.34);
    line-height: 1.6;
    color: var(--text-main);
}

.othello-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;
}

.othello-room-inline-status.is-error {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(252, 165, 165, 0.28);
    color: #fecaca;
}

.othello-room-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.othello-stage-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.othello-stage-actions .btn:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.othello-stage-actions .btn.is-pass-ready {
    border-color: rgba(250, 204, 21, 0.92);
    background: linear-gradient(180deg, rgba(250, 204, 21, 0.26), rgba(245, 158, 11, 0.2));
    color: #fef3c7;
    box-shadow:
        0 0 0 2px rgba(250, 204, 21, 0.22),
        0 10px 28px rgba(245, 158, 11, 0.24);
    animation: othello-pass-ready-pulse 1.18s ease-in-out infinite;
}

@keyframes othello-pass-ready-pulse {
    0%,
    100% {
        box-shadow:
            0 0 0 2px rgba(250, 204, 21, 0.2),
            0 10px 28px rgba(245, 158, 11, 0.22);
    }

    50% {
        box-shadow:
            0 0 0 5px rgba(250, 204, 21, 0.34),
            0 12px 34px rgba(245, 158, 11, 0.34);
    }
}

@media (prefers-reduced-motion: reduce) {
    .othello-stage-actions .btn.is-pass-ready {
        animation: none;
    }

    .othello-cell.is-new-stone .stone,
    .othello-cell.is-flipping .stone {
        animation: none;
    }
}

.othello-match-item,
.othello-rank-item {
    display: grid;
    gap: 8px;
}

.othello-match-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.othello-match-badge,
.othello-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;
}

.othello-match-badge.loss {
    background: rgba(248, 113, 113, 0.14);
    color: #f87171;
}

.othello-match-badge.draw {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
}

.othello-ranking-list {
    gap: 10px;
}

.othello-ranking-panel .othello-empty {
    background: rgba(7, 18, 37, 0.46);
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.08);
}

.othello-rank-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
}

.othello-ranking-list .othello-rank-item {
    position: relative;
    overflow: hidden;
    contain: layout paint;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 12px 12px 14px;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
        rgba(8, 15, 30, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
    transition: border-color 0.16s ease;
}

.othello-ranking-list .othello-rank-item::before {
    content: "";
    position: absolute;
    inset: 14px auto 14px 0;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.92), rgba(59, 130, 246, 0.54));
    opacity: 0.62;
}

.othello-ranking-list .othello-rank-item:hover {
    border-color: rgba(147, 197, 253, 0.18);
}

.othello-ranking-list .othello-rank-item:nth-child(-n + 3) {
    background:
        linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(59, 130, 246, 0.04)),
        rgba(8, 15, 30, 0.68);
    border-color: rgba(251, 191, 36, 0.16);
}

.othello-ranking-list .othello-rank-item:nth-child(1) {
    transform: none;
    background:
        linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(59, 130, 246, 0.08)),
        rgba(8, 15, 30, 0.76);
    border-color: rgba(251, 191, 36, 0.24);
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.08);
}

.othello-ranking-list .othello-rank-item:nth-child(1)::before {
    width: 5px;
    opacity: 0.96;
}

.othello-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;
}

.othello-ranking-list .othello-rank-place {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.82));
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.othello-rank-place.top3 {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.85), rgba(251, 191, 36, 0.58));
    color: #1f2937;
}

.othello-ranking-list .othello-rank-place.top3 {
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.34), transparent 36%),
        linear-gradient(135deg, rgba(245, 158, 11, 0.94), rgba(250, 204, 21, 0.72));
    color: #111827;
    border-color: rgba(255, 243, 176, 0.46);
}

.othello-rank-name {
    font-weight: 700;
}

.othello-ranking-list .othello-rank-name {
    font-size: 0.9rem;
    letter-spacing: 0;
    color: #f8fafc;
}

.othello-ranking-list .othello-rank-main {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.othello-ranking-list .othello-rank-copy {
    min-width: 0;
}

.othello-ranking-list .othello-rank-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    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);
    font-size: 1.05rem;
    line-height: 1;
}

.othello-ranking-list .othello-rank-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.othello-ranking-list .othello-rank-item:nth-child(-n + 3) .othello-rank-avatar {
    border-color: rgba(251, 191, 36, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.othello-rank-meta {
    margin-top: 4px;
}

.othello-ranking-list .othello-rank-meta {
    margin-top: 5px;
    color: rgba(203, 213, 225, 0.74);
    font-size: 0.76rem;
}

.othello-ranking-list .othello-rank-score {
    min-width: 68px;
    padding: 8px 9px;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.78));
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
    font-size: 0.76rem;
    letter-spacing: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.othello-ranking-list .othello-rank-item:nth-child(-n + 3) .othello-rank-score {
    background:
        linear-gradient(180deg, rgba(120, 53, 15, 0.78), rgba(15, 23, 42, 0.82));
    border-color: rgba(251, 191, 36, 0.2);
    color: #fef3c7;
}

.othello-ranking-list .othello-rank-item:nth-child(1) .othello-rank-score {
    min-width: 74px;
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.92), rgba(59, 130, 246, 0.68));
    border-color: rgba(191, 219, 254, 0.3);
    color: #fff7ed;
}

@keyframes othello-focus-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.othello-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.othello-room-focus-active .othello-shell {
    max-width: none;
    min-height: 100dvh;
    padding: 0;
}

body.othello-room-focus-active .othello-topbar,
body.othello-room-focus-active .othello-hero,
body.othello-room-focus-active .othello-lobby-column,
body.othello-room-focus-active .othello-ranking-panel {
    display: none;
}

body.othello-room-focus-active .othello-layout {
    display: block;
    min-height: 100dvh;
}

body.breaktime-board-page.othello-room-focus-active .othello-shell {
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    padding: 0;
}

body.breaktime-board-page.othello-room-focus-active .othello-topbar,
body.breaktime-board-page.othello-room-focus-active .othello-hero,
body.breaktime-board-page.othello-room-focus-active .othello-lobby-column,
body.breaktime-board-page.othello-room-focus-active .othello-ranking-panel {
    display: none;
}

body.breaktime-board-page.othello-room-focus-active .othello-layout {
    display: block;
    width: 100%;
    min-height: 100dvh;
}

body.othello-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.othello-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: othello-focus-enter 0.28s ease;
}

body.othello-waiting-active .othello-stage-head {
    width: min(760px, 100%);
    margin: 0 auto;
    align-items: flex-start;
}

body.othello-waiting-active .othello-stage-action-stack,
body.othello-waiting-active .othello-stage-grid {
    display: none;
}

body.othello-waiting-active .othello-invite-pane {
    display: grid;
    place-items: center;
    min-height: 0;
}

body.othello-waiting-active .othello-invite-surface {
    width: min(760px, 100%);
    padding: clamp(24px, 4vw, 36px);
    box-shadow: 0 34px 60px rgba(2, 6, 23, 0.32);
}

body.othello-waiting-active .othello-invite-copy {
    text-align: center;
}

body.othello-waiting-active .othello-invite-top {
    justify-content: center;
}

body.othello-waiting-active .othello-invite-hint,
body.othello-waiting-active #roomInviteInlineStatus {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

body.othello-waiting-active #roomInviteInlineStatus {
    margin-top: 18px;
}

body.othello-match-active #activeRoomSection {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "match-head board"
        "match-info board";
    column-gap: 18px;
    row-gap: 14px;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    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: othello-focus-enter 0.28s ease;
}

body.othello-match-active .othello-stage-head {
    grid-area: match-head;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    align-self: stretch;
    width: 100%;
    gap: 12px;
    padding: 14px;
}

body.othello-match-active .othello-stage-head h2 {
    margin: 8px 0 6px;
    font-size: 1.15rem;
}

body.othello-match-active .othello-stage-head p {
    color: rgba(226, 232, 240, 0.78);
    font-size: 0.86rem;
}

body.othello-match-active .othello-room-code-box {
    min-width: 0;
    width: 100%;
    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.othello-match-active .othello-stage-action-stack {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

body.othello-match-active .othello-room-code-box strong {
    font-size: 1.16rem;
    letter-spacing: 0.2em;
}

body.othello-match-active .othello-stage-grid {
    display: contents;
    height: auto;
    min-height: 0;
    margin-top: 0;
}

body.othello-match-active .othello-board-pane {
    grid-area: board;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-height: 0;
    min-width: 0;
}

body.othello-match-active .othello-board {
    width: min(100%, calc(100dvh - 48px));
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 10px;
    border-radius: 24px;
    box-shadow:
        inset 0 12px 30px rgba(2, 44, 34, 0.32),
        0 24px 44px rgba(2, 6, 23, 0.34);
}

body.othello-match-active .othello-cell {
    border-radius: 0;
}

body.othello-match-active .othello-cell .stone {
    width: min(86%, 64px);
}

body.othello-match-active .othello-result-banner {
    left: 50%;
    right: auto;
    bottom: 18px;
    width: min(540px, calc(100% - 28px));
    transform: translateX(-50%);
    text-align: center;
}

body.othello-match-active .othello-side-pane {
    grid-area: match-info;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
    align-content: start;
    align-self: stretch;
    min-height: 0;
    overflow-y: auto;
    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.othello-match-active .othello-player-stack {
    grid-template-columns: 1fr;
    gap: 12px;
}

body.othello-match-active .othello-player-card,
body.othello-match-active .othello-stat-chip {
    background: rgba(15, 23, 42, 0.46);
}

body.othello-match-active .othello-room-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-self: center;
}

body.othello-match-active .othello-room-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 10px;
    align-self: center;
}

body.othello-match-active .othello-room-actions .btn {
    width: 100%;
}

body.othello-match-active .othello-guide-text,
body.othello-match-active .othello-room-inline-status {
    grid-column: 1 / -1;
}

body.othello-match-active .othello-guide-text {
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.54);
}

@media (max-width: 899px), (orientation: portrait) {
    body.othello-match-active #activeRoomSection {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "match-head"
            "board"
            "match-info";
        height: auto;
        min-height: 100dvh;
        overflow: visible;
        gap: 16px;
    }

    body.othello-match-active .othello-stage-head {
        align-items: stretch;
    }

    body.othello-match-active .othello-stage-action-stack {
        grid-template-columns: 1fr;
        width: 100%;
        min-width: 0;
    }

    body.othello-match-active .othello-board {
        width: min(calc(100dvw - 34px), max(260px, calc(100dvh - 360px)));
    }

    body.othello-match-active .othello-side-pane {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        align-self: auto;
        overflow-y: visible;
    }

    body.othello-match-active .othello-player-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.othello-match-active .othello-room-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .othello-layout {
        grid-template-columns: 1fr;
    }

    .othello-lobby-column {
        order: 2;
    }

    .othello-layout:has(#activeRoomSection.hidden) .othello-ranking-board,
    .othello-ranking-board {
        grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    }

    .othello-ranking-panel {
        order: 3;
    }

    .othello-layout:has(#activeRoomSection.hidden) .othello-lobby-column {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #activeRoomSection {
        order: 1;
    }
}

@media (max-width: 980px) {
    .othello-hero {
        grid-template-columns: 1fr;
    }

    .othello-stage-grid {
        grid-template-columns: 1fr;
    }

    body.othello-waiting-active .othello-stage-head {
        align-items: stretch;
    }

    body.othello-waiting-active .othello-invite-actions {
        grid-template-columns: 1fr;
    }

    .othello-tournament-invite__meta {
        grid-template-columns: 1fr;
    }

    .othello-tournament-invite__actions {
        flex-direction: column-reverse;
    }

    .othello-tournament-invite__actions .btn {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .othello-shell {
        padding: 16px 12px 30px;
    }

    .othello-topbar {
        align-items: center;
    }

    .othello-topbar-actions {
        align-self: stretch;
        justify-content: flex-end;
    }

    .othello-hero-kpis,
    .othello-room-stats {
        grid-template-columns: 1fr;
    }

    .othello-inline-actions,
    .othello-practice-actions,
    .othello-inline-code,
    .othello-room-item {
        grid-template-columns: 1fr;
    }

    .othello-stage-head {
        flex-direction: column;
    }

    .othello-room-code-box {
        width: 100%;
    }

    .othello-room-actions {
        flex-direction: column;
    }

    .othello-room-actions .btn {
        width: 100%;
    }

    .othello-ranking-panel .othello-panel-head {
        margin: -18px -18px 16px;
        padding: 18px 16px 14px;
    }

    .othello-ranking-panel .othello-panel-head p {
        max-width: none;
    }

    .othello-ranking-board {
        grid-template-columns: 1fr;
    }

    .othello-layout:has(#activeRoomSection.hidden) .othello-lobby-column {
        grid-template-columns: 1fr;
    }

    .othello-ranking-list .othello-rank-item,
    .othello-rank-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .othello-ranking-list .othello-rank-item:nth-child(1) {
        transform: none;
    }

    .othello-ranking-list .othello-rank-place {
        width: 42px;
        height: 42px;
        border-radius: 16px;
    }

    .othello-ranking-list .othello-rank-avatar {
        width: 40px;
        height: 40px;
        border-radius: 14px;
    }

    .othello-ranking-list .othello-rank-score,
    .othello-rank-score {
        grid-column: 2;
        justify-self: start;
    }

    body.othello-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.othello-match-active .othello-room-code-actions,
    body.othello-match-active .othello-room-actions,
    body.othello-match-active .othello-player-stack,
    body.othello-match-active .othello-room-stats {
        grid-template-columns: 1fr;
    }

    body.othello-match-active .othello-board {
        width: min(calc(100dvw - 24px), max(220px, calc(100dvh - 400px)));
        border-radius: 22px;
    }

    body.othello-match-active .othello-player-card {
        padding: 12px;
    }

    body.othello-match-active .othello-result-banner {
        bottom: 12px;
    }

    .othello-invite-code-panel strong {
        font-size: clamp(1.8rem, 10vw, 2.6rem);
        letter-spacing: 0.18em;
        text-indent: 0.18em;
    }

    body.othello-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.othello-waiting-active .othello-invite-top {
        flex-direction: column;
    }

    body.othello-waiting-active .othello-invite-surface {
        padding: 20px 16px;
        border-radius: 24px;
    }

    body.othello-waiting-active .othello-invite-actions {
        grid-template-columns: 1fr;
    }
}
