/* ============================================
   Wizard — Microstandards Finder
   Premium Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables ── */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #0f0f2a;
    --bg-card: rgba(15, 15, 42, 0.65);
    --bg-card-hover: rgba(20, 20, 55, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);

    --text-primary: #e8e8f0;
    --text-secondary: #9898b8;
    --text-muted: #6868a0;
    --text-heading: #ffffff;

    --accent-start: #7c3aed;
    --accent-end: #06b6d4;
    --accent-gradient: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    --accent-glow: rgba(124, 58, 237, 0.35);

    --green: #22c55e;
    --green-light: #86efac;
    --green-bg: rgba(34, 197, 94, 0.12);
    --green-glow: rgba(34, 197, 94, 0.3);

    --red: #ef4444;
    --red-light: #fca5a5;
    --red-bg: rgba(239, 68, 68, 0.12);
    --red-glow: rgba(239, 68, 68, 0.3);

    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, 0.12);

    --gray: #6b7280;
    --gray-bg: rgba(107, 114, 128, 0.12);

    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --sidebar-w: 260px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 20% 10%, rgba(124, 58, 237, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); border: none; }
input, textarea, select { font-family: var(--font); }

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

/* ── Gradient Text Utility ── */
.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

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

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

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 20px var(--accent-glow); }
    50%      { box-shadow: 0 0 40px var(--accent-glow), 0 0 60px rgba(124, 58, 237, 0.15); }
}

@keyframes barFill {
    from { width: 0%; }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%) translateY(0); }
    to   { opacity: 1; transform: translateX(0) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* Utility animation classes */
.fade-in {
    animation: fadeIn 0.4s var(--transition) forwards;
}

.slide-up {
    animation: slideUp 0.5s var(--transition) forwards;
}

/* ============================================
   SHARED COMPONENTS
   ============================================ */

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-primary);
    transition: all var(--transition);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.btn:not(.btn-primary):not(.btn-accent):not(.btn-danger):not(.btn-answer):hover {
    background: var(--bg-glass-hover);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px var(--accent-glow);
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.btn-accent {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border: none;
    color: #fff;
    font-weight: 600;
}

.btn-accent:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    box-shadow: 0 4px 15px var(--red-glow);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-large {
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    transition: all var(--transition);
}

.btn-back:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

/* ── Loading Spinner ── */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-start);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-sm::after {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    animation: toastIn 0.4s ease forwards;
}

.toast.hide {
    animation: toastOut 0.4s ease forwards;
}

.toast.success {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--green-light);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--red-light);
}

.toast.info {
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.3);
    color: #c4b5fd;
}

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    padding: 20px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 36px;
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(124, 58, 237, 0.1);
    animation: scaleIn 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 12px;
}

.modal-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 18px;
}

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

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition);
    outline: none;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--accent-start);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
    background: rgba(255, 255, 255, 0.06);
}

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

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239898b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ============================================
   GAME PAGE — index.php
   ============================================ */

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 20px 60px;
    position: relative;
    z-index: 1;
}

/* ── Game Header ── */
.game-header {
    text-align: center;
    padding: 40px 20px 30px;
    position: relative;
}

.logo-text {
    font-size: 42px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    margin-bottom: 6px;
    filter: drop-shadow(0 0 30px var(--accent-glow));
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
}

.header-actions {
    position: absolute;
    top: 20px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}

.top-action:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
    transform: translateY(-1px);
}

.restart-top {
    color: #e0f2fe;
    border-color: rgba(6, 182, 212, 0.25);
    background: rgba(6, 182, 212, 0.1);
}

.restart-top:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: rgba(6, 182, 212, 0.4);
}

/* ── Screens ── */
.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

/* ── Start Screen ── */
.start-card {
    text-align: center;
    padding: 60px 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg), 0 0 80px rgba(124, 58, 237, 0.05);
    animation: slideUp 0.6s ease forwards;
}

.start-icon {
    font-size: 72px;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
    display: inline-block;
}

.start-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 12px;
}

.start-card p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 460px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

/* ── Progress Bar ── */
.progress-container {
    position: relative;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 28px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 10px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.progress-label {
    position: absolute;
    right: 0;
    top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Question Card ── */
.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    margin-bottom: 28px;
    position: relative;
    transition: all var(--transition);
    animation: fadeIn 0.4s ease forwards;
}

.question-card.fade-out {
    animation: fadeOut 0.25s ease forwards;
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 10px;
    background: var(--accent-gradient);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 18px;
}

.question-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-heading);
    line-height: 1.5;
    margin-bottom: 28px;
}

/* ── Answer Buttons ── */
.answer-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-answer {
    flex: 1;
    min-width: 120px;
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    color: #fff;
}

.btn-answer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: all var(--transition);
}

.btn-answer:hover {
    transform: translateY(-3px) scale(1.03);
}

.btn-answer:hover::before {
    background: rgba(255, 255, 255, 0.1);
}

.btn-answer:active {
    transform: translateY(0) scale(0.97);
}

.btn-yes {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.25);
}
.btn-yes:hover { box-shadow: 0 6px 25px rgba(34, 197, 94, 0.4); }

.btn-probably-yes {
    background: linear-gradient(135deg, #65a30d, #84cc16);
    box-shadow: 0 4px 15px rgba(132, 204, 22, 0.2);
}
.btn-probably-yes:hover { box-shadow: 0 6px 25px rgba(132, 204, 22, 0.35); }

.btn-dont-know {
    background: linear-gradient(135deg, #4b5563, #6b7280);
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.2);
}
.btn-dont-know:hover { box-shadow: 0 6px 25px rgba(107, 114, 128, 0.35); }

.btn-probably-no {
    background: linear-gradient(135deg, #ea580c, #f97316);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.2);
}
.btn-probably-no:hover { box-shadow: 0 6px 25px rgba(249, 115, 22, 0.35); }

.btn-no {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}
.btn-no:hover { box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4); }

/* ── Candidates Panel ── */
.candidates-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(16px);
}

.candidates-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.candidates-title span {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.candidates-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.candidate-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.candidate-item:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-light);
}

.candidate-rank {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    background: var(--bg-glass);
    color: var(--text-muted);
    flex-shrink: 0;
}

.candidate-item:nth-child(1) .candidate-rank {
    background: var(--accent-gradient);
    color: #fff;
}

.candidate-item:nth-child(2) .candidate-rank {
    background: rgba(124, 58, 237, 0.2);
    color: #c4b5fd;
}

.candidate-item:nth-child(3) .candidate-rank {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
}

.candidate-info {
    flex: 1;
    min-width: 0;
}

.candidate-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.candidate-description {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.candidate-probability {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
    flex-shrink: 0;
}

.probability-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.probability-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.probability-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    background-size: 200% 100%;
    animation: shimmer 2.5s infinite;
}

.probability-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

/* ── Guess Modal Extras ── */
.guess-details {
    margin: 20px 0;
}

.guess-name {
    font-size: 22px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.guess-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.guess-probability {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

.guess-probability strong {
    color: var(--green);
}

/* ── Result Card ── */
.result-card {
    text-align: center;
    padding: 50px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease forwards;
}

.result-card h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 16px;
}

.result-card .result-icon {
    font-size: 64px;
    margin-bottom: 18px;
    display: inline-block;
}

.result-card .result-list {
    text-align: left;
    margin: 24px 0;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all var(--transition);
}

.result-item:first-child {
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: var(--shadow-glow);
}

.result-item-rank {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 30px;
}

.result-item:first-child .result-item-rank {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-item-info {
    flex: 1;
}

.result-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.result-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-item-prob {
    font-weight: 700;
    font-size: 15px;
    color: var(--accent-start);
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ── No Data Message ── */
.no-data-message {
    text-align: center;
    padding: 60px 30px;
    color: var(--text-secondary);
}

.no-data-message .no-data-icon {
    font-size: 56px;
    margin-bottom: 16px;
    display: inline-block;
    opacity: 0.6;
}

.no-data-message h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-data-message p {
    margin-bottom: 24px;
    line-height: 1.7;
}

/* ── Game Over ── */
.game-over {
    text-align: center;
    padding: 40px;
}

.game-over h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-heading);
}

.game-over p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}


/* ============================================
   ADMIN PAGE — admin.php
   ============================================ */

.admin-body {
    background: var(--bg-primary);
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ── Admin Nav Sidebar ── */
.admin-nav {
    width: var(--sidebar-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.admin-logo {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.admin-logo a {
    font-size: 22px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all var(--transition);
}

.admin-logo a:hover {
    filter: brightness(1.2);
}

.nav-links {
    list-style: none;
    padding: 0;
}

.nav-links li {
    margin: 2px 12px;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-links a:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.nav-links a.active {
    background: rgba(124, 58, 237, 0.12);
    color: #c4b5fd;
    font-weight: 600;
}

/* ── Admin Content ── */
.admin-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 32px 40px;
    position: relative;
    z-index: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease forwards;
}

.tab-content > h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 24px;
}

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.tab-header h2 {
    margin-bottom: 0 !important;
}

/* ── Admin Card ── */
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    backdrop-filter: blur(16px);
    margin-bottom: 20px;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    backdrop-filter: blur(16px);
    text-align: center;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ── Data Table ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-glass);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-glass-hover);
}

.data-table .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Search Box ── */
.search-box {
    margin-bottom: 20px;
}

.search-box .form-input {
    max-width: 400px;
    padding-left: 16px;
}

/* ── Association Matrix ── */
.association-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 20px;
}

.association-matrix th {
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-glass);
}

.association-matrix td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.association-matrix tr:hover td {
    background: var(--bg-glass-hover);
}

/* ── Weight Selector ── */
.weight-selector {
    display: inline-flex;
    gap: 4px;
}

.weight-selector .weight-btn {
    width: 36px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.weight-selector .weight-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-light);
}

.weight-selector .weight-btn.active {
    border-color: var(--accent-start);
    color: #fff;
}

.weight-selector .weight-btn.active[data-weight="2"] {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: transparent;
}

.weight-selector .weight-btn.active[data-weight="1"] {
    background: linear-gradient(135deg, #65a30d, #84cc16);
    border-color: transparent;
}

.weight-selector .weight-btn.active[data-weight="0"] {
    background: linear-gradient(135deg, #4b5563, #6b7280);
    border-color: transparent;
}

.weight-selector .weight-btn.active[data-weight="-1"] {
    background: linear-gradient(135deg, #ea580c, #f97316);
    border-color: transparent;
}

.weight-selector .weight-btn.active[data-weight="-2"] {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border-color: transparent;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}

.pagination button {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all var(--transition);
}

.pagination button:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.pagination button.active {
    background: var(--accent-gradient);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}


/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .game-container {
        padding: 12px 12px 40px;
    }

    .game-header {
        padding: 24px 12px 20px;
    }

    .logo-text {
        font-size: 32px;
    }

    .header-actions {
        position: static;
        justify-content: center;
        margin-top: 14px;
        flex-wrap: wrap;
    }

    .start-card {
        padding: 40px 24px;
    }

    .start-card h2 {
        font-size: 22px;
    }

    .question-card {
        padding: 24px 20px;
    }

    .question-text {
        font-size: 17px;
    }

    .answer-buttons {
        flex-direction: column;
    }

    .btn-answer {
        min-width: 100%;
    }

    .candidate-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .candidate-probability {
        min-width: 100%;
    }

    /* Admin responsive */
    .admin-nav {
        position: static;
        width: 100%;
        flex-direction: row;
        padding: 12px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
    }

    .admin-logo {
        padding: 0 12px 0 0;
        border-bottom: none;
        border-right: 1px solid var(--border);
        margin-bottom: 0;
        margin-right: 12px;
        display: flex;
        align-items: center;
    }

    .nav-links {
        display: flex;
        gap: 4px;
    }

    .nav-links li {
        margin: 0;
    }

    .nav-links a {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 13px;
    }

    .admin-container {
        flex-direction: column;
    }

    .admin-content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        padding: 24px 20px;
        border-radius: var(--radius-md);
    }

    .modal-buttons {
        flex-direction: column;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 10px 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-number {
        font-size: 28px;
    }

    .logo-text {
        font-size: 28px;
    }

    .start-icon {
        font-size: 56px;
    }
}

/* ============================================
   RELEASE POLISH — auth, tags, clearer hover states
   ============================================ */

.form-hint {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.optional-label {
    color: var(--text-muted);
    font-weight: 400;
}

.tag-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.22);
    color: #67e8f9;
    font-size: 12px;
    line-height: 1.4;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6d28d9, #0891b2);
    box-shadow: 0 10px 30px rgba(124, 58, 237, 0.38), 0 0 24px rgba(6, 182, 212, 0.2);
}

.btn-accent:hover {
    background: linear-gradient(135deg, #0891b2, #2563eb);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.35), 0 0 24px rgba(6, 182, 212, 0.18);
    filter: none;
}

.admin-logout {
    margin: auto 12px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    background: var(--bg-glass);
    font-size: 13px;
    transition: all var(--transition);
}

.admin-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.28);
    color: var(--red-light);
}

.admin-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.admin-login-card {
    width: min(100%, 440px);
    padding: 38px;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    backdrop-filter: blur(20px);
    animation: scaleIn 0.3s ease;
}

.admin-login-logo {
    display: inline-block;
    margin-bottom: 18px;
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-login-card h1 {
    color: var(--text-heading);
    font-size: 24px;
    margin-bottom: 10px;
}

.admin-login-card p {
    color: var(--text-secondary);
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.6;
}

.login-error {
    padding: 10px 14px;
    margin-bottom: 18px;
    border-radius: var(--radius-sm);
    color: var(--red-light);
    background: var(--red-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 14px;
}

@media (max-width: 768px) {
    .admin-logout {
        margin: 0 0 0 8px;
        white-space: nowrap;
    }

    .admin-login-card {
        padding: 28px 22px;
    }
}

/* ── AI admin tools ── */
.ai-help {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 6px 0 18px;
}

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

.ai-card {
    border-color: rgba(6, 182, 212, 0.18);
    box-shadow: 0 0 40px rgba(6, 182, 212, 0.06);
}

.ai-note {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: var(--bg-glass);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.6;
}

.success-note {
    color: var(--green-light);
    background: var(--green-bg);
    border-color: rgba(34, 197, 94, 0.3);
}

.ai-preview {
    margin-top: 12px;
}

.ai-preview summary {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 10px;
}

.ai-preview textarea {
    min-height: 260px;
    font-size: 12px;
    line-height: 1.5;
}

.visually-hidden-textarea {
    position: fixed;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ── Candidate expandable details ── */
.candidate-item.is-expandable {
    cursor: pointer;
}

.candidate-item.is-expandable:focus-visible {
    outline: 2px solid var(--accent-start);
    outline-offset: 2px;
}

.candidate-item.expanded {
    align-items: flex-start;
    border-color: rgba(124, 58, 237, 0.28);
    background: rgba(255, 255, 255, 0.06);
}

.candidate-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.candidate-name-row .candidate-name {
    flex: 1;
    margin-bottom: 0;
}

.candidate-toggle {
    flex-shrink: 0;
    font-size: 11px;
    color: #c4b5fd;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(124, 58, 237, 0.25);
    background: rgba(124, 58, 237, 0.12);
}

.candidate-details {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.075);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.candidate-detail-block + .candidate-detail-block {
    margin-top: 12px;
}

.candidate-detail-block strong {
    display: block;
    margin-bottom: 5px;
    color: #ffffff;
    font-size: 12px;
}

.candidate-detail-block p {
    color: #e8e8f0;
    font-size: 13px;
    line-height: 1.62;
    white-space: normal;
}

.candidate-item.expanded .candidate-description {
    display: none;
}

/* ── Result expandable details ── */
.result-item.is-expandable {
    cursor: pointer;
}

.result-item.is-expandable:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-light);
}

.result-item.is-expandable:focus-visible {
    outline: 2px solid var(--accent-start);
    outline-offset: 2px;
}

.result-item.expanded {
    align-items: flex-start;
    border-color: rgba(124, 58, 237, 0.28);
    background: rgba(255, 255, 255, 0.06);
}

.result-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.result-name-row .result-item-name {
    flex: 1;
    margin-bottom: 0;
}

.result-toggle {
    flex-shrink: 0;
    font-size: 11px;
    color: #c4b5fd;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(124, 58, 237, 0.25);
    background: rgba(124, 58, 237, 0.12);
}

.result-details {
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.075);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.result-detail-block + .result-detail-block {
    margin-top: 12px;
}

.result-detail-block strong {
    display: block;
    margin-bottom: 5px;
    color: #ffffff;
    font-size: 12px;
}

.result-detail-block p {
    color: #e8e8f0;
    font-size: 13px;
    line-height: 1.62;
    white-space: normal;
}

.result-item.expanded .result-item-desc {
    display: none;
}

/* ── Admin JSON import ── */
.tab-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.json-import-textarea {
    min-height: 260px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    line-height: 1.5;
}

/* ── Visual polish: readable selects and details ── */
select,
select.form-input {
    background-color: #11112b;
    color: #f6f6ff;
    color-scheme: dark;
}

select.form-input:hover,
select:hover {
    border-color: var(--border-light);
    background-color: rgba(255, 255, 255, 0.07);
}

select.form-input option,
select option,
select.form-input optgroup,
select optgroup {
    background-color: #101026;
    color: #f6f6ff;
}

select.form-input option:checked,
select option:checked {
    background-color: #312e81;
    color: #ffffff;
}

.result-helper,
.game-over > p.result-helper {
    color: #f3f4ff;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 20px;
}

.result-note {
    color: #cbd5ff;
    font-size: 14px;
    line-height: 1.6;
    margin-top: -8px;
    margin-bottom: 16px;
}

.candidate-description,
.result-item-desc {
    color: #d7d7ee;
}

.candidate-details,
.result-details {
    background: rgba(8, 8, 26, 0.82);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 28px rgba(0, 0, 0, 0.22);
}

.candidate-detail-block strong,
.result-detail-block strong {
    color: #ffffff;
    letter-spacing: 0.01em;
}

.candidate-detail-block p,
.result-detail-block p {
    color: #f4f4ff;
    font-size: 14px;
    line-height: 1.72;
}

.candidate-toggle,
.result-toggle {
    color: #ffffff;
    border-color: rgba(196, 181, 253, 0.45);
    background: rgba(124, 58, 237, 0.24);
}

.candidate-item.expanded,
.result-item.expanded {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
    .header-actions {
        position: static;
        justify-content: center;
        margin-top: 14px;
        flex-wrap: wrap;
    }

    .top-action {
        padding: 9px 14px;
    }
}

/* ── Visual patch: inline expandable cards without nested dark blocks ── */
.candidate-item,
.result-item {
    display: block;
}

.candidate-main,
.result-main {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.candidate-name,
.result-item-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.candidate-description,
.result-item-desc {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    color: #edf0ff;
    font-size: 13px;
    line-height: 1.55;
}

.result-item-desc {
    font-size: 14px;
}

.candidate-details,
.result-details {
    margin: 14px 0 0;
    padding: 14px 0 0;
    width: 100%;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.candidate-detail-block,
.result-detail-block {
    padding-left: 42px;
}

.candidate-detail-block strong,
.result-detail-block strong {
    color: #ffffff;
    font-size: 12px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.candidate-detail-block p,
.result-detail-block p {
    color: #f5f6ff;
    font-size: 14px;
    line-height: 1.72;
}

.candidate-item.expanded .candidate-description,
.result-item.expanded .result-item-desc {
    display: block;
}

.candidate-toggle,
.result-toggle,
.candidate-name-row,
.result-name-row {
    display: none;
}

.candidate-item.is-expandable:hover,
.result-item.is-expandable:hover {
    border-color: rgba(124, 58, 237, 0.34);
    background: rgba(255, 255, 255, 0.075);
}

@media (max-width: 768px) {
    .candidate-main,
    .result-main {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .candidate-info,
    .result-item-info {
        min-width: calc(100% - 46px);
    }

    .candidate-probability {
        margin-left: 42px;
    }

    .result-item-prob {
        margin-left: 42px;
    }

    .candidate-detail-block,
    .result-detail-block {
        padding-left: 0;
    }
}
