/*
 * Tambahan/penegasan untuk PATCH v1.0.5.
 * File ini boleh menimpa style.css lama.
 */

:root {
    --bg: #eef4ff;
    --surface: rgba(255, 255, 255, .94);
    --text: #132238;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #8b5cf6;
    --accent: #0f766e;
    --border: rgba(209, 221, 237, .95);
    --shadow: 0 18px 45px rgba(15, 23, 42, .09);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 12%, rgba(96, 165, 250, .23), transparent 25%),
        radial-gradient(circle at 83% 12%, rgba(139, 92, 246, .14), transparent 24%),
        radial-gradient(circle at 80% 80%, rgba(15, 118, 110, .09), transparent 28%),
        linear-gradient(180deg, #f8faff 0%, #eef4ff 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

body.math-bg::before,
body.math-bg::after {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    white-space: pre-line;
    color: rgba(15, 37, 87, .075);
    font-family: "Cambria Math", "Times New Roman", serif;
    line-height: 1.9;
    font-size: 23px;
    user-select: none;
}

body.math-bg::before {
    content:
        "ax² + bx + c = 0\A"
        "x = (-b ± √(b² - 4ac)) / 2a\A"
        "sin²θ + cos²θ = 1\A"
        "f'(x) = lim h→0 [f(x+h)-f(x)] / h\A"
        "∫ (2x + 1) dx = x² + x + C\A"
        "Sₙ = a(1-rⁿ)/(1-r)\A"
        "P(A∩B) = P(A)P(B)";
    top: 105px;
    left: 2.5vw;
    transform: rotate(-8deg);
}

body.math-bg::after {
    content:
        "y = mx + c\A"
        "lim x→∞ (1 + 1/x)ˣ = e\A"
        "L = πr²\A"
        "V = ⅓πr²t\A"
        "x̄ = Σx/n\A"
        "logₐ(MN) = logₐM + logₐN\A"
        "aₙ = a + (n-1)b";
    top: 140px;
    right: 2vw;
    transform: rotate(9deg);
    text-align: right;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    min-height: 72px;
    padding: 0 5vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 30;
    color: white;
    background: rgba(15, 37, 87, .91);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 25px rgba(15, 37, 87, .16);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 800;
}

.brand-icon,
.brand-mark {
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    color: white;
    background: linear-gradient(135deg, #60a5fa, #2563eb 62%, #1d4ed8);
    box-shadow: 0 10px 24px rgba(37, 99, 235, .24);
    font-weight: 900;
}

.brand-icon {
    width: 38px;
    height: 38px;
}

.brand-mark {
    width: 58px;
    height: 58px;
    margin: 0 auto 14px;
    font-size: 30px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
}

.nav-links a:hover {
    color: #bfdbfe;
}

.user-chip {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
}

.mobile-nav-toggle {
    display: none;
    border: 0;
    color: white;
    background: transparent;
    font-size: 24px;
}

.container {
    width: min(1480px, 92vw);
    margin: 0 auto;
    padding: 34px 0 60px;
    position: relative;
    z-index: 1;
}

.welcome-shell {
    width: min(1080px, 100%);
    margin: 0 auto;
    padding-top: 42px;
}

.welcome-copy {
    max-width: 780px;
    margin: 0 auto 30px;
    text-align: center;
}

.welcome-copy h1 {
    margin: 8px 0 12px;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1.08;
}

.welcome-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 17px;
}

.eyebrow {
    color: var(--primary);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
}

.auth-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.auth-choice-card {
    min-height: 330px;
    display: flex;
    flex-direction: column;
    padding: 32px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    transition:
        transform .22s ease,
        box-shadow .22s ease,
        border-color .22s ease;
}

.auth-choice-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 7px;
}

.register-card::before {
    background: linear-gradient(90deg, #2563eb, #8b5cf6);
}

.login-card::before {
    background: linear-gradient(90deg, #0f766e, #2563eb);
}

.auth-choice-card::after {
    content: "∑  √  π  ∫  lim";
    position: absolute;
    right: 16px;
    bottom: 8px;
    color: rgba(37, 99, 235, .07);
    font-family: "Cambria Math", serif;
    font-size: 40px;
    transform: rotate(-7deg);
}

.auth-choice-card:hover {
    transform: translateY(-6px);
    border-color: rgba(96, 165, 250, .75);
    box-shadow: 0 27px 60px rgba(37, 99, 235, .16);
}

.auth-choice-icon {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    border-radius: 20px;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 14px 28px rgba(37, 99, 235, .23);
    font-size: 29px;
    font-weight: 900;
}

.login-card .auth-choice-icon {
    background: linear-gradient(135deg, var(--accent), var(--primary));
}

.auth-choice-label {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
}

.auth-choice-card h2 {
    margin: 8px 0 10px;
    font-size: 29px;
    line-height: 1.15;
}

.auth-choice-card p {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 15px;
}

.auth-choice-action {
    margin-top: auto;
    color: var(--primary);
    font-weight: 800;
}

.login-card .auth-choice-action {
    color: var(--accent);
}

.welcome-note {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 800px;
    margin: 24px auto 0;
    padding: 15px 18px;
    border: 1px solid rgba(191, 219, 254, .85);
    border-radius: 16px;
    color: #334155;
    background: rgba(239, 246, 255, .86);
    backdrop-filter: blur(8px);
}

.welcome-note > span {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--primary);
    background: white;
    font-weight: 900;
}

.welcome-note p {
    margin: 0;
}

.hero,
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 24px;
}

.hero h1,
.page-header h1 {
    margin: 5px 0 8px;
    font-size: clamp(28px, 4vw, 46px);
    line-height: 1.08;
}

.hero p,
.page-header p {
    max-width: 860px;
    margin: 0;
    color: var(--muted);
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
    gap: 24px;
    align-items: start;
}

.card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
}

.output-card {
    position: sticky;
    top: 96px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 22px;
    margin: 24px 0 16px;
    border-top: 1px solid var(--border);
}

.section-heading:first-child {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}

.section-heading > span {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    font-weight: 800;
}

.section-heading h2,
.output-header h2,
.card h2 {
    margin: 0;
    font-size: 20px;
}

.section-heading p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

label {
    display: block;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 7px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: rgba(255, 255, 255, .97);
    outline: none;
    font: inherit;
    font-weight: 500;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

textarea {
    resize: vertical;
}

small,
.muted,
.hint,
.optional {
    color: var(--muted);
    font-weight: 500;
}

.form-grid {
    display: grid;
    gap: 16px;
}

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

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.check-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(248, 250, 252, .95);
    cursor: pointer;
}

.check-card input {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--primary);
}

.check-card span {
    font-size: 13px;
    font-weight: 600;
}

.advanced-box {
    margin: 18px 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(248, 250, 252, .92);
}

.advanced-box summary {
    padding: 15px 17px;
    cursor: pointer;
    font-weight: 800;
}

.advanced-content {
    padding: 0 17px 17px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.btn-secondary,
.btn-small {
    color: var(--text);
    background: white;
    border-color: var(--border);
}

.btn-copy {
    color: white;
    background: linear-gradient(135deg, var(--accent), #0f9a8f);
}

.btn-danger {
    color: white;
    background: #b91c1c;
}

.btn-small {
    padding: 7px 10px;
    font-size: 12px;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.prompt-output {
    width: 100%;
    min-height: 650px;
    padding: 17px;
    border: 1px solid #0b1220;
    border-radius: 14px;
    color: #e2e8f0;
    background: #0b1220;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 13px;
    line-height: 1.65;
}

.empty-state {
    min-height: 420px;
    display: grid;
    place-content: center;
    color: var(--muted);
    text-align: center;
}

.empty-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    border-radius: 18px;
    color: var(--primary);
    background: #dbeafe;
    font-size: 28px;
}

.copy-status {
    min-height: 24px;
    color: #15803d;
    font-size: 13px;
    font-weight: 700;
}

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    border-radius: 12px;
}

.alert-danger {
    color: #7f1d1d;
    background: rgba(254, 226, 226, .95);
    border-color: #fecaca;
}

.alert-success {
    color: #14532d;
    background: rgba(220, 252, 231, .95);
    border-color: #bbf7d0;
}

.alert-warning {
    color: #713f12;
    background: rgba(254, 243, 199, .95);
    border-color: #fde68a;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 25px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(12px);
    box-shadow: 0 24px 60px rgba(15, 37, 87, .15);
}

.auth-card h1 {
    margin-bottom: 5px;
    text-align: center;
}

.auth-card > .muted {
    margin-top: 0;
    text-align: center;
}

.auth-helper {
    margin-top: 16px;
    color: var(--muted);
    text-align: center;
}

.auth-helper a {
    color: var(--primary);
    font-weight: 700;
}

.secondary-link {
    margin-top: 8px;
    font-size: 13px;
}

.stack-form h2 {
    margin: 20px 0 12px;
    font-size: 17px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .06em;
}

.user-chip {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
}

.footer {
    padding: 18px;
    position: relative;
    z-index: 1;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.honeypot {
    width: 1px;
    height: 1px;
    position: absolute !important;
    left: -10000px !important;
    overflow: hidden;
}

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

    .output-card {
        position: static;
    }
}

@media (max-width: 760px) {
    body.math-bg::before,
    body.math-bg::after {
        opacity: .55;
        font-size: 16px;
    }

    .container {
        width: min(94vw, 100%);
        padding-top: 22px;
    }

    .auth-choice-grid,
    .form-grid.two,
    .form-grid.three,
    .check-grid,
    .check-grid.compact {
        grid-template-columns: 1fr;
    }

    .auth-choice-card {
        min-height: 290px;
    }

    .card {
        padding: 17px;
    }

    .hero,
    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 3vw;
        right: 3vw;
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        border-radius: 14px;
        background: rgba(15, 37, 87, .97);
        box-shadow: var(--shadow);
    }

    .nav-links.open {
        display: flex;
    }

    .prompt-output {
        min-height: 500px;
    }
}
