:root {
    --primary: #5E7CE0;
    --primary-dark: #3D5BDB;
    --primary-light: rgba(94, 124, 224, 0.08);
    --accent: #FF6B6B;
    --warning: #F59E0B;
    --success: #10B981;
    --purple: #8B5CF6;
    --bg: #F3F4F6;
    --white: #FFFFFF;
    --text: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.03);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.08);
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-btn: 20px;
    --radius-input: 10px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #F3F4F6;
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
.header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.3px;
}

.nav-links { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 20px;
    border-radius: var(--radius-btn);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(94,124,224,0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    background: #F9FAFB;
    border-color: #D1D5DB;
    color: var(--text);
}

.btn-download {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
    font-size: 13px;
    padding: 7px 16px;
    flex-shrink: 0;
    border-radius: 30px;
    font-weight: 600;
}
.btn-download:hover {
    background: #D1FAE5;
    border-color: #6EE7B7;
}

.btn-danger {
    background: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FECACA;
}
.btn-danger:hover { background: #FEE2E2; border-color: #FCA5A5; }

.btn-small { padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; }

.btn-link {
    background: none;
    color: var(--text-secondary);
    padding: 8px 14px;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    border-radius: var(--radius-btn);
    transition: all var(--transition);
}
.btn-link:hover { background: #F3F4F6; color: var(--text); }

/* ── Card Grid ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
    padding: 28px 0 40px;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px 18px;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--border);
}
.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: #D1D5DB;
}

/* ── Title Row ── */
.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 36px;
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

/* ── Announcement ── */
.card-announcement {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    height: 60px;
    overflow-y: auto;
    line-height: 1.6;
}
.card-announcement-inner {
    font-size: 10px;
    color: #92400E;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Query Row ── */
.card-query-row {
    display: flex;
    gap: 10px;
}

/* ── Date ── */
.card-date {
    text-align: right;
    font-size: 9px;
    color: var(--text-muted);
    margin-top: auto;
    letter-spacing: 0.2px;
}

/* ── Forms ── */
.form-page {
    max-width: 520px;
    margin: 36px auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 36px 32px;
    border: 1px solid var(--border);
}

.form-page h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.form-page .subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group .hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #FAFBFC;
    transition: all var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(94,124,224,0.1);
    background: var(--white);
}
.form-input::placeholder { color: #C4C7CF; }
textarea.form-input { min-height: 110px; resize: vertical; }

/* ── Messages ── */
.message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.5;
}
.message-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.message-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.message-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }
.message-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Token Display ── */
.token-display {
    background: #FFFBEB;
    border: 1.5px dashed #FCD34D;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    margin: 20px 0;
}
.token-display .token-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.token-display .token-value {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 8px;
    color: #D97706;
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 16px 0 36px;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-btn);
    font-size: 13px;
    text-decoration: none;
    transition: all var(--transition);
    background: var(--white);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}
.pagination .disabled { color: var(--text-muted); pointer-events: none; opacity: 0.5; }

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 14px; opacity: 0.3; }
.empty-state h2 { font-size: 18px; margin-bottom: 6px; color: var(--text-secondary); font-weight: 600; }

/* ── Admin Table ── */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table th {
    background: #F9FAFB;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #F3F4F6;
    color: var(--text);
}
.admin-table tr:hover td { background: #FAFBFC; }

.admin-table .token-cell {
    font-family: "SF Mono", "Fira Code", "Consolas", monospace;
    background: #F3F4F6;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* ── Dashboard ── */
.dashboard-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px 28px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.dashboard-section h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #F3F4F6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.text-muted { color: var(--text-muted); font-size: 12px; }
.text-ellipsis {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

/* ── Confirm Dialog ── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.confirm-overlay.active { display: flex; }

.confirm-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-xl);
}
.confirm-box h3 { font-size: 16px; margin-bottom: 8px; }
.confirm-box p { color: var(--text-secondary); margin-bottom: 22px; font-size: 13px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ── Footer ── */
.footer { text-align: center; padding: 20px; color: var(--text-muted); font-size: 12px; }

/* ── Admin Header ── */
.admin-header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.admin-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.admin-content { max-width: 1200px; margin: 0 auto; padding: 20px 20px 36px; }

/* ── Guide Page ── */
.guide-container {
    max-width: 760px;
    margin: 32px auto;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 36px;
    border: 1px solid var(--border);
}
.guide-container .guide-game-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.guide-container .guide-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #F3F4F6;
}
.guide-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Login ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #F3F4F6;
}
.login-box {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    border: 1px solid var(--border);
}
.login-box h1 { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-box .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 28px; font-size: 13px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .card-grid { grid-template-columns: 1fr; padding: 18px 0 28px; }
    .card { padding: 18px 20px 16px; gap: 12px; }
    .form-page { margin: 16px; padding: 24px 20px; }
    .header-inner { height: 50px; }
    .logo { font-size: 16px; }
    .btn { padding: 7px 16px; font-size: 12px; }
    .form-row { grid-template-columns: 1fr; }
    .guide-container { margin: 16px; padding: 24px 20px; }
    .dashboard-section { padding: 18px 20px; }
}
