:root {
    --bg: #eaf2f6;
    --panel: rgba(255, 255, 255, .72);
    --panel-strong: rgba(255, 255, 255, .88);
    --ink: #172033;
    --muted: #667085;
    --line: rgba(255, 255, 255, .52);
    --line-dark: rgba(86, 106, 132, .18);
    --brand: #0f766e;
    --brand-strong: #115e59;
    --accent: #c27a28;
    --danger: #b42318;
    --ok: #15803d;
    --shadow: 0 22px 70px rgba(31, 45, 61, .14);
    --soft-shadow: 0 12px 36px rgba(31, 45, 61, .10);
}

* { box-sizing: border-box; }
html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 12%, rgba(15, 118, 110, .25), transparent 30%),
        radial-gradient(circle at 92% 8%, rgba(194, 122, 40, .24), transparent 28%),
        linear-gradient(135deg, #eef8f7 0%, #f5f7fb 48%, #edf1f7 100%);
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h2 { font-size: 18px; letter-spacing: 0; }

.ambient {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    filter: blur(12px);
    opacity: .62;
}
.ambient-one {
    width: 380px;
    height: 380px;
    right: -150px;
    top: 120px;
    background: radial-gradient(circle, rgba(15, 118, 110, .30), transparent 66%);
}
.ambient-two {
    width: 340px;
    height: 340px;
    left: 220px;
    bottom: -180px;
    background: radial-gradient(circle, rgba(194, 122, 40, .24), transparent 68%);
}

.shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    gap: 22px;
    padding: 18px;
}

.sidebar {
    width: 272px;
    color: white;
    padding: 18px;
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(16, 24, 39, .88), rgba(17, 94, 89, .72)),
        rgba(16, 24, 39, .72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 6px 6px 26px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-grid;
    place-items: center;
    color: white;
    font-weight: 900;
    letter-spacing: 0;
    background: linear-gradient(135deg, #0f766e, #178f86 54%, #c27a28);
    box-shadow: 0 14px 30px rgba(15, 118, 110, .30);
    flex: 0 0 auto;
}

.brand-copy strong {
    display: block;
    font-size: 14px;
    line-height: 1.2;
}
.brand-copy small { color: rgba(255,255,255,.66); }

nav { display: grid; gap: 8px; }

nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: rgba(255,255,255,.82);
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-weight: 700;
    transition: .18s ease;
}

nav a span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.36);
}

nav a:hover {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.18);
    color: white;
    transform: translateX(2px);
}

nav a:hover span { background: #f6c66e; }

.main {
    flex: 1;
    min-width: 0;
    padding: 6px 6px 32px 0;
}

.auth-main {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255,255,255,.58);
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(22px);
}

.topbar strong { display: block; font-size: 24px; }
.topbar span { color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card, .question-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(22px);
}

.card { overflow: hidden; }

.metric {
    position: relative;
    min-height: 132px;
}

.metric::after {
    content: "";
    position: absolute;
    width: 84px;
    height: 84px;
    right: -24px;
    top: -22px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(15,118,110,.22), rgba(194,122,40,.20));
}

.metric strong {
    display: block;
    font-size: 38px;
    line-height: 1;
    margin-bottom: 8px;
}

.metric span, .muted {
    color: var(--muted);
    line-height: 1.6;
}

.button, button {
    border: 0;
    background: linear-gradient(135deg, var(--brand), #178f86);
    color: white;
    border-radius: 14px;
    padding: 11px 16px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    box-shadow: 0 12px 24px rgba(15, 118, 110, .22);
    transition: .18s ease;
}

.button:hover, button:hover {
    background: linear-gradient(135deg, var(--brand-strong), #147c75);
    transform: translateY(-1px);
}

.button.secondary {
    background: rgba(255,255,255,.72);
    color: var(--ink);
    border: 1px solid var(--line-dark);
    box-shadow: none;
}
.button.danger { background: linear-gradient(135deg, var(--danger), #d33b2f); }

form { display: grid; gap: 14px; }

label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 800;
    color: #273244;
}

input, select, textarea {
    width: 100%;
    border: 1px solid rgba(86, 106, 132, .18);
    border-radius: 14px;
    padding: 12px 13px;
    font: inherit;
    color: var(--ink);
    background: rgba(255,255,255,.74);
    outline: none;
    transition: border .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: rgba(15, 118, 110, .55);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, .10);
    background: rgba(255,255,255,.94);
}

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

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line-dark); }

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255,255,255,.58);
}

th, td {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(86, 106, 132, .14);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #506078;
    background: rgba(255,255,255,.58);
}

.alert {
    padding: 13px 15px;
    border-radius: 16px;
    margin-bottom: 16px;
    background: rgba(220, 252, 231, .76);
    color: #065f46;
    border: 1px solid rgba(21, 128, 61, .16);
    backdrop-filter: blur(14px);
}

.alert.error {
    background: rgba(254, 226, 226, .80);
    color: #991b1b;
    border-color: rgba(180, 35, 24, .18);
}

.login-wrap {
    width: min(1060px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(360px, .88fr);
    gap: 22px;
    align-items: stretch;
}

.login-hero {
    min-height: 590px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 42px;
    color: white;
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 28px;
    background:
        linear-gradient(140deg, rgba(16, 24, 39, .60), rgba(15, 118, 110, .62)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='650' viewBox='0 0 900 650'%3E%3Crect fill='%230f766e' width='900' height='650'/%3E%3Cg opacity='.28' fill='none' stroke='%23fff' stroke-width='2'%3E%3Cpath d='M110 130h250v150H110zM405 95h310v100H405zM455 245h245v245H455zM150 360h230v130H150z'/%3E%3Cpath d='M145 170h180M145 215h140M440 130h210M490 310h150M490 360h120M185 405h150'/%3E%3C/g%3E%3Ccircle cx='760' cy='95' r='95' fill='%23c27a28' opacity='.45'/%3E%3Ccircle cx='95' cy='560' r='120' fill='%23115e59' opacity='.50'/%3E%3C/svg%3E") center/cover;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.eyebrow {
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.22);
    font-size: 13px;
    font-weight: 800;
    backdrop-filter: blur(14px);
}

.login-hero h1 {
    margin: 18px 0 10px;
    font-size: clamp(56px, 7vw, 96px);
    line-height: .9;
    letter-spacing: 0;
}

.login-hero p {
    width: min(560px, 100%);
    color: rgba(255,255,255,.86);
    font-size: 17px;
    line-height: 1.7;
}

.login-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

.login-stats div {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255,255,255,.13);
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(14px);
}

.login-stats strong { display: block; font-size: 24px; }
.login-stats span { color: rgba(255,255,255,.76); font-size: 13px; }

.auth-card {
    width: 100%;
    align-self: center;
    padding: 28px;
    border-radius: 28px;
}

.form-head {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 22px;
}

.form-head h2 {
    margin: 0;
    font-size: 24px;
}

.form-head p, .demo-text { margin-bottom: 0; }

.question-box { background: rgba(255,255,255,.66); }

.type-panel {
    border: 1px solid var(--line-dark);
    border-radius: 18px;
    padding: 16px;
    background: rgba(255,255,255,.42);
}

.type-panel h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.compact-row {
    align-items: end;
}

.mini-table input,
.mini-table select {
    min-width: 160px;
}

.question-title {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    align-items: start;
    margin-bottom: 14px;
}

.question-number {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    background: linear-gradient(135deg, #0f766e, #c27a28);
}

.statement-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line-dark);
    border-radius: 14px;
    background: rgba(255,255,255,.45);
}

.cause-effect {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.cause-effect div {
    padding: 14px;
    border: 1px solid var(--line-dark);
    border-radius: 14px;
    background: rgba(255,255,255,.48);
}

.cause-effect p {
    margin: 4px 0 0;
}

.question-media {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}

.question-media figure {
    margin: 0;
    padding: 10px;
    border: 1px solid var(--line-dark);
    border-radius: 16px;
    background: rgba(255,255,255,.56);
}

.question-media img {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

.question-media figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.print-sheet {
    color: #111827;
}

.report-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.report-title h1 {
    margin: 0;
    padding: 12px 28px;
    background: #43c5b7;
    border-radius: 6px;
    box-shadow: 0 4px 0 rgba(17,94,89,.24);
    font-size: 22px;
}

.report-badge {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    background: #43c5b7;
    display: grid;
    place-items: center;
    font-weight: 900;
    box-shadow: 0 4px 8px rgba(0,0,0,.22);
}

.report-meta {
    width: min(620px, 100%);
    margin: 0 auto 24px;
}

.report-meta p {
    display: grid;
    grid-template-columns: 220px 1fr;
    margin: 8px 0;
    font-size: 16px;
}

.report-meta.compact {
    margin-left: 0;
}

.kisi-table {
    border-collapse: collapse;
    background: white;
}

.kisi-table th {
    background: #42b9b2;
    color: #061012;
    text-transform: none;
    letter-spacing: 0;
    font-size: 14px;
    text-align: center;
}

.kisi-table th,
.kisi-table td {
    border: 2px solid #111;
    vertical-align: top;
}

.option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 0;
    font-weight: 600;
}

.option input { width: auto; margin-top: 3px; }

.exam-header {
    position: sticky;
    top: 12px;
    z-index: 4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,.72);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(22px);
}

.timer {
    font-weight: 900;
    color: var(--danger);
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 14px;
    background: rgba(254,226,226,.70);
}

.rank {
    display: grid;
    grid-template-columns: 44px 1fr 90px;
    gap: 12px;
    align-items: center;
}

.rank .no {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(15,118,110,.18), rgba(194,122,40,.18));
    display: grid;
    place-items: center;
    font-weight: 900;
    color: var(--brand-strong);
}

.print-only { display: none; }

@media (max-width: 980px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-hero { min-height: 420px; }
}

@media (max-width: 860px) {
    .shell { display: block; padding: 12px; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        margin-bottom: 14px;
        border-radius: 20px;
    }
    nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main { padding: 0 0 22px; }
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; gap: 12px; }
    .login-stats { grid-template-columns: 1fr; }
    .statement-row, .cause-effect { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .auth-main { padding: 14px; }
    .login-hero, .auth-card { border-radius: 22px; padding: 24px; }
    nav { grid-template-columns: 1fr; }
    .topbar { display: grid; }
}

@media print {
    body { background: white; }
    .ambient, .sidebar, .topbar, .no-print, .button { display: none !important; }
    .shell { padding: 0; display: block; }
    .main { padding: 0; }
    .card, .question-box { box-shadow: none; border: 0; background: white; backdrop-filter: none; }
    .print-table-wrap { overflow: visible; border: 0; }
    .kisi-table th, .kisi-table td { font-size: 11px; padding: 6px; }
    .print-only { display: block; }
}
