.tetris-launch-tab {
    position: fixed;
    left: 0;
    top: 510px;
    width: 58px;
    min-height: 118px;
    z-index: 2180;
    border: 1px solid rgba(20, 184, 166, 0.9);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: linear-gradient(180deg, #15211f, #121212);
    color: #e7fffb;
    font-weight: 900;
    line-height: 1.05;
    display: none;
    place-content: center;
    gap: 2px;
    box-shadow: 8px 10px 28px rgba(0, 0, 0, 0.38);
}

.tetris-launch-tab span {
    display: block;
    text-align: center;
}

.tetris-launch-tab:hover {
    color: #5eead4;
    background: #1f2b28;
}

.tetris-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(0, 0, 0, 0.72);
}

.tetris-modal-backdrop.open {
    display: flex;
}

.tetris-modal {
    width: min(1420px, calc(100vw - 44px));
    max-height: calc(100vh - 44px);
    overflow: auto;
    border: 1px solid rgba(20, 184, 166, 0.85);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(20, 184, 166, 0.1), transparent 34%),
        linear-gradient(180deg, #151515, #0f1114);
    color: #f8fafc;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.66);
}

.tetris-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.tetris-kicker {
    color: #5eead4;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
}

.tetris-modal h3,
.tetris-modal h4 {
    margin: 0;
    font-weight: 900;
}

.tetris-modal h3 {
    font-size: 1.35rem;
}

.tetris-modal h4 {
    font-size: 0.98rem;
}

.tetris-head-actions,
.tetris-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tetris-pill,
.tetris-close-btn,
.tetris-primary-btn,
.tetris-versus-btn,
.tetris-secondary-btn,
.tetris-danger-btn {
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #1f2933;
    color: #e5eef7;
    font-weight: 800;
    padding: 9px 14px;
}

.tetris-pill.active {
    border-color: #14b8a6;
    background: #0f766e;
    color: #ecfeff;
}

.tetris-close-btn,
.tetris-secondary-btn {
    background: #26313d;
}

.tetris-primary-btn {
    border-color: #22c55e;
    background: #079455;
}

.tetris-versus-btn {
    border-color: #facc15;
    background: #a16207;
    color: #fff7ed;
}

.tetris-danger-btn {
    border-color: #f43f5e;
    background: #be123c;
}

.tetris-shell {
    display: grid;
    grid-template-columns: 180px minmax(340px, 440px) 180px minmax(190px, 240px);
    gap: 16px;
    align-items: start;
    padding: 20px;
}

.tetris-side-card,
.tetris-board-card,
.tetris-versus-card {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(24, 24, 24, 0.92);
    padding: 14px;
}

.tetris-board-card {
    display: grid;
    justify-items: center;
    gap: 12px;
}

.tetris-status-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-weight: 800;
}

#tetris-state-label {
    color: #cbd5e1;
}

#tetris-attack-label {
    color: #facc15;
}

.tetris-canvas-wrap {
    position: relative;
    width: 300px;
    height: 600px;
    border: 1px solid rgba(94, 234, 212, 0.55);
    border-radius: 8px;
    overflow: hidden;
    background: #05080b;
    box-shadow: inset 0 0 28px rgba(20, 184, 166, 0.08);
}

#tetris-board,
#tetris-hold,
#tetris-next,
#tetris-enemy {
    display: block;
    width: 100%;
    background: #071018;
    border-radius: 8px;
}

.tetris-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 8px;
    text-align: center;
    background: rgba(5, 8, 11, 0.7);
}

.tetris-overlay.hidden {
    display: none;
}

.tetris-overlay strong {
    font-size: 1.15rem;
    color: #fff;
}

.tetris-overlay span,
.tetris-mini-help,
.tetris-versus-card p {
    color: #94a3b8;
    font-size: 0.78rem;
}

.tetris-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.tetris-stat-grid div,
.tetris-garbage-meter,
.tetris-controls div {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: #101820;
    padding: 9px;
}

.tetris-stat-grid span,
.tetris-garbage-meter span,
.tetris-controls span {
    display: block;
    color: #94a3b8;
    font-size: 0.72rem;
}

.tetris-stat-grid strong,
.tetris-garbage-meter strong {
    color: #f8fafc;
    font-size: 1rem;
}

.tetris-controls {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.tetris-controls b {
    color: #5eead4;
}

.tetris-versus-card {
    display: none;
}

.tetris-modal.versus .tetris-versus-card {
    display: block;
}

.tetris-versus-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

#tetris-mode-note {
    color: #facc15;
    font-size: 0.74rem;
    font-weight: 800;
}

.tetris-garbage-meter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
}

.tetris-mode-guide {
    color: #a7f3d0;
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: center;
}

.tetris-room-panel {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.tetris-room-panel label {
    display: grid;
    gap: 4px;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 800;
}

.tetris-room-panel label span {
    color: #e2e8f0;
}

.tetris-room-panel input,
.tetris-room-panel select {
    width: 100%;
    min-height: 40px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    background: #08111a;
    color: #f8fafc;
    padding: 8px 10px;
    font-weight: 800;
}

.tetris-room-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#tetris-room-join-btn {
    grid-column: 1 / -1;
}

.tetris-room-actions button,
.tetris-actions button {
    min-height: 40px;
}

.tetris-room-actions button:disabled,
.tetris-actions button:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    filter: grayscale(0.35);
}

.tetris-room-status {
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: 8px;
    background: #101820;
    color: #99f6e4;
    padding: 8px;
    font-size: 0.76rem;
    font-weight: 800;
}

.tetris-room-players {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tetris-room-player {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: #111827;
    color: #e5eef7;
    padding: 5px 7px;
    font-size: 0.72rem;
    font-weight: 800;
}

.tetris-room-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    color: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 900;
    margin-top: 2px;
}

.tetris-room-list-head span {
    color: #94a3b8;
    font-size: 0.72rem;
}

.tetris-room-list {
    display: grid;
    gap: 8px;
    max-height: 188px;
    overflow-y: auto;
    padding-right: 2px;
}

.tetris-room-empty {
    border: 1px dashed rgba(148, 163, 184, 0.28);
    border-radius: 8px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.44);
    padding: 10px;
    font-size: 0.76rem;
    text-align: center;
}

.tetris-room-card {
    display: grid;
    grid-template-columns: 1fr 54px;
    gap: 6px;
    align-items: stretch;
}

.tetris-room-card-main,
.tetris-room-spectate-btn {
    border-radius: 8px;
    border: 1px solid rgba(20, 184, 166, 0.42);
    background: #0b1620;
    color: #f8fafc;
    font-weight: 900;
}

.tetris-room-card-main {
    display: grid;
    gap: 3px;
    text-align: left;
    padding: 9px 10px;
}

.tetris-room-card-main strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tetris-room-card-main span {
    color: #9fb4c8;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tetris-room-card-main:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: rgba(148, 163, 184, 0.2);
}

.tetris-room-spectate-btn {
    border-color: rgba(96, 165, 250, 0.48);
    background: #172033;
    font-size: 0.74rem;
}

.tetris-match-results {
    display: grid;
    gap: 8px;
}

.tetris-result-banner {
    border: 1px solid rgba(250, 204, 21, 0.42);
    border-radius: 8px;
    background: rgba(113, 63, 18, 0.48);
    color: #fef3c7;
    padding: 8px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 900;
}

.tetris-result-list {
    display: grid;
    gap: 6px;
}

.tetris-result-row {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: #111827;
    color: #dbeafe;
    padding: 7px;
    font-size: 0.72rem;
}

.tetris-result-row.alive {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(20, 83, 45, 0.36);
}

.tetris-result-row em {
    color: #93c5fd;
    font-style: normal;
}

.tetris-result-row strong {
    grid-column: 1 / -1;
    color: #f8fafc;
}

body.tetris-open {
    overflow: hidden;
}

body.light-mode .tetris-launch-tab {
    background: #ecfeff;
    color: #0f172a;
}

body.light-mode .tetris-modal {
    background: #f8fafc;
    color: #101828;
}

body.light-mode .tetris-side-card,
body.light-mode .tetris-board-card,
body.light-mode .tetris-versus-card {
    background: #ffffff;
}

body.light-mode .tetris-overlay {
    background: rgba(248, 250, 252, 0.72);
}

@media (max-width: 1100px) {
    .tetris-shell {
        grid-template-columns: 160px minmax(320px, 1fr) 160px;
    }

    .tetris-versus-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .tetris-modal-backdrop {
        padding: 10px;
    }

    .tetris-modal {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }

    .tetris-modal-head,
    .tetris-shell {
        padding: 12px;
    }

    .tetris-modal-head,
    .tetris-shell {
        display: flex;
        flex-direction: column;
    }

    .tetris-canvas-wrap {
        width: min(300px, calc(100vw - 54px));
        height: min(600px, calc((100vw - 54px) * 2));
    }

    .tetris-launch-tab {
        top: 444px;
    }
}
