/* ================================================================
   线上剧本杀主持系统 — 全局样式 v2
   设计原则: 移动端优先, 响应式, 深色游戏风格
   ================================================================ */

/* === Reset & Variables === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:        #0f0e17;
    --bg2:       #1a1929;
    --bg3:       #232136;
    --surface:   #2e2b45;
    --border:    #3d3954;
    --primary:   #7c3aed;
    --primary-h: #6d28d9;
    --primary-light: rgba(124,58,237,.15);
    --accent:    #f59e0b;
    --accent-h:  #d97706;
    --danger:    #ef4444;
    --danger-h:  #dc2626;
    --success:   #22c55e;
    --success-h: #16a34a;
    --text:      #e2e0f0;
    --text2:     #9d99b8;
    --text3:     #6b6580;
    --radius:    12px;
    --radius-sm: 8px;
    --radius-xs: 4px;
    --shadow:    0 4px 24px rgba(0,0,0,.35);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.2);
    --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
    --transition: .2s ease;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text); }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; background: none; }
input, select, textarea {
    font-family: var(--font); outline: none;
    font-size: .9rem;
}
img { max-width: 100%; display: block; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* === Utility === */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* === Container === */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* === Badge === */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 10px; border-radius: 20px;
    font-size: .7rem; font-weight: 600; line-height: 1.4;
}
.badge-green { background: rgba(34,197,94,.15); color: var(--success); }
.badge-red   { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-amber { background: rgba(245,158,11,.15); color: var(--accent); }
.badge-purple{ background: rgba(124,58,237,.15); color: var(--primary); }

/* ================================================================
   NAVBAR
   ================================================================ */
.navbar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.navbar-inner {
    max-width: 1280px; margin: 0 auto;
    display: flex; align-items: center;
    height: 56px; padding: 0 16px; gap: 12px;
}
.navbar-brand {
    font-size: 1.1rem; font-weight: 700;
    color: var(--text); text-decoration: none;
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.navbar-brand span { color: var(--primary); }
.navbar-brand:hover { color: var(--text); }

.navbar-links {
    display: flex; align-items: center; gap: 2px;
    margin-left: 8px;
}
.navbar-links a {
    color: var(--text2); font-size: .85rem;
    padding: 6px 14px; border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.navbar-links a:hover { color: var(--text); background: var(--surface); }
.navbar-links a.active { color: var(--text); background: var(--surface); }

.navbar-user {
    display: flex; align-items: center; gap: 10px;
    margin-left: auto; flex-shrink: 0;
}
.user-info {
    font-size: .85rem; color: var(--text2);
    max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Mobile menu */
.mobile-menu-btn { display: none; }
.mobile-menu {
    display: none;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg2);
}
.mobile-menu:not(.hidden) { display: flex; flex-direction: column; gap: 4px; }
.mobile-menu a {
    color: var(--text2); font-size: .9rem;
    padding: 10px 12px; border-radius: var(--radius-sm);
    text-decoration: none;
}
.mobile-menu a:hover,
.mobile-menu a.active {
    background: var(--surface); color: var(--text);
}

/* === Responsive Navbar === */
@media (max-width: 768px) {
    .navbar-links { display: none; }
    .navbar-user { display: none; }
    .mobile-menu-btn { display: flex; }
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: .9rem; font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    line-height: 1.4;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); border-color: var(--primary-h); }
.btn-ghost    { background: transparent; color: var(--text2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-h); }
.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: var(--success-h); }
.btn-amber    { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-amber:hover:not(:disabled) { background: var(--accent-h); }
.btn-outline  { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm  { padding: 6px 14px; font-size: .8rem; }
.btn-lg  { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.btn-xs { padding: 3px 8px; font-size: .7rem; border-radius: var(--radius-xs); }
.btn-link {
    background: none; border: none; color: var(--primary);
    padding: 0; font-size: inherit; font-weight: 500; cursor: pointer;
}
.btn-link:hover { color: var(--text); text-decoration: underline; }

/* ================================================================
   FORMS
   ================================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: .85rem; color: var(--text2);
    margin-bottom: 6px; font-weight: 500;
}
.form-input, select.form-input, textarea.form-input {
    width: 100%; padding: 10px 14px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.form-input::placeholder { color: var(--text3); }
textarea.form-input { resize: vertical; min-height: 80px; }
select.form-input { appearance: auto; }

.form-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 480px) {
    .form-row { grid-template-columns: 1fr; }
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover { box-shadow: var(--shadow); border-color: var(--surface); }
.card-body { padding: 16px; }

/* ================================================================
   CARD GRID
   ================================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
@media (max-width: 640px) {
    .card-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* ================================================================
   SCRIPT CARD
   ================================================================ */
.script-card { cursor: pointer; display: flex; flex-direction: column; }
.script-card-cover {
    height: 160px; background: linear-gradient(135deg, var(--surface), var(--bg3));
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; position: relative; overflow: hidden;
}
.script-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.script-card-type {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,0,0,.65); color: var(--accent);
    padding: 3px 10px; border-radius: 20px; font-size: .7rem; font-weight: 700;
}
.script-card-info { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.script-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.script-card-meta { display: flex; gap: 12px; font-size: .75rem; color: var(--text3); margin-bottom: 8px; }
.script-card-desc {
    font-size: .8rem; color: var(--text2);
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    flex: 1;
}
.script-card-actions { margin-top: 12px; }

/* ================================================================
   MODAL (Dialog)
   ================================================================ */
.modal {
    position: fixed; inset: 0;
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    animation: fadeIn .2s ease;
    padding: 16px;
}
.modal.hidden { display: none; }
.modal-content {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow);
    animation: slideUp .25s ease;
}
.modal-lg { max-width: 720px; }
.modal-sm { max-width: 360px; }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 8px;
}
.close-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 1.2rem; color: var(--text3);
    transition: all var(--transition);
}
.close-btn:hover { background: var(--surface); color: var(--text); }

@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity:0; } to { transform: translateY(0); opacity:1; } }

/* ================================================================
   AUTH FORM (Enhanced)
   ================================================================ */
.auth-modal-content {
    max-width: 420px;
    position: relative;
    overflow: visible;
}

.auth-modal-header {
    text-align: center;
    padding: 36px 32px 24px;
    background: linear-gradient(180deg, rgba(124,58,237,.08) 0%, transparent 100%);
    border-bottom: 1px solid var(--border);
}

.auth-modal-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    box-shadow: 0 4px 16px rgba(124,58,237,.35);
}

.auth-modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
}

.auth-modal-subtitle {
    font-size: .85rem;
    color: var(--text2);
    margin-top: 6px;
}

.auth-close-btn {
    position: absolute;
    top: 14px; right: 14px;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--text3);
    background: var(--bg3);
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
}

.auth-close-btn:hover {
    background: var(--surface);
    color: var(--text);
    border-color: var(--text3);
}

.auth-modal-body {
    padding: 28px 32px 32px;
}

.auth-input-group {
    margin-bottom: 18px;
}

.auth-input-wrap {
    position: relative;
    display: flex; align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    color: var(--text3);
    pointer-events: none;
    transition: color var(--transition);
    flex-shrink: 0;
}

.auth-input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .9rem;
    transition: all var(--transition);
}

.auth-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.15), 0 1px 4px rgba(0,0,0,.15);
    background: var(--bg2);
}

.auth-input:focus + .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--primary);
}

.auth-input::placeholder {
    color: var(--text3);
    font-size: .85rem;
}

.auth-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary), #6d28d9);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 6px;
    position: relative;
    overflow: hidden;
}

.auth-submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,.08) 50%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
}

.auth-submit-btn:hover::before {
    opacity: 1;
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,58,237,.4);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-btn-text {
    position: relative;
    z-index: 1;
}

.auth-toggle {
    text-align: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
    color: var(--text2);
}

.auth-link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0 4px;
    transition: all var(--transition);
}

.auth-link-btn:hover {
    color: var(--accent);
}

/* ================================================================
   TOAST
   ================================================================ */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 2000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 20px; border-radius: var(--radius-sm);
    font-size: .85rem; font-weight: 500;
    animation: toastIn .3s ease; max-width: 360px;
    box-shadow: var(--shadow);
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }
@keyframes toastIn { from { transform: translateY(16px); opacity:0; } to { transform: translateY(0); opacity:1; } }

/* ================================================================
   TABS
   ================================================================ */
.tabs {
    display: flex; gap: 4px; margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.tab {
    padding: 10px 20px; font-size: .85rem; font-weight: 600;
    color: var(--text3); cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    margin-bottom: -1px;
    background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ================================================================
   PAGE LAYOUT
   ================================================================ */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
    padding-top: 24px;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; }

/* ================================================================
   HERO SECTION (Home)
   ================================================================ */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    background: linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}
.hero h1 {
    font-size: 2.2rem; font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub {
    font-size: 1.05rem; color: var(--text2);
    max-width: 560px; margin: 0 auto 32px;
    line-height: 1.7;
}
.hero-actions {
    display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}

@media (max-width: 640px) {
    .hero { padding: 48px 0 36px; }
    .hero h1 { font-size: 1.6rem; }
    .hero-sub { font-size: .9rem; }
}

/* ================================================================
   QUICK JOIN (Home)
   ================================================================ */
.quick-join {
    padding: 40px 16px;
}
.quick-join-card {
    max-width: 480px; margin: 0 auto;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 28px;
    text-align: center;
}
.quick-join-card h2 {
    font-size: 1.2rem; font-weight: 700; margin-bottom: 16px;
}
.join-form {
    display: flex; gap: 10px;
}
.join-form input {
    flex: 1; padding: 12px 16px;
    background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 1.1rem; text-align: center; letter-spacing: 4px;
    font-weight: 600;
}
.join-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.join-form input::placeholder { letter-spacing: 0; font-weight: 400; font-size: .9rem; }

/* ================================================================
   SECTION
   ================================================================ */
.section-title {
    font-size: 1.2rem; font-weight: 700; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.section-more {
    text-align: center; margin-top: 24px;
}

/* ================================================================
   LOADING & EMPTY STATE
   ================================================================ */
.loading {
    text-align: center; padding: 40px 20px;
    color: var(--text3); font-size: .9rem;
}
.loading::after {
    content: ''; display: inline-block; width: 20px; height: 20px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .8s linear infinite;
    margin-left: 8px; vertical-align: middle;
}
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text3); font-size: .9rem;
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   FILE UPLOAD
   ================================================================ */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg3);
    position: relative;
    overflow: hidden;
}
.file-upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(124,58,237,.04) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition);
}
.file-upload-area:hover::before {
    opacity: 1;
}
.file-upload-area:hover {
    border-color: var(--primary);
}
.file-upload-icon {
    color: var(--text3);
    margin-bottom: 8px;
    transition: color var(--transition), transform var(--transition);
}
.file-upload-area:hover .file-upload-icon {
    color: var(--primary);
    transform: translateY(-2px);
}
.file-label {
    font-size: .85rem;
    color: var(--text2);
    display: block;
    font-weight: 500;
}
.file-hint {
    font-size: .75rem;
    color: var(--text3);
    display: block;
    margin-top: 4px;
}
.file-name {
    font-size: .8rem;
    color: var(--accent);
    display: block;
    margin-top: 6px;
    font-weight: 600;
}

/* ================================================================
   FORM SECTION (Upload page)
   ================================================================ */
.form-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    transition: border-color var(--transition);
}
.form-section:hover {
    border-color: var(--surface);
}
.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.form-section-step {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    border-radius: 8px;
    flex-shrink: 0;
}
.form-section-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    border: none;
    padding: 0;
}
.form-section-desc {
    font-size: .8rem;
    color: var(--text3);
    margin-bottom: 16px;
    margin-top: -8px;
}
.form-actions {
    margin-top: 28px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.form-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================================================================
   CHARACTER / CARD ROW (Upload page)
   ================================================================ */
.char-row, .card-row {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.char-row:hover, .card-row:hover {
    border-color: var(--surface);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.char-row-header, .card-row-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.char-row-num, .card-row-num {
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface);
    color: var(--text2);
    font-size: .7rem;
    font-weight: 700;
    border-radius: 6px;
}
.char-row-header strong, .card-row-header strong {
    font-size: .85rem;
    color: var(--text);
    flex: 1;
}
.btn-ghost-danger {
    background: none;
    border: 1px solid transparent;
    color: var(--danger);
    font-size: .8rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition);
    cursor: pointer;
}
.btn-ghost-danger:hover {
    background: rgba(239,68,68,.1);
    border-color: rgba(239,68,68,.3);
}

/* PDF / Image file picker in rows */
.char-pdf-wrap {
    position: relative;
}
.char-pdf-wrap input[type="file"] {
    position: absolute;
    width: 1px; height: 1px;
    opacity: 0;
    overflow: hidden;
}
.char-pdf-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-xs);
    color: var(--text2);
    font-size: .8rem;
    cursor: pointer;
    transition: all var(--transition);
}
.char-pdf-label:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(124,58,237,.05);
}

.btn-add-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-weight: 600;
}

.text-danger {
    color: var(--danger);
}

.page-header-desc {
    font-size: .85rem;
    color: var(--text3);
    margin-top: 4px;
    width: 100%;
}

/* ================================================================
   RECORDS LIST
   ================================================================ */
.records-list { display: flex; flex-direction: column; gap: 12px; }
.record-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    cursor: pointer; transition: all var(--transition);
}
.record-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.record-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.record-card-meta { font-size: .8rem; color: var(--text3); display: flex; gap: 16px; }
.record-card-top {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; gap: 8px;
}

/* ================================================================
   WAITING ROOM & CHARACTER SELECTION
   ================================================================ */
.waiting-room {
    max-width: 640px; margin: 60px auto; padding: 0 20px;
    text-align: center;
}
.waiting-room h2 { font-size: 1.3rem; margin-bottom: 8px; }
.waiting-room h3 { font-size: 1rem; margin-bottom: 16px; color: var(--text2); }

.waiting-player {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; margin-bottom: 8px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.waiting-player-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--surface); display: flex; align-items: center;
    justify-content: center; font-weight: 700; font-size: .9rem;
    flex-shrink: 0;
}
.waiting-player-name { font-weight: 600; flex: 1; text-align: left; }
.waiting-player-char { font-size: .85rem; color: var(--text3); }

.char-select-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-top: 12px;
}
@media (max-width: 480px) {
    .char-select-grid { grid-template-columns: repeat(2, 1fr); }
}
.char-select-card {
    background: var(--bg2); border: 2px solid var(--border);
    border-radius: var(--radius); padding: 20px 12px;
    text-align: center; cursor: pointer;
    transition: all var(--transition);
    position: relative; overflow: hidden;
}
.char-select-card:not(.taken):hover {
    border-color: var(--primary);
    background: rgba(124,58,237,.05);
    transform: translateY(-2px);
}
.char-select-card.taken { opacity: .5; cursor: not-allowed; }
.char-select-card.mine { border-color: var(--primary); }
.char-select-avatar {
    width: 48px; height: 48px; margin: 0 auto 10px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    border-radius: 50%; display: flex; align-items: center;
    justify-content: center; font-size: 1.2rem; font-weight: 700;
    color: #fff;
}
.char-select-name { font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
.char-select-desc { font-size: .75rem; color: var(--text3); line-height: 1.4; }
.char-select-btn {
    margin-top: 10px; padding: 4px 14px; display: inline-block;
    background: var(--primary); color: #fff; border-radius: 20px;
    font-size: .75rem; font-weight: 600;
}
.char-select-taken { margin-top: 10px; font-size: .75rem; color: var(--text3); }
.char-select-mine { margin-top: 10px; font-size: .75rem; color: var(--accent); font-weight: 600; }

/* ================================================================
   DICE / TOOLBAR
   ================================================================ */
.room-toolbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg2); border-top: 1px solid var(--border);
    padding: 8px 16px; display: none; gap: 8px;
    z-index: 50; justify-content: center;
}
.toolbar-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; background: var(--bg3);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text2); font-size: .85rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
}
.toolbar-btn:hover {
    border-color: var(--primary); color: var(--primary);
    background: rgba(124,58,237,.08);
}
.dice-modal { text-align: center; padding: 20px; }
.dice-result {
    font-size: 4rem; font-weight: 800; color: var(--accent);
    animation: diceBounce .5s ease;
}
.dice-label { font-size: .9rem; color: var(--text2); margin-bottom: 8px; }
.dice-info { font-size: .85rem; color: var(--text3); margin-top: 8px; }
.dice-faces-select {
    margin-bottom: 16px; display: flex; align-items: center;
    justify-content: center; gap: 8px;
}
.dice-faces-select select {
    padding: 6px 12px; background: var(--bg3); border: 1px solid var(--border);
    border-radius: var(--radius-xs); color: var(--text); font-size: .9rem;
}
@keyframes diceBounce {
    0% { transform: scale(0.3) rotate(-30deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(10deg); }
    70% { transform: scale(0.9) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.dice-rolling { font-size: 3rem; animation: diceSpin .3s linear infinite; }
@keyframes diceSpin {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
    100% { transform: rotate(360deg); }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 640px) {
    .container { padding: 0 12px; }
    .page-header { padding-top: 16px; margin-bottom: 16px; }
    .page-header h1 { font-size: 1.2rem; }
    .form-section { padding: 16px; }
    .modal-content { max-width: 100%; margin: 8px; }
    .auth-modal-header { padding: 28px 24px 20px; }
    .auth-modal-body { padding: 24px 24px 28px; }
    .auth-modal-icon { width: 48px; height: 48px; }
    .auth-modal-icon svg { width: 24px; height: 24px; }
    .join-form { flex-direction: column; }
    .hero-actions { flex-direction: column; align-items: center; }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1025px) {
    .container { padding: 0 24px; }
}
