* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    color-scheme: dark;
    --page: #101216;
    --panel: #181c23;
    --panel-strong: #202731;
    --line: #42505f;
    --text: #f4f7fb;
    --muted: #a6b1bd;
    --cyan: #38bdf8;
    --green: #22c55e;
    --amber: #f59e0b;
    --red: #ef4444;
    --moss: #8fbf9f;
}

body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(16, 18, 22, 0.98), rgba(24, 23, 28, 0.98)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 42px);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    overflow-x: hidden;
}

button,
select,
input {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

.space-home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 12px;
    border: 1px solid rgba(97, 174, 255, 0.42);
    border-radius: 999px;
    background: rgba(5, 12, 24, 0.92);
    color: #eef5ff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    flex: 0 0 auto;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.space-home-link:hover,
.space-home-link:focus-visible {
    border-color: rgba(245, 158, 11, 0.86);
    color: #fde68a;
    outline: none;
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(520px, 1fr) 360px;
    gap: 20px;
    width: min(1500px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px;
}

.play-area,
.sidebar {
    min-width: 0;
}

.top-bar {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.top-bar h1 {
    color: var(--text);
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1;
    letter-spacing: 0;
}

.top-bar p {
    max-width: 760px;
    margin-top: 8px;
    color: var(--muted);
}

.turn-pill {
    flex: 0 0 auto;
    min-width: 118px;
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid rgba(56, 189, 248, 0.65);
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.13);
    color: #e0f7ff;
    font-size: 13px;
    font-weight: 760;
    line-height: 1.2;
    text-align: center;
}

.game-info-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(24, 28, 35, 0.88);
}

.timer-section {
    display: flex;
    flex: 1 1 292px;
    gap: 8px;
    flex-wrap: wrap;
}

.player-timer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 136px;
    min-width: 128px;
    min-height: 36px;
    padding: 7px 10px;
    border-left: 4px solid var(--line);
    border-radius: 8px;
    background: var(--panel-strong);
}

.player-timer.active {
    border-left-color: var(--green);
    background: rgba(34, 197, 94, 0.14);
}

.timer-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

.timer-value {
    margin-left: auto;
    color: var(--cyan);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-weight: 820;
}

.boundary-display {
    min-height: 36px;
    margin-left: auto;
    padding: 7px 10px;
    border-left: 4px solid var(--amber);
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.13);
    color: #fff3cf;
    font-weight: 760;
}

.captured-pieces-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.captured-side {
    min-height: 68px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(24, 28, 35, 0.78);
}

.captured-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    text-transform: uppercase;
}

.captured-icons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-height: 26px;
    margin-top: 8px;
}

.captured-icons .empty-row {
    align-self: center;
    font-size: 11px;
    line-height: 1;
}

.captured-stack {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
}

.captured-stack + .captured-stack {
    margin-left: 3px;
}

.captured-icon {
    position: relative;
    width: 22px;
    height: 22px;
    z-index: var(--stack-index, 0);
    flex: 0 0 auto;
    font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "Arial Unicode MS", sans-serif;
    font-size: 15px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.28);
}

.captured-stack .captured-icon + .captured-icon {
    margin-left: -7px;
}

.board-frame {
    position: relative;
    width: 100%;
    height: min(72vh, 820px);
    min-height: 540px;
    border: 1px solid rgba(56, 189, 248, 0.65);
    border-radius: 8px;
    background: #101216;
    overflow: hidden;
}

.local-file-warning {
    position: absolute;
    inset: 16px;
    z-index: 4;
    display: grid;
    place-content: center;
    gap: 8px;
    padding: 18px;
    border: 1px solid rgba(245, 158, 11, 0.74);
    border-radius: 8px;
    background: rgba(17, 19, 24, 0.92);
    color: #fff7dd;
    text-align: center;
}

.local-file-warning strong {
    color: var(--amber);
    font-size: 18px;
}

.local-file-warning span {
    color: var(--text);
    line-height: 1.45;
}

.local-file-warning code {
    color: var(--cyan);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-weight: 850;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#gameCanvas:active {
    cursor: grabbing;
}

.camera-pad {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    display: none;
    grid-template-columns: repeat(4, 38px);
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(125, 211, 252, 0.34);
    border-radius: 12px;
    background: rgba(5, 10, 18, 0.72);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(10px);
}

body[data-active-board-game="cube"] .camera-pad {
    display: grid;
}

.camera-pad button {
    width: 38px;
    min-height: 34px;
    padding: 0;
    border-radius: 9px;
    border-color: rgba(125, 211, 252, 0.45);
    background: rgba(15, 23, 42, 0.86);
    color: #e0f7ff;
    font-size: 13px;
    line-height: 1;
}

.camera-pad button:hover,
.camera-pad button:focus-visible {
    border-color: rgba(245, 158, 11, 0.86);
    color: #fff7dd;
    outline: none;
}

.move-picker {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid rgba(66, 80, 95, 0.86);
    border-radius: 8px;
    background: rgba(24, 28, 35, 0.9);
}

.move-picker-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    color: var(--cyan);
    font-size: 13px;
    font-weight: 820;
}

.move-options-head {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(66, 80, 95, 0.7);
}

.move-picker-summary {
    color: var(--muted);
    font-size: 12px;
    font-weight: 720;
    text-align: right;
}

.piece-strip,
.move-options {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
    min-height: 30px;
}

.piece-button,
.move-option {
    width: auto;
    min-width: 0;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.piece-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-color: rgba(56, 189, 248, 0.48);
}

.piece-button.active {
    border-color: var(--amber);
    background: rgba(245, 158, 11, 0.18);
    color: #fff7dd;
}

.piece-icon {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1px solid rgba(148, 163, 184, 0.55);
    border-radius: 6px;
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 12px;
    line-height: 1;
    font-weight: 900;
}

.piece-icon.white,
.promotion-icon.white {
    background: #f8fafc;
    color: #101720;
}

.piece-icon.black,
.promotion-icon.black {
    background: #101720;
    color: #f8fafc;
}

.piece-icon.K,
.promotion-icon.K {
    border-radius: 50%;
    border-color: rgba(250, 204, 21, 0.82);
    box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.28);
}

.piece-icon.Q,
.promotion-icon.Q {
    border-color: rgba(244, 114, 182, 0.82);
    box-shadow: inset 0 0 0 1px rgba(244, 114, 182, 0.28);
}

.piece-icon.R,
.promotion-icon.R {
    border-radius: 3px;
    border-color: rgba(96, 165, 250, 0.82);
}

.piece-icon.B,
.promotion-icon.B {
    border-radius: 2px 8px 2px 8px;
    border-color: rgba(52, 211, 153, 0.82);
}

.piece-icon.N,
.promotion-icon.N {
    border-color: rgba(167, 139, 250, 0.82);
    font-style: italic;
}

.piece-icon.P,
.promotion-icon.P {
    border-radius: 50%;
    border-color: rgba(148, 163, 184, 0.72);
}

.piece-coord,
.piece-count {
    color: var(--muted);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 11px;
    font-weight: 800;
}

.move-option {
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.1);
    color: #dcfce7;
    font-family: "Cascadia Mono", "Consolas", monospace;
}

.move-option.capture {
    border-color: rgba(239, 68, 68, 0.7);
    background: rgba(239, 68, 68, 0.13);
    color: #fee2e2;
}

.move-option.pending {
    border-color: var(--amber);
    background: rgba(245, 158, 11, 0.26);
    color: #fff7dd;
}

.empty-row {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    color: var(--muted);
    font-size: 12px;
}

.sidebar {
    align-self: start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(24, 28, 35, 0.94);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.sidebar-header h2 {
    margin-bottom: 0;
}
.sidebar h2,
.panel h3 {
    color: var(--cyan);
    letter-spacing: 0;
}

.sidebar h2 {
    margin-bottom: 14px;
    font-size: 22px;
}

.status-card,
.boundary-info,
.panel {
    border: 1px solid rgba(66, 80, 95, 0.82);
    border-radius: 8px;
    background: rgba(32, 39, 49, 0.76);
}

.status-card {
    display: grid;
    gap: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.status-line {
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
}

.muted {
    color: var(--muted);
}

.control-group {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}

.control-group label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 720;
}

select,
input,
button {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #131821;
    color: var(--text);
}

select,
input {
    padding: 0 11px;
}

button {
    display: inline-grid;
    place-items: center;
    padding: 0 12px;
    font-weight: 760;
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

button:hover,
select:hover {
    border-color: var(--cyan);
    background: #172131;
}

button:active {
    transform: translateY(1px);
}

button:disabled,
select:disabled,
input:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.online-controls {
    display: none;
    gap: 10px;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid rgba(34, 197, 94, 0.55);
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.09);
}

.online-controls.active {
    display: grid;
}

.connection-status {
    padding: 9px;
    border-radius: 8px;
    font-weight: 800;
    text-align: center;
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
}

.connection-status.connecting {
    background: rgba(245, 158, 11, 0.16);
    color: #fde68a;
}

.connection-status.connected {
    background: rgba(34, 197, 94, 0.16);
    color: #bbf7d0;
}

.online-btn.create {
    border-color: rgba(34, 197, 94, 0.7);
}

.online-btn.match {
    border-color: rgba(245, 158, 11, 0.82);
}

.online-btn.join {
    border-color: rgba(56, 189, 248, 0.7);
}

.divider-text {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.room-info {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(17, 19, 24, 0.82);
}

.room-info[hidden] {
    display: none;
}

.room-id-display {
    color: var(--cyan);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-align: center;
    overflow-wrap: anywhere;
}

.online-controls,
.room-info,
.share-link-box {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.share-link-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    gap: 8px;
}

.share-link-input {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-btn {
    min-height: 38px;
}

.boundary-info {
    margin-bottom: 14px;
    padding: 10px;
    color: #d9fbe5;
    font-size: 13px;
    line-height: 1.45;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0;
}

.warning {
    border-color: rgba(245, 158, 11, 0.7);
}

.danger {
    border-color: rgba(239, 68, 68, 0.7);
}

.panel {
    padding: 12px;
    margin-top: 12px;
}

.panel h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.move-history {
    display: grid;
    gap: 6px;
    min-height: 178px;
    max-height: 230px;
    overflow-y: auto;
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 12px;
}

.move-history-item {
    padding: 6px;
    border-left: 3px solid rgba(56, 189, 248, 0.8);
    border-radius: 6px;
    background: rgba(56, 189, 248, 0.08);
}

.chat-panel {
    display: grid;
    gap: 8px;
}

.chat-messages {
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 112px;
    max-height: 180px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 8px;
    background: rgba(7, 12, 18, 0.4);
}

.chat-empty {
    color: var(--muted);
    font-size: 12px;
}

.chat-message {
    max-width: 92%;
    padding: 7px 8px;
    border: 1px solid rgba(56, 189, 248, 0.24);
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.08);
    font-size: 12px;
    line-height: 1.35;
}

.chat-message.mine {
    justify-self: end;
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.1);
}

.chat-meta {
    margin-bottom: 3px;
    color: #a7f3d0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.chat-text {
    color: var(--text);
    overflow-wrap: anywhere;
}

.chat-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.chat-compose input {
    min-width: 0;
}

.rules-text {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.hints-toggle {
    position: static;
    z-index: 30;
    display: flex;
    align-items: center;
    width: max-content;
    max-width: calc(100vw - 24px);
    margin: 12px 20px 20px auto;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(56, 189, 248, 0.65);
    border-radius: 8px;
    background: rgba(24, 28, 35, 0.96);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
}

.hints-toggle label {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.toggle-switch {
    position: relative;
    width: 52px;
    min-height: 28px;
    padding: 0;
    border-radius: 999px;
    background: #343b49;
}

.toggle-switch.active {
    background: var(--green);
}

.toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    transition: transform 140ms ease;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: auto;
    max-width: max-content;
    padding: 4px 7px;
    border: 1px solid rgba(56, 189, 248, 0.42);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.95);
    color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
}

.language-switch .lang-option {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    height: 22px;
    min-height: 0;
    padding: 0 3px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
}

.language-switch .lang-option:hover,
.language-switch .lang-option:focus-visible {
    background: transparent;
    color: #f8fafc;
    outline: none;
}

.language-switch .lang-option.active {
    color: #38bdf8;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.language-switch .lang-option:active {
    transform: none;
}

.language-switch .lang-divider {
    display: inline-flex;
    align-items: center;
    height: 22px;
    color: rgba(203, 213, 225, 0.72);
    font-size: 12px;
    line-height: 1;
}

.promotion-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    place-items: center;
    background: rgba(0, 0, 0, 0.68);
}

.promotion-modal.active {
    display: grid;
}

.promotion-dialog {
    width: min(420px, calc(100vw - 32px));
    padding: 22px;
    border: 1px solid rgba(56, 189, 248, 0.8);
    border-radius: 8px;
    background: var(--panel);
}

.promotion-dialog h3 {
    margin-bottom: 14px;
    color: var(--cyan);
}

.promotion-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.promotion-btn {
    display: grid;
    gap: 4px;
    min-height: 70px;
}

.promotion-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    margin: 0 auto;
    border: 1px solid rgba(148, 163, 184, 0.6);
    border-radius: 50%;
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 18px;
    line-height: 1;
}

.promotion-name {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

@media (max-width: 1040px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .board-frame {
        height: 68vh;
        min-height: 440px;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 12px;
    }

    .top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .game-info-bar {
        align-items: center;
        gap: 6px;
    }

    .turn-pill {
        flex: 0 1 88px;
        min-width: 88px;
        padding-inline: 7px;
        font-size: 12px;
    }

    .timer-section {
        flex: 1 1 170px;
        gap: 6px;
    }

    .player-timer {
        flex: 1 1 82px;
        min-width: 82px;
        gap: 6px;
        padding-inline: 7px;
    }

    .timer-label,
    .timer-value {
        font-size: 12px;
    }

    .boundary-display {
        flex: 1 1 100%;
        margin-left: 0;
        text-align: center;
    }

    .captured-pieces-container,
    .control-grid {
        grid-template-columns: 1fr;
    }

    .board-frame {
        min-height: 360px;
    }

    .camera-pad {
        right: 8px;
        bottom: 8px;
        grid-template-columns: repeat(4, 34px);
        gap: 5px;
        padding: 5px;
    }

    .camera-pad button {
        width: 34px;
        min-height: 32px;
        font-size: 12px;
    }

    .hints-toggle {
        position: static;
        width: fit-content;
        margin: 12px;
    }

}


/* Local robot analysis panels */
.robot-panel {
    border: 1px solid rgba(72, 199, 244, 0.22);
    background: rgba(7, 15, 22, 0.72);
}
.robot-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    align-items: center;
    margin: 0.55rem 0;
}
.robot-row label {
    color: var(--muted, #9fb3c8);
    font-size: 0.92rem;
}
.robot-buttons {
    margin: 0.75rem 0;
}
.robot-analysis {
    max-height: 380px;
    overflow: auto;
    padding: 0.7rem;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.22);
    font-size: 0.88rem;
    line-height: 1.38;
}
.robot-analysis h3, .robot-analysis h4 {
    margin: 0.5rem 0 0.35rem;
}
.robot-analysis ol {
    margin: 0.35rem 0 0.7rem 1.25rem;
    padding: 0;
}
.robot-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.robot-chip {
    display: inline-flex;
    padding: 0.22rem 0.45rem;
    border-radius: 999px;
    background: rgba(72,199,244,0.12);
    border: 1px solid rgba(72,199,244,0.2);
}

.robot-final-flow h4 {
    margin: 0 0 0.45rem;
    color: #e0f2fe;
}

.robot-final-bars {
    display: grid;
    gap: 0.5rem;
    margin: 0.7rem 0;
}

.robot-final-rate-row {
    display: grid;
    grid-template-columns: minmax(64px, 0.6fr) minmax(120px, 1fr) 56px;
    gap: 0.5rem;
    align-items: center;
}

.robot-final-rate-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
}

.robot-final-rate-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.robot-flow-black {
    background: linear-gradient(90deg, #e5e7eb, #94a3b8);
}

.robot-flow-white {
    background: linear-gradient(90deg, #fef3c7, #f2c464);
}

.board-appearance-control select { min-width: 100%; }

/* Compact language icon menu */
.language-switch.compact-language { position: relative; display: inline-flex; align-items: center; gap: 0; padding: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; }
.language-switch.compact-language .language-icon-button { width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent; color: #dff8ff; display: inline-grid; place-items: center; cursor: pointer; box-shadow: none; }
.language-switch.compact-language .language-popover { display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; min-width: 132px; padding: 8px; border: 1px solid rgba(125, 211, 252, 0.34); border-radius: 14px; background: rgba(6, 11, 18, 0.98); box-shadow: 0 18px 38px rgba(0,0,0,.38); }
.language-switch.compact-language:hover .language-popover, .language-switch.compact-language:focus-within .language-popover { display: grid; gap: 6px; }
.language-switch.compact-language .lang-option { width: 100%; justify-content: center; }
.language-switch.compact-language .lang-divider { display: none; }

/* R3 coordinate plane filter */
.r3-filter-control { border-color: rgba(125, 211, 252, 0.24); background: rgba(8, 13, 20, 0.58); }
.r3-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.r3-filter-grid input { min-width: 0; text-align: center; }
