/* ===== TOKENS ===== */
:root {
    --bg: #0b1220;
    --bg-card: rgba(18, 32, 52, 0.85);
    --bg-card-solid: #122034;
    --bg-glass: rgba(22, 38, 62, 0.6);
    --border: rgba(50, 80, 120, 0.35);
    --border-light: rgba(77, 166, 255, 0.15);
    --text: #d8dfe8;
    --text-secondary: #7e94ad;
    --text-muted: #4a5f78;
    --accent: #4da6ff;
    --accent-glow: rgba(77, 166, 255, 0.25);
    --accent-dim: rgba(77, 166, 255, 0.08);
    --gradient-card: linear-gradient(145deg, rgba(18,32,52,0.9), rgba(13,24,40,0.95));
    --gradient-header: linear-gradient(135deg, #0e1a2e 0%, #132440 50%, #0e1a2e 100%);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'Consolas', 'Courier New', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 30px rgba(77, 166, 255, 0.06);
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(77,166,255,0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(77,166,255,0.03) 0%, transparent 60%);
}

/* ===== HEADER ===== */
header {
    background: var(--gradient-header);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.header-badge {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4da6ff, #2b7fd4);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(77,166,255,0.3);
}

.header-left h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--text);
}
.header-left p {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-dsp {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== MAIN ===== */
main {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== SECTIONS ===== */
section { padding: 36px 0; }
section + section { border-top: 1px solid var(--border); }

section > h2 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ===== CARD (intro) ===== */
.card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}
.card p { margin-bottom: 14px; font-size: 14px; }
.card p:last-child { margin-bottom: 0; }
.card strong { color: var(--accent); }

.rules {
    background: var(--accent-dim);
    border-left: 3px solid var(--accent);
    padding: 14px 18px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 16px 0;
}
.rules p { margin-bottom: 6px; font-size: 14px; }
.rules ul { list-style: none; }
.rules li { padding-left: 16px; position: relative; font-size: 14px; }
.rules li::before { content: "—"; position: absolute; left: 0; color: var(--accent); }

/* Complaint card */
.complaint-card {
    background: linear-gradient(145deg, rgba(25,35,50,0.9), rgba(18,28,42,0.95));
    border: 1px solid rgba(255, 200, 100, 0.15);
    border-left: 3px solid rgba(255, 200, 100, 0.4);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.complaint-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 200, 100, 0.7);
    margin-bottom: 4px;
}
.complaint-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 200, 100, 0.08);
}
.complaint-body {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    font-style: italic;
}
.complaint-body p { margin-bottom: 10px; }
.complaint-body p:last-of-type { margin-bottom: 12px; }
.complaint-body strong { color: var(--text); font-style: normal; }
.complaint-signature {
    font-size: 12px;
    color: var(--text-muted);
    font-style: normal;
    margin-top: 4px;
}

.hint {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 10px 14px;
    background: rgba(77,166,255,0.04);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(77,166,255,0.08);
}

/* ===== ROLES ===== */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.role-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    box-shadow: var(--shadow);
    transition: border-color 0.2s;
}
.role-card:hover { border-color: var(--accent-glow); }
.role-card strong { color: var(--text); display: block; margin-bottom: 4px; }

/* ===== TABLES ===== */
.table-block {
    margin-bottom: 32px;
}
.table-block h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}
.table-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}
.table-source {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--bg-card-solid);
}

.data-table th {
    background: linear-gradient(180deg, rgba(30,48,72,0.95), rgba(22,38,58,0.95));
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 10px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(50, 80, 120, 0.2);
    vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
.data-table tr:hover td { background: rgba(77,166,255,0.05); }

.cell-number {
    font-family: var(--mono);
    text-align: right;
    white-space: nowrap;
}

/* ===== CHARTS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-card {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.chart-card h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* ===== NOTEPAD ===== */
#notepad-text {
    width: 100%;
    min-height: 180px;
    padding: 18px;
    background: var(--bg-card-solid);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.25s, box-shadow 0.25s;
    box-shadow: var(--shadow);
}
#notepad-text:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow), 0 0 0 3px var(--accent-glow);
}
#notepad-text::placeholder { color: var(--text-muted); }

/* ===== REVEAL SECTION ===== */
#reveal-trigger {
    text-align: center;
    padding: 20px 0;
}
#btn-reveal {
    display: inline-block;
    padding: 14px 40px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(135deg, #4da6ff, #2b7fd4);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(77,166,255,0.3);
}
#btn-reveal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(77,166,255,0.45);
}
#btn-reveal:active { transform: translateY(0); }
#btn-reveal.used {
    background: linear-gradient(135deg, #3a5a7c, #2a4460);
    box-shadow: none;
    pointer-events: none;
    opacity: 0.5;
}
.reveal-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-card {
    background: linear-gradient(145deg, #162640, #112030);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    text-align: center;
    min-width: 300px;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.modal-card h3 { font-size: 16px; margin-bottom: 4px; }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }
.modal-card input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 20px;
    text-align: center;
    letter-spacing: 8px;
    font-family: var(--mono);
    margin-bottom: 12px;
    transition: border-color 0.2s;
}
.modal-card input:focus { outline: none; border-color: var(--accent); }
.modal-error {
    font-size: 13px;
    color: #ff6b6b;
    margin-bottom: 10px;
    animation: shake 0.3s ease;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.modal-buttons { display: flex; gap: 10px; margin-top: 8px; }
.btn-primary, .btn-secondary {
    flex: 1;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.btn-primary {
    background: linear-gradient(135deg, #4da6ff, #2b7fd4);
    color: #fff;
}
.btn-primary:hover { box-shadow: 0 4px 16px rgba(77,166,255,0.35); }
.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }

/* Answer block */
.answer-block {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.6s ease 0.2s;
}
.answer-block.visible {
    max-height: 5000px;
    opacity: 1;
}

.answer-inner {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow), var(--shadow-glow);
    line-height: 1.8;
    font-size: 14px;
}

.answer-inner h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin: 28px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.answer-inner h3:first-child { margin-top: 0; }

.answer-inner p { margin-bottom: 10px; }
.answer-inner strong { color: var(--text); }

.answer-step {
    background: rgba(77,166,255,0.06);
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
}

.answer-false-lead {
    background: rgba(255, 200, 100, 0.06);
    border-left: 3px solid rgba(255, 200, 100, 0.4);
    padding: 12px 16px;
    margin: 10px 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
}

.answer-verdict {
    background: rgba(255, 80, 80, 0.08);
    border: 1px solid rgba(255, 80, 80, 0.2);
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}
.answer-verdict .verdict-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #ff6b6b;
    margin-bottom: 8px;
}
.answer-verdict p {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 0;
}

.answer-inner ul {
    margin: 8px 0 8px 20px;
    font-size: 13px;
}
.answer-inner li {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

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

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 28px 24px;
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border);
    margin-top: 16px;
}

/* ===============================================
   RESPONSIVE — MOBILE FIRST
   =============================================== */

/* Tablet */
@media (max-width: 900px) {
    .charts-grid { grid-template-columns: 1fr; }
    .roles-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 600px) {
    :root {
        --radius: 10px;
        --radius-sm: 6px;
    }

    body { font-size: 14px; }

    /* Header */
    header { position: relative; /* unstick on mobile for more space */ }
    .header-inner {
        flex-direction: column;
        padding: 12px 16px;
        gap: 8px;
        text-align: center;
    }
    .header-left {
        flex-direction: column;
        gap: 8px;
    }
    .header-left h1 { font-size: 14px; }
    .header-left p { font-size: 10px; white-space: normal; }
    .badge-dsp { font-size: 9px; padding: 4px 10px; }

    /* Main */
    main { padding: 0 12px; }
    section { padding: 24px 0; }

    /* Card */
    .complaint-card { padding: 16px; }
    .complaint-body { font-size: 12px; }
    .card { padding: 18px; }
    .card p { font-size: 13px; }
    .rules { padding: 12px 14px; }
    .rules li, .rules p { font-size: 13px; }
    .hint { font-size: 12px; }

    /* Roles — single column */
    .roles-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .role-card {
        padding: 12px 14px;
        font-size: 12px;
    }

    /* Tables — card layout on mobile */
    .table-block h3 { font-size: 13px; }
    .table-note { font-size: 11px; }

    .table-scroll {
        border-radius: var(--radius-sm);
    }

    .data-table {
        font-size: 11px;
    }
    .data-table th {
        font-size: 9px;
        padding: 8px 6px;
        letter-spacing: 0.2px;
    }
    .data-table td {
        padding: 6px;
    }
    .cell-number {
        font-size: 11px;
    }

    /* Charts */
    .charts-grid { grid-template-columns: 1fr; gap: 14px; }
    .chart-card { padding: 14px; }
    .chart-card h3 { font-size: 10px; }

    /* Reveal */
    #btn-reveal { padding: 12px 32px; font-size: 14px; }
    .modal-card { padding: 24px 20px; min-width: auto; margin: 0 16px; }
    .answer-inner { padding: 20px 16px; font-size: 13px; }
    .answer-step, .answer-false-lead { padding: 10px 12px; font-size: 12px; }

    /* Notepad — 16px prevents iOS auto-zoom on focus */
    #notepad-text {
        min-height: 140px;
        padding: 14px;
        font-size: 16px;
    }

    /* Section headings */
    section > h2 {
        font-size: 12px;
        letter-spacing: 1.5px;
    }

    footer { padding: 20px 12px; font-size: 10px; }
}

/* Very small screens */
@media (max-width: 380px) {
    main { padding: 0 8px; }
    .card { padding: 14px; }
    .data-table th { font-size: 8px; padding: 6px 4px; }
    .data-table td { padding: 5px 4px; font-size: 10px; }
    .cell-number { font-size: 10px; }
}

/* ===== PRINT ===== */
@media print {
    header, footer, #notepad { display: none; }
    body { background: #fff; color: #000; }
    .data-table th { background: #eee; color: #333; }
    .data-table td { border-color: #ccc; color: #000; }
    .table-block h3 { color: #333; }
    .card, .chart-card, .table-block { background: #fff; border-color: #ccc; }
}
