:root {
    --navy: #1F2A44;
    --navy-hover: #162033;
    --gold: #F2A900;
    --gold-hover: #D89200;
    --white: #FFFFFF;
    --bg: #F5F7FB;
    --card: #FFFFFF;
    --border: #D9E0EA;
    --text: #1F2A44;
    --muted: #667085;
    --soft-gold: #FFF4D6;
    --soft-navy: #EEF2F8;
    --success-bg: #EEF8F3;
    --success-border: #B7E2C7;
    --green: #176B45;
    --soft-green: #EAF4EE;
    --shadow: 0 12px 32px rgba(31, 42, 68, 0.08);
    --shadow-soft: 0 8px 24px rgba(31, 42, 68, 0.05);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

a {
    color: var(--navy);
}

    a:hover {
        color: var(--navy-hover);
    }

h1,
h2,
h3,
h4 {
    margin-top: 0;
    color: var(--navy);
}

h1 {
    font-size: 28px;
    margin-bottom: 12px;
}

h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

h4 {
    font-size: 17px;
    margin-bottom: 8px;
}

p {
    line-height: 1.6;
    color: var(--text);
    margin-top: 0;
}

ul {
    margin: 0;
    padding-left: 20px;
}

li {
    margin-bottom: 8px;
}

/* Topbar */

.topbar {
    background: var(--navy);
    color: var(--white);
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 66px;
    height: 66px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    display: grid;
    place-items: center;
    overflow: hidden;
}

    .brand-mark img {
        width: 56px;
        height: 56px;
        object-fit: contain;
    }

.brand-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1;
}

.brand-subtitle {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.3px;
    color: #D4DCEE;
    margin-top: 4px;
}

.topbar-nav {
    display: flex;
    gap: 10px;
}

.topbar-link {
    text-decoration: none;
    color: var(--white);
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    transition: 0.2s ease;
}

    .topbar-link:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .topbar-link.active {
        background: rgba(255, 255, 255, 0.12);
    }

.topbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 52px;
}

.topbar-user {
    display: none;
}

.topbar-help {
    color: var(--white);
    font-weight: 700;
}

.profile-circle {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: var(--green);
    position: relative;
}

    .profile-circle::before {
        content: "";
        position: absolute;
        top: 10px;
        left: 14px;
        width: 12px;
        height: 12px;
        border: 2px solid #ffffff;
        border-radius: 999px;
    }

    .profile-circle::after {
        content: "";
        position: absolute;
        left: 10px;
        bottom: 9px;
        width: 20px;
        height: 12px;
        border: 2px solid #ffffff;
        border-bottom: 0;
        border-radius: 20px 20px 0 0;
    }

/* Generic buttons */

.hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 700;
    transition: 0.2s ease;
}

.hero-btn-primary {
    background: var(--gold);
    color: var(--navy);
    box-shadow: 0 6px 16px rgba(242, 169, 0, 0.22);
}

    .hero-btn-primary:hover {
        background: var(--gold-hover);
    }

.hero-btn-secondary {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--border);
}

    .hero-btn-secondary:hover {
        background: var(--soft-navy);
    }

/* Builder page layout */

.app-shell {
    max-width: 1540px;
    margin: 0 auto;
    padding: 22px;
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.builder-panel,
.preview-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.builder-panel {
    align-self: start;
}

.preview-panel {
    min-width: 0;
    overflow: hidden;
}

.panel-header,
.preview-panel-header,
.teacher-panel-header {
    margin-bottom: 18px;
}

.preview-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.student-view-pill {
    background: var(--soft-navy);
    border: 1px solid #D7E0EF;
    color: var(--navy);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.preview-panel-header p,
.panel-header p,
.teacher-panel-header p {
    color: var(--muted);
    margin-bottom: 0;
}

/* Form */

.form-section {
    margin-bottom: 16px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--navy);
}

textarea,
input,
select,
button {
    width: 100%;
    border-radius: 14px;
    font-size: 16px;
}

textarea,
input,
select {
    padding: 13px 15px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    transition: 0.2s ease;
}

    textarea:focus,
    input:focus,
    select:focus {
        outline: none;
        border-color: #B9C7DF;
        box-shadow: 0 0 0 4px rgba(31, 42, 68, 0.05);
    }

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

textarea {
    resize: vertical;
    min-height: 110px;
}

/* Buttons */

.button-row {
    display: flex;
    gap: 10px;
    margin: 18px 0 20px;
}

button {
    border: none;
    padding: 15px 16px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s ease;
}

#btn-generate-activity {
    background: var(--gold);
    color: var(--navy);
    box-shadow: 0 6px 16px rgba(242, 169, 0, 0.22);
}

    #btn-generate-activity:hover {
        background: var(--gold-hover);
        transform: translateY(-1px);
    }

#btn-copy-embed-code {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--border);
}

    #btn-copy-embed-code:hover:enabled {
        background: var(--soft-navy);
    }

    #btn-copy-embed-code:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Result */

.result-card {
    background: var(--soft-gold);
    border: 1px solid #F3D27A;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-soft);
}

    .result-card.success {
        background: var(--success-bg);
        border-color: var(--success-border);
    }

.embed-code-box {
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: var(--white);
    font-family: Consolas, monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--navy);
}

/* Teacher panel */

.teacher-panel {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.teacher-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    background: linear-gradient(180deg, #FFFFFF 0%, #FBFCFF 100%);
    box-shadow: var(--shadow-soft);
}

    .teacher-card p:last-child,
    .teacher-card ul:last-child {
        margin-bottom: 0;
    }

    .teacher-card ul {
        margin: 0;
        padding-left: 20px;
    }

/* Preview */

.preview-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.support-badge {
    background: var(--soft-gold);
    color: var(--navy);
    border: 1px solid #F3D27A;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.preview-top-grid,
.preview-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.preview-block {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    background: var(--white);
    box-shadow: var(--shadow-soft);
}

/* Learn grid */

.learn-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.learn-col {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 16px;
    background: var(--white);
    min-height: 300px;
    box-shadow: var(--shadow-soft);
}

    .learn-col h4 {
        margin-bottom: 10px;
        color: var(--navy);
        font-size: 16px;
    }

.learn-subtitle {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 12px;
    line-height: 1.45;
}

.preview-footer-note {
    border: 1px solid #D7E0EF;
    background: var(--soft-navy);
    color: var(--navy);
    border-radius: 16px;
    padding: 15px 16px;
    box-shadow: var(--shadow-soft);
}

#edit-code-error {
    color: #b42318;
    font-weight: 600;
}

/* Exact QLearn builder preview */

.copy-box-wrap {
    margin: 20px 0 24px;
}

.copy-html-box {
    width: 100%;
    min-height: 180px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    color: #1f2a44;
    font-family: Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre;
    overflow: auto;
    resize: vertical;
}

.qlearn-preview-shell {
    width: 100%;
    overflow: auto;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    min-height: 500px;
}

    .qlearn-preview-shell table {
        width: 100% !important;
        table-layout: fixed;
        border-collapse: collapse;
    }

    .qlearn-preview-shell th,
    .qlearn-preview-shell td {
        width: 20% !important;
        min-width: 0 !important;
        max-width: none !important;
        vertical-align: top;
        word-break: break-word;
        overflow-wrap: anywhere;
        padding: 8px !important;
        font-size: 12px !important;
        line-height: 1.35 !important;
    }

        .qlearn-preview-shell th strong,
        .qlearn-preview-shell td strong {
            font-size: 13px;
        }

    .qlearn-preview-shell p,
    .qlearn-preview-shell li {
        font-size: 12px !important;
        line-height: 1.35 !important;
    }

    .qlearn-preview-shell ul {
        padding-left: 18px;
        margin-top: 6px;
    }

    .qlearn-preview-shell li {
        margin-bottom: 5px;
    }

.qlearn-preview-frame {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
    overflow: auto;
}

    .qlearn-preview-frame table {
        width: 100% !important;
        table-layout: fixed;
        border-collapse: collapse;
    }

    .qlearn-preview-frame th,
    .qlearn-preview-frame td {
        width: 20% !important;
        min-width: 0 !important;
        max-width: none !important;
        vertical-align: top;
        word-break: break-word;
        overflow-wrap: anywhere;
        padding: 8px !important;
        font-size: 12px !important;
        line-height: 1.35 !important;
    }

        .qlearn-preview-frame th strong,
        .qlearn-preview-frame td strong {
            font-size: 13px;
        }

    .qlearn-preview-frame p,
    .qlearn-preview-frame li {
        font-size: 12px !important;
        line-height: 1.35 !important;
    }

    .qlearn-preview-frame ul {
        padding-left: 18px;
        margin-top: 6px;
    }

    .qlearn-preview-frame li {
        margin-bottom: 5px;
    }

/* Home page */

.home-shell {
    max-width: 1540px;
    margin: 0 auto;
    padding: 24px 28px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.home-hero,
.learn-framework-card,
.strategy-group-card,
.bottom-note,
.simple-page-card,
.why-works-strip {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.home-hero {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 28px;
}

.compact-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 32px;
    padding: 30px 38px;
}

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

.hero-icon-wrap {
    flex: 0 0 auto;
}

.hero-icon-circle {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: var(--soft-green);
    border: 1px solid #CFE1D6;
    display: grid;
    place-items: center;
    box-shadow: none;
    flex: 0 0 auto;
}

    .hero-icon-circle img {
        width: 52px;
        height: 52px;
        object-fit: contain;
    }

.home-hero-copy h1 {
    font-size: clamp(42px, 5vw, 64px);
    line-height: 1;
    letter-spacing: -2px;
    margin: 0 0 12px;
}

.hero-subtitle {
    max-width: 680px;
    margin: 0;
    font-size: 17px;
    line-height: 1.45;
    color: var(--muted);
}

.hero-note {
    font-size: 16px;
    color: var(--navy);
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 34px;
}

    .hero-actions > .hero-btn {
        min-width: 190px;
        background: var(--gold);
        color: var(--navy);
    }

.hero-custom-prompt {
    width: 310px;
    border-left: 1px solid var(--border);
    padding-left: 34px;
}

    .hero-custom-prompt h2 {
        margin: 0 0 8px;
        font-size: 22px;
        color: var(--navy);
    }

    .hero-custom-prompt p {
        margin: 0 0 14px;
        color: var(--muted);
        line-height: 1.45;
    }

    .hero-custom-prompt .hero-btn {
        background: var(--gold);
        color: var(--navy);
        padding: 12px 22px;
        min-width: 170px;
    }

/* Strategy library */

.strategy-library {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.strategy-group-card {
    padding: 20px;
    border-radius: 18px;
}

.strategy-group-header {
    min-height: 112px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

    .strategy-group-header h2 {
        font-size: 20px;
        line-height: 1.15;
        margin-bottom: 8px;
    }

    .strategy-group-header p {
        font-size: 14px;
        line-height: 1.45;
        margin: 0;
        color: var(--muted);
    }

.strategy-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.strategy-item-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    min-height: 68px;
    background: linear-gradient(180deg, #FFFFFF 0%, #FBFCFF 100%);
    box-shadow: var(--shadow-soft);
    text-decoration: none;
    color: inherit;
    transition: 0.2s ease;
}

    .strategy-item-card:hover {
        transform: translateY(-2px);
    }

    .strategy-item-card.static-card:hover {
        transform: none;
    }

.strategy-item-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--green);
    display: grid;
    place-items: center;
}

    .strategy-item-icon img {
        width: 44px;
        height: 44px;
        object-fit: cover;
    }

.strategy-item-content {
    flex: 1;
    min-width: 0;
}

.strategy-item-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.strategy-pill {
    display: inline-block;
    background: var(--soft-gold);
    border: 1px solid #F3D27A;
    color: #B77400;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.strategy-item-content h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.15;
}

.strategy-item-content p {
    margin: 0;
    font-size: 13px;
    line-height: 1.35;
    color: var(--text);
}

.strategy-arrow {
    font-size: 30px;
    line-height: 1;
    color: var(--navy);
}

.why-works-card {
    grid-column: span 2;
}

/* LEARN Prompt Framework */

.learn-combo-section {
    margin-top: 0;
}

.learn-framework-card {
    padding: 18px 20px;
}

    .prompt-framework-card > h2,
    .learn-framework-card > h2 {
        margin: 0 0 12px;
        font-size: 20px;
    }

.learn-combo-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
}

.prompt-framework-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
}

.learn-image-panel {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #FFFFFF 0%, #FBFCFF 100%);
    box-shadow: var(--shadow-soft);
    padding: 14px;
    min-height: 0;
    height: auto;
    overflow: hidden;
}

.learn-diagram-frame {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
}

.compact-diagram {
    height: 150px;
}

.learn-diagram-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.learn-info-panel {
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.learn-info-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.learn-info-stage-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.learn-stage-button {
    width: 100%;
    text-align: center;
    min-height: 44px;
    padding: 10px;
    border-radius: 0;
    border: 0;
    border-right: 1px solid var(--border);
    background: #ffffff;
    color: var(--navy);
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

    .learn-stage-button:last-child {
        border-right: 0;
    }

    .learn-stage-button.active {
        background: var(--soft-gold);
        border-color: #F3D27A;
        outline: 1px solid var(--gold);
        z-index: 1;
    }

.learn-info-detail h3 {
    margin-bottom: 6px;
    font-size: 20px;
}

.learn-info-subtitle {
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 10px;
}

.learn-info-detail p {
    margin-bottom: 0;
    color: var(--muted);
}

.learn-prompt-checklist {
    margin-top: 12px;
}

    .learn-prompt-checklist h4,
    .learn-related h4 {
        margin: 0 0 8px;
        font-size: 14px;
        color: var(--navy);
    }

    .learn-prompt-checklist ul {
        margin: 0;
        padding-left: 0;
        list-style: none;
    }

    .learn-prompt-checklist li {
        margin-bottom: 5px;
        font-size: 14px;
        color: var(--text);
    }

        .learn-prompt-checklist li::before {
            content: "✓";
            color: var(--green);
            font-weight: 900;
            margin-right: 8px;
        }

.learn-related {
    margin-top: 12px;
}

.related-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.related-tag {
    background: var(--soft-navy);
    border: 1px solid #D7E0EF;
    color: var(--navy);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
}

/* Why this works */

.why-works-strip {
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 260px repeat(3, minmax(0, 1fr));
    gap: 24px;
    align-items: center;
}

.why-works-title {
    border-right: 1px solid var(--border);
    padding-right: 20px;
}

    .why-works-title h2 {
        margin: 0;
        font-size: 20px;
    }

    .why-works-title p {
        margin: 6px 0 0;
        color: var(--muted);
    }

.why-works-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

    .why-works-item .strategy-item-icon {
        width: 54px;
        height: 54px;
        flex: 0 0 54px;
        background: var(--soft-green);
    }

        .why-works-item .strategy-item-icon img {
            width: 54px;
            height: 54px;
            object-fit: cover;
        }

    .why-works-item h3 {
        margin: 0 0 4px;
        font-size: 17px;
    }

    .why-works-item p {
        margin: 0;
        font-size: 13px;
        line-height: 1.35;
        color: var(--muted);
    }

.bottom-note {
    padding: 18px 22px;
}

    .bottom-note p {
        margin: 0;
        font-weight: 600;
        color: var(--navy);
    }

.simple-page-shell {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px;
}

.simple-page-card {
    padding: 28px;
}

/* Responsive */

@media (max-width: 1350px) {
    .compact-hero {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        justify-content: space-between;
    }

    .strategy-library {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .learn-combo-grid,
    .prompt-framework-grid {
        grid-template-columns: 1fr;
    }

    .learn-diagram-frame,
    .compact-diagram {
        height: 210px;
    }

    .why-works-strip {
        grid-template-columns: 1fr;
    }

    .why-works-title {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding-right: 0;
        padding-bottom: 14px;
    }
}

@media (max-width: 1250px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .learn-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-nav {
        width: 100%;
        flex-wrap: wrap;
    }

    .home-shell {
        padding: 18px 14px 32px;
    }

    .compact-hero {
        padding: 24px;
    }

    .home-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-left {
        flex-direction: column;
        align-items: flex-start;
    }

    .home-hero-copy h1 {
        font-size: 42px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .hero-custom-prompt {
        width: 100%;
        border-left: 0;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 18px;
    }

    .strategy-library {
        grid-template-columns: 1fr;
    }

    .why-works-card {
        grid-column: span 1;
    }

    .strategy-item-content h3 {
        font-size: 20px;
    }

    .learn-image-panel {
        height: auto;
        padding: 16px;
    }

    .learn-info-stage-list {
        grid-template-columns: 1fr;
    }

    .learn-stage-button {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

        .learn-stage-button:last-child {
            border-bottom: 0;
        }

    .preview-top-grid,
    .preview-bottom-grid,
    .learn-grid {
        grid-template-columns: 1fr;
    }

    .button-row {
        flex-direction: column;
    }
}
