* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    color: #1f2937;
}

body.no-scroll {
    overflow: hidden;
}

.is-hidden {
    display: none !important;
}
.app-header,
.app-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(6px);
}

.app-header h1 {
    margin: 0;
    font-size: 2.25rem;
}

.app-header p {
    margin: 0.5rem 0 0;
    color: #475569;
}

.app-main {
    display: grid;
    gap: 1.5rem;
    padding: 2rem clamp(1rem, 5vw, 4rem);
}

@media (min-width: 900px) {
    .app-main {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
    }
}

.panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 1.75rem;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
}

.panel h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: #0f172a;
}

.is-hidden {
    display: none !important;
}

.question-form {
    display: grid;
    gap: 1rem;
}

.question-form label {
    font-weight: 600;
    color: #1e293b;
}

.question-form textarea,
.question-form input,
.question-form select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    font-size: 1rem;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

.question-form textarea:focus,
.question-form input:focus,
.question-form select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.question-form textarea {
    resize: vertical;
    min-height: 120px;
}

.options-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 700px) {
    .options-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: #ffffff;
    padding: 0.9rem 1.25rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
}

.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.primary:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.35);
}

.ghost {
    background: transparent;
    color: #4f46e5;
    border: 1px solid rgba(99, 102, 241, 0.35);
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ghost:not(:disabled):hover {
    background: rgba(99, 102, 241, 0.08);
    color: #4338ca;
    border-color: rgba(79, 70, 229, 0.5);
}

.form-hint {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

.question-bank {
    display: grid;
    gap: 1rem;
    max-height: 420px;
    overflow: auto;
    padding-right: 0.25rem;
}

.question-bank.collapsed {
    display: none;
}

.question-bank.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    color: #475569;
    text-align: center;
}

.question-card {
    background: rgba(248, 250, 252, 0.95);
    padding: 1rem 1.25rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    display: grid;
    gap: 0.75rem;
}

.question-card strong {
    color: #0f172a;
}

.question-card ul {
    margin: 0;
    padding-left: 1.25rem;
    color: #334155;
    line-height: 1.45;
}

.quiz-controls {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.quiz-controls input {
    max-width: 140px;
}

.quiz-area {
    display: grid;
    gap: 1.5rem;
}

.quiz-area.hidden,
.quiz-results.hidden {
    display: none;
}

.quiz-question {
    display: grid;
    gap: 0.9rem;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 1.25rem;
    border-radius: 16px;
}

.quiz-question h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #0f172a;
}

.quiz-question label {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    cursor: pointer;
    color: #334155;
}

.quiz-question input[type="radio"] {
    margin-top: 0.2rem;
}

.quiz-submit {
    justify-self: flex-start;
}

.quiz-results {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    background: rgba(236, 252, 203, 0.7);
    color: #1a2e05;
    border: 1px solid rgba(101, 163, 13, 0.4);
}

.quiz-results strong {
    font-size: 1.1rem;
}

.ad-container {
    background: rgba(248, 250, 252, 0.95);
    border: 1px dashed rgba(148, 163, 184, 0.45);
    border-radius: 16px;
    padding: 1rem;
    min-height: 120px;
    display: grid;
    place-items: center;
}

.app-footer {
    font-size: 0.9rem;
    color: #475569;
}

