/* ============================================================
   tipsrundan — REDESIGN
   ============================================================ */

:root {
    --primary:        #4338ca;
    --primary-dark:   #3730a3;
    --primary-light:  #818cf8;
    --primary-glow:   rgba(67, 56, 202, 0.15);
    --accent:         #f59e0b;
    --accent-dark:    #d97706;
    --success:        #10b981;
    --success-dark:   #059669;
    --success-glow:   rgba(16, 185, 129, 0.15);
    --danger:         #ef4444;
    --danger-glow:    rgba(239, 68, 68, 0.12);
    --bg:             #f0f4ff;
    --surface:        #ffffff;
    --text:           #0f172a;
    --text-muted:     #64748b;
    --border:         #e2e8f0;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.09), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg:      0 10px 40px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
    --shadow-xl:      0 20px 60px rgba(0,0,0,0.15);
    --r-sm:  8px;
    --r-md:  14px;
    --r-lg:  20px;
    --r-xl:  28px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── HERO HEADER ─────────────────────────────────────────── */
header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%);
    position: relative;
    overflow: hidden;
    padding-bottom: 0;
    margin-bottom: 0;
}

header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.hero {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2.5rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-badges {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--r-sm);
    background: var(--accent);
    color: #1e1b4b;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
    transform: rotate(-3deg);
    transition: transform 0.2s;
}
.hero-badge:nth-child(2) { transform: rotate(0deg); }
.hero-badge:nth-child(3) { transform: rotate(3deg); }
.hero-badge:hover { transform: rotate(0deg) scale(1.1) !important; }

header h1 {
    color: #ffffff;
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.hero-subtitle {
    color: rgba(165, 180, 252, 0.9);
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 2rem;
}

.header-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.admin-link, .company-link, .support-link {
    color: rgba(165, 180, 252, 0.8);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 100px;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}
.admin-link:hover, .company-link:hover, .support-link:hover {
    color: #ffffff;
    border-color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.08);
}

.hero-wave {
    line-height: 0;
    position: relative;
    z-index: 1;
}
.hero-wave svg {
    display: block;
    width: 100%;
    height: 50px;
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    padding: 1.75rem;
    margin-bottom: 1.75rem;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s;
}

.card h2 {
    color: var(--primary-dark);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.2em;
    background: linear-gradient(to bottom, var(--accent), var(--primary-light));
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── GENERATOR CARD ─────────────────────────────────────── */
.generator-card {
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
    border-color: rgba(67, 56, 202, 0.12);
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    letter-spacing: 0.2px;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

input[type="text"]::placeholder { color: #94a3b8; }

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: var(--r-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.2s, opacity 0.2s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }

.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(67, 56, 202, 0.4);
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: var(--r-lg);
    letter-spacing: 0.2px;
}
.primary-btn:hover {
    box-shadow: 0 6px 20px rgba(67, 56, 202, 0.55);
    transform: translateY(-1px);
}

.secondary-btn {
    background: #f1f5f9;
    color: var(--primary-dark);
    border: 1.5px solid var(--border);
}
.secondary-btn:hover {
    background: #e8edff;
    border-color: var(--primary-light);
    color: var(--primary);
}

.tertiary-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
}
.tertiary-btn:hover {
    background: #f1f5f9;
    color: var(--text);
}

/* ── LOADING ────────────────────────────────────────────── */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    gap: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(67, 56, 202, 0.15);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── SAVED LIST / GRID ──────────────────────────────────── */
.list-controls {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.list-search {
    flex: 1 1 180px;
    padding: 0.45rem 0.8rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.list-search:focus { border-color: var(--primary); }

.list-sort {
    padding: 0.45rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.list-sort:focus { border-color: var(--primary); }

.saved-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.saved-list > p {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 1.5rem 0;
}

.saved-item {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
    cursor: default;
}
.saved-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.saved-item h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.saved-item p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.likes-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.likes-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.like-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    transition: transform 0.2s;
}
.like-btn:hover { transform: scale(1.25); }

.saved-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.saved-item-actions .btn {
    flex: 1;
    font-size: 0.78rem;
    padding: 0.45rem 0.5rem;
    border-radius: var(--r-sm);
}

/* ── RESULT CARD ────────────────────────────────────────── */
.result-card { animation: fadeIn 0.3s ease; }

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

.result-header {
    margin-bottom: 1.5rem;
}

.result-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.result-header h2::before { display: none; }

#tipsrunda-topic {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.result-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

/* ── QUESTIONS ──────────────────────────────────────────── */
.question-item {
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: var(--r-md);
    background: #fafbff;
    border: 1.5px solid var(--border);
}

.question-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.option {
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.75rem 0.5rem;
    text-align: center;
    background: var(--surface);
    transition: border-color 0.15s;
}

.option-label {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.3rem;
    line-height: 1;
}

.option-text {
    font-size: 0.8rem;
    color: var(--text);
    line-height: 1.3;
}

/* ── LIKES WITHIN RESULT ────────────────────────────────── */
.tipsrunda-likes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

/* ── FACIT TABLE ─────────────────────────────────────────── */
.facit-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.65rem;
}

.facit-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0;
}

.facit-table th,
.facit-table td {
    border: 1px solid var(--border);
    padding: 0.65rem;
    text-align: center;
    font-size: 0.9rem;
}

.facit-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.facit-table tr:nth-child(even) td {
    background: rgba(0,0,0,0.018);
}

/* ── PLAY MODE ───────────────────────────────────────────── */
.play-card {
    max-width: 700px;
    margin: 0 auto;
}

.play-header {
    text-align: center;
    margin-bottom: 2rem;
}

.play-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.play-header h2::before { display: none; }

#play-topic {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
}

#play-progress {
    display: inline-block;
    background: var(--primary-glow);
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 100px;
    border: 1px solid rgba(67, 56, 202, 0.15);
}

.play-question-text {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.75rem;
    color: var(--text);
    line-height: 1.5;
}

.play-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.play-option {
    border: 2px solid var(--border);
    border-radius: var(--r-md);
    padding: 1.25rem 0.75rem;
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    background: var(--surface);
    user-select: none;
}
.play-option:hover {
    border-color: var(--primary-light);
    background: #f5f3ff;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.play-option .option-label {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.play-option .option-text {
    font-size: 0.85rem;
    color: var(--text);
}

.play-option.selected {
    border-color: var(--primary);
    background: #ede9fe;
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.play-option.selected .option-label { color: var(--primary-dark); }

.play-option.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 0 3px var(--success-glow);
}
.play-option.correct .option-label { color: var(--success-dark); }

.play-option.incorrect {
    border-color: var(--danger);
    background: var(--danger-glow);
    box-shadow: 0 0 0 3px var(--danger-glow);
    opacity: 0.75;
}
.play-option.incorrect .option-label { color: var(--danger); }

/* ── RESULTS ────────────────────────────────────────────── */
.results-display {
    text-align: center;
}

.results-display h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.results-display > p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.results-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.65rem;
}

.result-item {
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.65rem;
    font-size: 0.82rem;
    text-align: center;
    background: var(--surface);
}
.result-item.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.08);
    color: var(--success-dark);
}
.result-item.incorrect {
    border-color: var(--danger);
    background: var(--danger-glow);
    color: var(--danger);
}

.play-footer {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* ── HOME LINK ───────────────────────────────────────────── */
.home-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.home-link:hover { color: var(--primary); }

/* ── FOOTER ──────────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 1.5rem 0 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── UTILITIES ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero { padding: 2rem 1.25rem 1.75rem; }
    header h1 { font-size: 2rem; }

    .options-grid { grid-template-columns: 1fr; }
    .play-options  { grid-template-columns: 1fr; }
    .facit-list    { grid-template-columns: repeat(3, 1fr); }
    .saved-list    { grid-template-columns: 1fr; }

    .result-footer { flex-direction: column; }
    .result-footer .btn { width: 100%; }

    .hero-badge { width: 40px; height: 40px; font-size: 1.1rem; }
}

@media (max-width: 400px) {
    .facit-list { grid-template-columns: repeat(2, 1fr); }
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
    header, .generator-card, .saved-card, .result-footer, footer { display: none; }
    .question-item { page-break-inside: avoid; }
    body { background: white; }
    .card { box-shadow: none; border: none; }
}
