/* ===== Panel ===== */
.panel,
.modal__dialog {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}

.panel::before,
.modal__dialog::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.3), transparent);
    pointer-events: none;
}

.panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel__header h2,
.modal__header h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.section-kicker {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
}

/* ===== Game Strip ===== */
.game-strip {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.game-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    min-height: 180px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition);
}

.game-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(108, 92, 231, 0.04), transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: rgba(108, 92, 231, 0.3);
    box-shadow: var(--shadow), var(--shadow-glow);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card__cover {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft));
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    flex-shrink: 0;
}

.game-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-card__kicker {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--brand-light);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.game-card__meta h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

.game-card__meta p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.game-card__footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.game-card__footer strong {
    color: var(--brand-light);
    font-size: 13px;
}

/* ===== Filter Section ===== */
.filter-row {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 200px auto;
    align-items: end;
}

.filter-field,
.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-field span,
.form-field span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.filter-field input,
.filter-field select,
.form-field input,
.form-field select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(6, 9, 17, 0.8);
    color: var(--text);
    outline: none;
    font-size: 14px;
    transition: all var(--transition);
}

.filter-field input::placeholder,
.form-field input::placeholder {
    color: var(--muted);
}

.filter-field input:focus,
.filter-field select:focus,
.form-field input:focus,
.form-field select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
    background: rgba(8, 12, 24, 0.95);
}

.game-bind-picker {
    position: relative;
}

.game-bind-picker__selected {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #f3f4f7;
    font-size: 13px;
    line-height: 1.5;
}

.game-bind-picker__selected.is-empty {
    color: var(--muted);
}

.game-bind-picker__results {
    margin-top: 10px;
    max-height: 260px;
    overflow-y: auto;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(8, 11, 20, 0.96);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
}

.game-bind-picker__results[hidden] {
    display: none;
}

.game-bind-picker__empty {
    padding: 14px 16px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.game-bind-picker__option {
    width: 100%;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: transparent;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    color: #f5f6f8;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.game-bind-picker__option:last-child {
    border-bottom: none;
}

.game-bind-picker__option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.game-bind-picker__option:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.game-bind-picker__cover {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.game-bind-picker__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-bind-picker__copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.game-bind-picker__copy strong {
    font-size: 14px;
    font-weight: 600;
    color: #f7f8fa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-bind-picker__meta {
    color: rgba(255, 255, 255, 0.56);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-bind-picker__badge {
    min-width: 64px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.86);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-stack {
    display: grid;
    gap: 12px;
}

.form-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.form-check--panel {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== Buttons ===== */
.btn,
.icon-btn {
    border: 0;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
}

.btn {
    min-height: 44px;
    padding: 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 14px;
    gap: 8px;
}

.btn--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), #8b5cf6);
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.3);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(108, 92, 231, 0.45);
}

.btn--ghost {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.btn--ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.btn--small {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
    border-radius: var(--radius-xs);
}

.btn--accent {
    color: #fff;
    background: linear-gradient(135deg, #00b894, var(--accent));
    box-shadow: 0 8px 24px rgba(0, 206, 201, 0.25);
}

.btn--accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 206, 201, 0.4);
}

.icon-btn {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
}

.icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* ===== Room Grid ===== */
.room-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.room-card {
    position: relative;
    overflow: hidden;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.room-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    opacity: 0;
    transition: opacity var(--transition);
}

.room-card:hover {
    transform: translateY(-3px);
    border-color: rgba(108, 92, 231, 0.25);
    box-shadow: var(--shadow), var(--shadow-glow);
}

.room-card:hover::before {
    opacity: 1;
}

.room-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.room-card__game {
    margin-bottom: 6px;
    color: var(--brand-light);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.room-card__title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.room-card__meta {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.room-card__tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.room-card__footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.room-card__members {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.room-card__members::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--online);
    box-shadow: 0 0 6px rgba(46, 213, 115, 0.4);
}

/* ===== Gift Grid ===== */
.gift-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.gift-card {
    position: relative;
    overflow: hidden;
    padding: 16px 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    color: inherit;
}

.gift-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 192, 72, 0.25);
    box-shadow: 0 12px 30px rgba(255, 192, 72, 0.1);
}

.gift-card__icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--gold-soft);
    font-size: 22px;
}

.gift-card__name {
    font-size: 14px;
    font-weight: 600;
}

.gift-card__desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.gift-card__price {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
}

/* ===== Voice Stage ===== */
.voice-stage {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin-bottom: 14px;
}

.voice-stage__block {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
}

.voice-stage__block::after {
    content: "";
    position: absolute;
    right: -10px;
    bottom: -10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--brand-soft), transparent 70%);
}

.voice-stage strong {
    font-size: 18px;
}

/* ===== Mic Seats (Voice Room) ===== */
.mic-seats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 14px;
    padding: 16px 0;
}

.mic-seat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.mic-seat__avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid var(--line);
    color: var(--muted);
    font-size: 24px;
    position: relative;
    transition: all var(--transition);
}

.mic-seat--active .mic-seat__avatar {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft), 0 0 20px var(--brand-glow);
}

.mic-seat--speaking .mic-seat__avatar {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 0 20px var(--accent-glow);
    animation: speak-pulse 1.5s ease-in-out infinite;
}

@keyframes speak-pulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 20px var(--accent-glow); }
    50% { box-shadow: 0 0 0 5px var(--accent-soft), 0 0 30px var(--accent-glow); }
}

.mic-seat__name {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mic-seat__badge {
    font-size: 10px;
    color: var(--muted);
}

.mic-seat--empty .mic-seat__avatar {
    border-style: dashed;
}

/* ===== Member List ===== */
.member-list {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr;
}

.member-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    transition: all var(--transition);
}

.member-card:hover {
    border-color: rgba(108, 92, 231, 0.15);
    background: rgba(108, 92, 231, 0.03);
}

.member-card__name {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
}

.member-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
}

/* ===== Modal ===== */
.modal[hidden] { display: none; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8vh;
}

.modal__mask {
    position: absolute;
    inset: 0;
    background: rgba(4, 6, 14, 0.78);
    backdrop-filter: blur(10px);
}

.modal__dialog {
    position: relative;
    max-width: 560px;
    width: calc(100% - 40px);
}

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

/* ===== Empty & Status ===== */
.empty-state,
.status-box,
.note-box {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.status-box {
    border-style: solid;
    border-color: var(--line);
}

.note-box {
    border-style: solid;
    border-color: var(--line);
    font-size: 12px;
}

.audio-sink audio {
    width: 100%;
    margin-top: 10px;
}

/* ===== Admin ===== */
.admin-shell,
.admin-app { display: grid; gap: 16px; }
.admin-login-panel { max-width: 480px; }
.admin-workbench {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-table-wrap {
    overflow: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(6, 9, 17, 0.5);
}

.admin-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.admin-table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.02);
}

.admin-table tbody tr:hover {
    background: rgba(108, 92, 231, 0.03);
}

.table-muted {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

#livekitDeployLog {
    white-space: pre-wrap;
    font-family: "Consolas", "SFMono-Regular", "JetBrains Mono", monospace;
    font-size: 12px;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ===== Responsive ===== */
@media (max-width: 1120px) {
    .hero__inner,
    .room-shell,
    .admin-workbench {
        grid-template-columns: 1fr;
    }

    .sub-hero__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .sub-hero__actions {
        justify-content: flex-start;
    }
}

@media (max-width: 860px) {
    .masthead { padding-top: 10px; }

    .masthead__inner {
        border-radius: var(--radius-lg);
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 16px;
    }

    .masthead__nav {
        width: 100%;
    }

    .masthead__nav a {
        flex: 1 1 auto;
        text-align: center;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .hero-stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 720px) {
    .hero h1,
    .sub-hero h1 {
        font-size: 26px;
    }

    .hero__copy,
    .hero__panel,
    .panel,
    .modal__dialog {
        padding: 18px;
        border-radius: var(--radius-lg);
    }

    .hero__actions,
    .room-card__footer,
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn { width: 100%; }
}

@media (max-width: 560px) {
    .masthead__inner,
    .hero__inner,
    .sub-hero__inner,
    .page-shell {
        width: min(100% - 20px, 1280px);
    }

    .hero-stat-grid,
    .game-strip,
    .gift-grid,
    .room-grid,
    .voice-stage {
        grid-template-columns: 1fr;
    }

    .mic-seats {
        grid-template-columns: repeat(3, 1fr);
    }
}
