/* ============================================================
   谁是卧底 - 通用组件样式
   按钮 / 输入框 / 卡片 / 弹窗 / 下拉 / 提示条 / 步进器
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 24px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
    user-select: none;
    width: 100%;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--grad-accent);
    color: #2a1a00;
    box-shadow: 0 10px 24px rgba(255, 158, 59, 0.28);
}

.btn-primary:not(:disabled):hover {
    filter: brightness(1.06);
}

.btn-info {
    background: var(--grad-info);
    color: #fff;
    box-shadow: 0 10px 24px rgba(77, 130, 255, 0.3);
}

.btn-danger {
    background: var(--grad-danger);
    color: #fff;
    box-shadow: 0 10px 24px rgba(255, 77, 109, 0.3);
}

.btn-ghost {
    background: var(--card);
    border: 1px solid var(--line-strong);
    color: var(--text-0);
}

.btn-ghost:hover {
    background: var(--card-hover);
}

.btn-sm {
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
    width: auto;
}

.btn-block {
    width: 100%;
}

/* ---------- 表单 ---------- */
.field {
    margin-bottom: 20px;
}

.field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.input,
.textarea {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border-radius: var(--radius-md);
    background: var(--bg-2);
    border: 1px solid var(--line);
    font-size: 16px;
    color: var(--text-0);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.textarea {
    padding: 12px 16px;
    min-height: 90px;
    resize: vertical;
    line-height: 1.5;
}

.input:focus,
.textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-2);
}

.input-center {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 6px;
    text-transform: uppercase;
}

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

/* 分段标题（设置组） */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 26px 0 12px;
}

.section-head .sec-title {
    font-size: 13px;
    color: var(--text-2);
    letter-spacing: 2px;
    font-weight: 600;
}

.section-head .sec-note {
    font-size: 12px;
    color: var(--text-2);
}

/* ---------- 房间信息行 ---------- */
.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .k {
    color: var(--text-2);
    font-size: 14px;
}

.info-row .v {
    font-weight: 600;
    font-size: 15px;
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(5, 8, 16, 0.66);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.25s ease;
}

.modal-overlay.closing {
    animation: fadeOut 0.2s ease both;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.modal {
    width: 100%;
    max-width: 420px;
    max-height: 82vh;
    overflow-y: auto;
    background: var(--bg-1);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: modalIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}

.modal-close {
    width: 34px;
    height: 34px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-2);
    color: var(--text-1);
    font-size: 18px;
}

.modal-close:active {
    background: var(--bg-3);
}

.modal-body {
    color: var(--text-1);
    font-size: 15px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.modal-actions .btn {
    flex: 1;
}

/* ---------- 下拉选择（自定义） ---------- */
.select-wrap {
    position: relative;
}

.select-trigger {
    width: 100%;
    min-height: 52px;
    padding: 0 44px 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-2);
    border: 1px solid var(--line);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.select-trigger.open {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.select-trigger .sel-main {
    font-size: 16px;
    font-weight: 600;
}

.select-trigger .sel-sub {
    font-size: 12px;
    color: var(--text-2);
    display: block;
    line-height: 1.3;
}

.select-chevron {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-2);
    transition: transform 0.2s;
    pointer-events: none;
}

.select-trigger.open + .select-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 120;
    background: var(--bg-1);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 6px;
    animation: modalIn 0.2s ease;
}

.select-menu.up {
    top: auto;
    bottom: calc(100% + 8px);
}

.select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.select-option:hover {
    background: var(--bg-2);
}

.select-option.selected {
    background: var(--accent-soft);
}

.select-option .opt-label {
    font-weight: 600;
    font-size: 15px;
}

.select-option .opt-desc {
    font-size: 12px;
    color: var(--text-2);
}

.select-option .opt-check {
    color: var(--accent);
    flex: none;
}

/* ---------- 步进器（人数选择） ---------- */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 6px;
}

.stepper .step-btn {
    width: 46px;
    height: 46px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-3);
    color: var(--text-0);
    font-size: 22px;
    font-weight: 700;
    transition: background 0.15s, transform 0.1s;
}

.stepper .step-btn:active {
    transform: scale(0.92);
}

.stepper .step-btn:disabled {
    opacity: 0.35;
}

.stepper .step-btn.minus:not(:disabled) {
    color: var(--info);
}

.stepper .step-btn.plus:not(:disabled) {
    color: var(--accent);
}

.stepper .step-value {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
}

.stepper .step-hint {
    font-size: 12px;
    color: var(--text-2);
    text-align: center;
}

/* ---------- 提示条（Toast） ---------- */
.toast-root {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 0;
    pointer-events: none;
}

.toast {
    max-width: 92%;
    padding: 13px 20px;
    border-radius: var(--radius-md);
    background: rgba(20, 26, 44, 0.92);
    border: 1px solid var(--line-strong);
    color: var(--text-0);
    font-size: 14px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.toast.error { border-color: rgba(255, 107, 107, 0.5); }
.toast.success { border-color: rgba(63, 214, 165, 0.5); }

/* ---------- 房间号分享块 ---------- */
.code-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-2);
    border: 1px dashed var(--accent);
    margin: 16px 0;
}

.code-chip .code-text {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 8px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.code-chip .code-copy {
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg-3);
    cursor: pointer;
}

.code-chip .code-copy:active {
    background: var(--bg-1);
}

/* ---------- 玩家卡片网格 ---------- */
.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px;
}

.player-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px solid var(--line);
    transition: transform 0.18s, border-color 0.18s, background 0.18s;
    cursor: pointer;
    user-select: none;
}

.player-card:active {
    transform: scale(0.96);
}

.player-card:hover {
    border-color: var(--line-strong);
}

.player-card.offline {
    opacity: 0.5;
}

.player-card.eliminated {
    opacity: 0.55;
    filter: grayscale(0.9);
}

.player-card.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #10162a;
    flex: none;
    background: var(--grad-accent);
    position: relative;
}

.avatar.g1 { background: linear-gradient(135deg, #ffd27a, #ff9d3b); }
.avatar.g2 { background: linear-gradient(135deg, #7cc4ff, #4d82ff); }
.avatar.g3 { background: linear-gradient(135deg, #7ff0c9, #2fb98e); }
.avatar.g4 { background: linear-gradient(135deg, #ffa3c0, #ff5f8f); }
.avatar.g5 { background: linear-gradient(135deg, #c39bff, #8a5cf6); }
.avatar.g6 { background: linear-gradient(135deg, #ffcf8a, #f79257); }

.avatar .host-badge {
    position: absolute;
    bottom: -3px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--grad-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2a1a00;
    border: 2px solid var(--bg-1);
}

.player-name {
    font-size: 13px;
    font-weight: 600;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-role-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-3);
    color: var(--text-1);
}

.player-role-tag.undercover {
    background: rgba(255, 107, 107, 0.16);
    color: var(--danger);
}

.player-role-tag.civilian {
    background: rgba(63, 214, 165, 0.14);
    color: var(--success);
}

.player-role-tag.out {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-2);
}

.player-state {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-2);
}

.player-state.online { background: var(--success); }
.player-state.offline { background: var(--text-2); }

/* ---------- 徽标 / 标签 ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-2);
    color: var(--text-1);
    border: 1px solid var(--line);
}

.tag.accent {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: transparent;
}