:root {
    --ink: #1e1915;
    --muted: #6b5e52;
    --paper: #f5ead8;
    --surface: #fffaf0;
    --surface-strong: #fff4df;
    --line: #d8bd8d;
    --line-dark: #5a3a2a;
    --red: #a93628;
    --red-dark: #792319;
    --green: #285f4c;
    --green-dark: #173d32;
    --gold: #c89635;
    --gold-soft: #f0d79a;
    --charcoal: #28231f;
    --white: #ffffff;
    --shadow: 0 24px 60px rgba(42, 30, 20, 0.18);
    --small-shadow: 0 14px 34px rgba(42, 30, 20, 0.1);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(135deg, rgba(169, 54, 40, 0.1) 0 12%, transparent 12% 38%, rgba(40, 95, 76, 0.1) 38% 50%, transparent 50% 100%) 0 0 / 46px 46px,
        linear-gradient(90deg, rgba(216, 189, 141, 0.24), rgba(255, 250, 240, 0.75) 38%, rgba(240, 215, 154, 0.24)),
        var(--paper);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(30, 25, 21, 0.08) 1px, transparent 1px) 0 0 / 72px 72px,
        linear-gradient(rgba(30, 25, 21, 0.06) 1px, transparent 1px) 0 0 / 72px 72px;
    mask-image: linear-gradient(to bottom, #000, transparent 78%);
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 24px;
    align-items: center;
    min-height: 82px;
    padding: 12px clamp(18px, 4vw, 56px);
    border-bottom: 4px solid var(--red);
    background:
        linear-gradient(90deg, var(--charcoal), var(--green-dark) 32%, var(--red-dark) 70%, var(--charcoal)),
        var(--charcoal);
    color: var(--surface);
    box-shadow: 0 12px 32px rgba(30, 25, 21, 0.18);
}

.site-header::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -4px;
    left: 0;
    height: 4px;
    background:
        linear-gradient(45deg, transparent 35%, var(--gold) 35% 48%, transparent 48% 52%, var(--surface) 52% 65%, transparent 65%) 0 0 / 34px 4px;
}

.brand {
    display: inline-flex;
    gap: 14px;
    align-items: center;
    min-width: 0;
    color: var(--surface);
    font-weight: 800;
    text-decoration: none;
}

.brand-logos {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border: 2px solid var(--gold-soft);
    border-radius: 50%;
    background: var(--white);
    object-fit: contain;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(30, 25, 21, 0.18);
}

.brand-logo-ibk {
    width: 70px;
    border-radius: 14px;
    padding: 3px;
}

.brand-logo-diktisaintek {
    border-radius: 50%;
}

.brand-title {
    min-width: 0;
    line-height: 1.2;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.main-nav a,
.text-link {
    text-decoration: none;
}

.main-nav a {
    position: relative;
    padding: 10px 15px;
    border: 1px solid rgba(240, 215, 154, 0.35);
    border-radius: 6px;
    color: #f3e7cd;
    font-weight: 800;
}

.main-nav a:hover,
.main-nav a.is-active {
    border-color: var(--gold-soft);
    background: rgba(255, 250, 240, 0.16);
    color: var(--white);
}

.main-nav a.is-active::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: -8px;
    left: 10px;
    height: 3px;
    background: var(--gold);
}

.user-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    color: #f1dec0;
    font-size: 0.92rem;
}

.text-link {
    color: var(--gold-soft);
    font-weight: 800;
}

.flash-message {
    display: grid;
    gap: 3px;
    width: min(1120px, calc(100% - 36px));
    margin: 18px auto 0;
    padding: 13px 16px;
    border: 1px solid rgba(40, 95, 76, 0.28);
    border-left: 6px solid var(--green);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--small-shadow);
}

.flash-error {
    border-color: rgba(169, 54, 40, 0.3);
    border-left-color: var(--red);
}

.landing-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1080px);
    justify-content: center;
    place-items: center;
    width: 100%;
    min-height: calc(100vh - 82px);
    margin: 0 auto;
    padding: clamp(34px, 6vw, 78px) clamp(24px, 5vw, 64px);
    overflow: hidden;
}

.landing-shell::before,
.landing-shell::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: clamp(74px, 8vw, 122px);
    border: 2px solid rgba(67, 39, 28, 0.84);
    background-color: #f3c431;
    background-image: url("../img/nias-vertical-ornament.svg");
    background-repeat: repeat-y;
    background-position: center top;
    background-size: 100% auto;
    box-shadow:
        inset 0 0 0 5px rgba(255, 250, 240, 0.14),
        0 22px 42px rgba(30, 25, 21, 0.18);
    opacity: 0.96;
    pointer-events: none;
}

.landing-shell::before {
    left: clamp(14px, 3vw, 48px);
}

.landing-shell::after {
    right: clamp(14px, 3vw, 48px);
}

.landing-diamond {
    position: absolute;
    top: 50%;
    z-index: 0;
    width: clamp(52px, 5vw, 82px);
    height: clamp(150px, 18vw, 220px);
    background-image: url("../img/nias-diamond-stack.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: drop-shadow(0 10px 14px rgba(30, 25, 21, 0.18));
    pointer-events: none;
}

.landing-diamond-left {
    left: calc(clamp(14px, 3vw, 48px) + clamp(74px, 8vw, 122px) + clamp(16px, 2vw, 34px));
    transform: translateY(-50%);
}

.landing-diamond-right {
    right: calc(clamp(14px, 3vw, 48px) + clamp(74px, 8vw, 122px) + clamp(16px, 2vw, 34px));
    transform: translateY(-50%);
}

.landing-diamond-upper {
    top: calc(50% - clamp(190px, 20vw, 270px));
}

.landing-diamond-lower {
    top: calc(50% + clamp(190px, 20vw, 270px));
}

.landing-content,
.auth-card,
.feature-card,
.topic-card,
.test-card,
.video-placeholder,
.profile-card,
.team-card {
    border: 1px solid rgba(90, 58, 42, 0.22);
    border-radius: 8px;
    background: rgba(255, 250, 240, 0.95);
    box-shadow: var(--shadow);
}

.landing-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: min(1080px, 100%);
    overflow: hidden;
    padding: clamp(34px, 5.6vw, 74px);
    border: 3px double rgba(90, 58, 42, 0.42);
    box-shadow:
        0 0 0 10px rgba(255, 250, 240, 0.78),
        0 0 0 14px rgba(169, 54, 40, 0.13),
        0 0 0 18px rgba(40, 95, 76, 0.1),
        var(--shadow);
}

.landing-content::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 14px;
    background:
        linear-gradient(135deg, var(--red) 0 16%, transparent 16% 32%, var(--gold) 32% 48%, transparent 48% 64%, var(--green) 64% 80%, transparent 80%) 0 0 / 72px 14px;
}

.landing-content::after {
    content: "";
    position: absolute;
    right: 24px;
    bottom: 24px;
    width: 170px;
    height: 170px;
    border: 1px solid rgba(201, 150, 53, 0.45);
    background:
        linear-gradient(45deg, transparent 38%, rgba(169, 54, 40, 0.18) 38% 50%, transparent 50% 62%, rgba(40, 95, 76, 0.18) 62% 74%, transparent 74%) 0 0 / 26px 26px;
    opacity: 0.75;
}

.landing-content > * {
    position: relative;
    z-index: 1;
}

.landing-content .eyebrow,
.landing-content h1,
.landing-content .intro {
    text-align: center;
}

.landing-content h1,
.landing-content .intro {
    margin-right: auto;
    margin-left: auto;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--red);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 780px;
    margin-bottom: 18px;
    font-size: clamp(2.15rem, 5vw, 4.5rem);
    line-height: 1.02;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 10px;
    font-size: 1.25rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.intro,
.section-heading p,
.topic-card p,
.feature-card p,
.test-card p,
.video-placeholder p,
.team-card li,
.profile-card p,
.form-note,
.qr-panel span {
    color: var(--muted);
}

.intro {
    max-width: 720px;
    margin-bottom: 32px;
    font-size: 1.12rem;
}

.qr-panel {
    display: grid;
    grid-template-columns: 194px minmax(0, 1fr);
    gap: 22px;
    align-items: center;
    max-width: 740px;
    width: min(740px, 100%);
    margin: 10px auto 30px;
    padding: 20px;
    border: 2px solid var(--line-dark);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(240, 215, 154, 0.42), transparent 58%),
        #fffdf8;
    box-shadow: 12px 12px 0 rgba(169, 54, 40, 0.15);
}

.qr-frame {
    display: grid;
    place-items: center;
    width: 194px;
    aspect-ratio: 1;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--white);
}

.qr-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-copy {
    display: grid;
    gap: 8px;
}

.qr-label {
    color: var(--red);
    font-size: 0.75rem;
    font-weight: 900;
    text-transform: uppercase;
}

.qr-panel strong,
.qr-panel span {
    display: block;
}

.qr-panel strong {
    font-size: 1.28rem;
    line-height: 1.25;
}

.qr-panel span {
    font-size: 0.98rem;
}

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.mini-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    background: var(--gold);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 900;
    text-decoration: none;
}

.mini-action-dark {
    background: var(--green);
    color: var(--white);
}

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 138px;
    min-height: 46px;
    padding: 10px 18px;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 5px 0 rgba(30, 25, 21, 0.18);
}

.button:active,
.mini-action:active {
    transform: translateY(2px);
}

.button-primary {
    background: var(--red);
    color: var(--white);
}

.button-secondary {
    background: var(--gold);
    color: var(--ink);
}

.auth-shell,
.dashboard-shell,
.content-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: clamp(30px, 5vw, 66px) 0;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 82px);
    place-items: center;
}

.auth-card {
    position: relative;
    width: min(480px, 100%);
    overflow: hidden;
    padding: clamp(24px, 5vw, 40px);
}

.auth-card::before,
.feature-card::before,
.topic-card::before,
.test-card::before,
.team-card::before {
    content: "";
    display: block;
    height: 8px;
    margin: -1px -1px 22px;
    border-radius: 8px 8px 0 0;
    background:
        linear-gradient(90deg, var(--red) 0 24%, var(--gold) 24% 48%, var(--green) 48% 72%, var(--charcoal) 72%);
}

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

label {
    color: var(--ink);
    font-weight: 900;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--white);
    color: var(--ink);
    font: inherit;
}

input {
    min-height: 46px;
    padding: 10px 12px;
}

textarea {
    resize: vertical;
    min-height: 136px;
    padding: 12px;
}

input:focus,
textarea:focus {
    border-color: var(--green);
    outline: 3px solid rgba(40, 95, 76, 0.16);
}

.form-note {
    margin: 18px 0 0;
}

.form-note a {
    color: var(--red);
    font-weight: 900;
}

.section-heading {
    position: relative;
    margin-bottom: 28px;
    padding: 0 0 18px;
}

.section-heading::after {
    content: "";
    display: block;
    width: min(280px, 100%);
    height: 8px;
    margin-top: 16px;
    background:
        linear-gradient(135deg, var(--red) 0 15%, transparent 15% 30%, var(--gold) 30% 45%, transparent 45% 60%, var(--green) 60% 75%, transparent 75%) 0 0 / 56px 8px;
}

.section-heading h1 {
    margin-bottom: 12px;
    font-size: clamp(2rem, 4vw, 3.45rem);
}

.section-heading p {
    max-width: 800px;
}

.feature-grid,
.topic-list,
.test-grid,
.video-grid,
.about-grid {
    display: grid;
    gap: 18px;
}

.feature-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-card,
.topic-card,
.test-card,
.video-placeholder,
.team-card {
    padding: 0 22px 22px;
}

.feature-card {
    min-height: 260px;
    color: inherit;
    text-decoration: none;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 70px rgba(42, 30, 20, 0.2);
}

.feature-card span,
.topic-card span,
.test-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 34px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f2ddb0;
    color: var(--red);
    font-weight: 900;
}

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

.topic-card {
    min-height: 238px;
}

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

.test-card {
    min-height: 450px;
}

.quiz-card {
    display: flex;
    flex-direction: column;
}

.test-entry-card {
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.test-entry-card .button {
    width: fit-content;
    margin-top: auto;
}

.test-actions {
    margin-top: auto;
}

.test-entry-card .test-actions .button {
    margin-top: 0;
}

.entry-note {
    display: block;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.quiz-page {
    width: min(860px, 100%);
    margin: 0 auto;
}

.test-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}

.test-meta span,
.video-duration {
    width: fit-content;
    padding: 3px 8px;
    border: 1px solid rgba(90, 58, 42, 0.22);
    border-radius: 999px;
    background: rgba(240, 215, 154, 0.3);
    color: var(--line-dark);
    font-size: 0.82rem;
    font-weight: 900;
}

.test-part {
    display: grid;
    gap: 20px;
    padding-bottom: 26px;
    border-bottom: 1px solid rgba(90, 58, 42, 0.2);
}

.test-part + .test-part {
    padding-top: 8px;
}

.test-part-heading h2 {
    margin-bottom: 4px;
}

.test-part-heading p,
.question-instruction {
    color: var(--muted);
}

.reading-text {
    padding: 18px;
    border: 1px solid rgba(90, 58, 42, 0.22);
    border-left: 6px solid var(--green);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.72);
}

.reading-text span {
    color: var(--red);
    font-size: 0.78rem;
    font-weight: 900;
}

.reading-text h3 {
    margin: 4px 0 10px;
    font-size: 1.2rem;
}

.reading-text p {
    margin-bottom: 0;
    color: #4f463e;
}

.question-group {
    display: grid;
    gap: 14px;
}

.question-group h3 {
    margin: 0;
}

.choice-form {
    gap: 18px;
}

.choice-form fieldset {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0 0 16px;
    border: 0;
    border-bottom: 1px solid rgba(90, 58, 42, 0.18);
}

.choice-form legend {
    margin-bottom: 8px;
    color: var(--ink);
    font-weight: 900;
}

.choice-form label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 10px;
    border: 1px solid rgba(90, 58, 42, 0.18);
    border-radius: 6px;
    background: rgba(255, 253, 248, 0.72);
    color: #4f463e;
    font-weight: 700;
}

.choice-form input[type="radio"] {
    flex: 0 0 auto;
    width: 16px;
    min-height: 16px;
    margin-top: 4px;
}

.tf-list,
.short-answer-list,
.writing-list,
.topic-options {
    display: grid;
    gap: 10px;
}

.tf-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid rgba(90, 58, 42, 0.18);
    border-radius: 6px;
    background: rgba(255, 253, 248, 0.72);
}

.tf-item p {
    margin: 0;
    color: #4f463e;
    font-weight: 700;
}

.tf-item label,
.topic-options label {
    margin: 0;
}

.text-answer {
    display: grid !important;
    gap: 8px;
    align-items: stretch !important;
}

.text-answer span {
    color: #4f463e;
}

.text-answer input,
.text-answer textarea {
    background: var(--white);
}

.guiding-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    border-left: 5px solid var(--red);
    border-radius: 0 6px 6px 0;
    background: rgba(240, 215, 154, 0.26);
    color: var(--muted);
}

.guiding-questions strong {
    width: 100%;
    color: var(--ink);
}

.locked-test {
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 10px;
    min-height: 320px;
    margin-top: 12px;
    padding: 24px;
    border: 1px dashed rgba(169, 54, 40, 0.42);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(169, 54, 40, 0.08), rgba(240, 215, 154, 0.18)),
        rgba(255, 250, 240, 0.84);
}

.locked-test strong {
    margin-bottom: 8px;
    color: var(--red);
    font-size: 1.15rem;
}

.locked-test p {
    max-width: 420px;
}

.button-disabled {
    border-color: rgba(90, 58, 42, 0.28);
    background: #d6c8ad;
    color: #6b5e52;
    cursor: not-allowed;
    box-shadow: none;
}

.locked-link {
    color: var(--red);
    font-weight: 900;
    text-decoration: none;
}

.locked-link:hover {
    text-decoration: underline;
}

.test-card.is-locked {
    background: rgba(255, 250, 240, 0.82);
}

.quiz-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

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

.video-card {
    overflow: hidden;
    border: 1px solid rgba(90, 58, 42, 0.22);
    border-radius: 8px;
    background: rgba(255, 250, 240, 0.95);
    box-shadow: var(--shadow);
}

.video-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--charcoal);
}

.video-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(30, 25, 21, 0.02), rgba(30, 25, 21, 0.48)),
        linear-gradient(45deg, transparent 44%, rgba(240, 215, 154, 0.28) 44% 52%, transparent 52%);
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumb .play-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: 58px;
    height: 58px;
    margin: 0;
    transform: translate(-50%, -50%);
    background: var(--white);
}

.video-body {
    display: grid;
    gap: 10px;
    padding: 20px 22px 22px;
}

.video-source {
    color: var(--red);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.video-body h2 {
    margin-bottom: 0;
}

.video-body strong {
    color: var(--green-dark);
    line-height: 1.35;
}

.video-body p {
    margin-bottom: 4px;
    color: var(--muted);
}

.video-body .mini-action {
    width: fit-content;
}

.video-placeholder {
    position: relative;
    display: grid;
    align-content: end;
    min-height: 350px;
    overflow: hidden;
    border-color: rgba(255, 250, 240, 0.18);
    background:
        linear-gradient(rgba(30, 25, 21, 0.04), rgba(30, 25, 21, 0.82)),
        linear-gradient(45deg, transparent 42%, rgba(255, 250, 240, 0.24) 42% 50%, transparent 50% 58%, rgba(201, 150, 53, 0.42) 58% 66%, transparent 66%) 0 0 / 42px 42px,
        linear-gradient(135deg, #285f4c, #a93628 62%, #28231f);
    color: var(--white);
}

.video-placeholder::before {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(255, 250, 240, 0.35);
    border-radius: 6px;
}

.video-placeholder > * {
    position: relative;
}

.video-placeholder p {
    color: #f8e7c9;
}

.play-mark {
    width: 70px;
    height: 70px;
    margin-bottom: 96px;
    clip-path: polygon(28% 18%, 28% 82%, 82% 50%);
    background: var(--white);
    filter: drop-shadow(0 10px 18px rgba(30, 25, 21, 0.28));
}

.profile-card {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 24px;
    padding: 22px;
}

.profile-card img {
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 10px 10px 0 rgba(169, 54, 40, 0.15);
}

.team-card ul {
    display: grid;
    gap: 12px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.team-card li {
    padding: 12px;
    border-left: 5px solid var(--red);
    border-radius: 0 6px 6px 0;
    background: #fffdf8;
}

.wiki-shell {
    display: grid;
    grid-template-columns: 210px minmax(0, 760px) 240px;
    gap: 32px;
    width: min(1320px, calc(100% - 40px));
    margin: 0 auto;
    padding: clamp(30px, 5vw, 58px) 0 80px;
}

.wiki-toc,
.wiki-summary {
    position: sticky;
    top: 112px;
    align-self: start;
}

.wiki-toc {
    border-right: 1px solid rgba(90, 58, 42, 0.22);
    padding: 8px 18px 8px 0;
}

.wiki-toc p {
    margin-bottom: 12px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 900;
}

.wiki-toc a {
    display: block;
    padding: 7px 0;
    border-bottom: 1px solid rgba(90, 58, 42, 0.12);
    color: var(--green-dark);
    font-size: 0.93rem;
    font-weight: 700;
    text-decoration: none;
}

.wiki-toc a:hover {
    color: var(--red);
}

.wiki-article {
    padding: 0 8px;
    background: rgba(255, 250, 240, 0.72);
}

.wiki-header {
    border-bottom: 1px solid rgba(90, 58, 42, 0.25);
    padding-bottom: 22px;
    margin-bottom: 8px;
}

.wiki-header h1 {
    max-width: none;
    margin-bottom: 10px;
    font-size: clamp(2.2rem, 4vw, 3.8rem);
    font-weight: 800;
}

.wiki-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 0.9rem;
}

.wiki-meta span + span::before {
    content: "/";
    margin-right: 10px;
    color: var(--line-dark);
}

.wiki-lead {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--ink);
    font-size: 1.08rem;
}

.wiki-note {
    max-width: 720px;
    margin-top: 18px;
    padding: 12px 14px;
    border-left: 4px solid var(--green);
    background: rgba(240, 215, 154, 0.28);
    color: #4f463e;
}

.module-index {
    max-width: 760px;
    margin-top: 24px;
    border-top: 1px solid rgba(90, 58, 42, 0.2);
    padding-top: 20px;
}

.module-index h2 {
    margin-bottom: 10px;
    font-size: 1.25rem;
}

.module-index ol {
    margin: 10px 0 0;
    padding-left: 24px;
    color: #4f463e;
}

.module-index li {
    margin-bottom: 7px;
}

.wiki-section {
    border-bottom: 1px solid rgba(90, 58, 42, 0.2);
    padding: 26px 0;
}

.wiki-section h2 {
    border-bottom: 1px solid rgba(90, 58, 42, 0.24);
    padding-bottom: 7px;
    margin-bottom: 14px;
    color: var(--ink);
    font-size: 1.55rem;
    font-weight: 800;
}

.wiki-section p {
    max-width: 760px;
    margin-bottom: 13px;
    color: #4f463e;
}

.wiki-figure {
    margin: 18px 0 0;
}

.wiki-hero-image {
    margin: 22px 0 0;
}

.wiki-hero-image img,
.wiki-figure img {
    width: 100%;
    border: 1px solid rgba(90, 58, 42, 0.24);
    background: var(--surface);
    object-fit: cover;
}

.wiki-hero-image img {
    max-height: 360px;
}

.wiki-figure img {
    max-height: 330px;
}

.wiki-figure-small img {
    width: min(240px, 100%);
}

.figure-placeholder {
    display: grid;
    place-items: center;
    min-height: 220px;
    border: 1px dashed rgba(90, 58, 42, 0.42);
    background:
        linear-gradient(45deg, rgba(169, 54, 40, 0.08) 0 25%, transparent 25% 50%, rgba(40, 95, 76, 0.08) 50% 75%, transparent 75%) 0 0 / 34px 34px,
        rgba(255, 250, 240, 0.72);
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.wiki-hero-image figcaption,
.wiki-figure figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.wiki-table {
    width: 100%;
    margin-top: 16px;
    border-collapse: collapse;
    background: rgba(255, 250, 240, 0.72);
}

.wiki-table th,
.wiki-table td {
    border: 1px solid rgba(90, 58, 42, 0.24);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
}

.wiki-table th {
    background: rgba(240, 215, 154, 0.38);
    color: var(--ink);
}

.wiki-steps {
    margin: 0;
    padding-left: 24px;
    color: #4f463e;
}

.wiki-steps li {
    margin-bottom: 9px;
}

.wiki-summary {
    border-left: 1px solid rgba(90, 58, 42, 0.22);
    padding: 8px 0 8px 18px;
}

.wiki-summary h2 {
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.wiki-summary dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

.wiki-summary dt {
    color: var(--red);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.wiki-summary dd {
    margin: -8px 0 4px;
    color: var(--muted);
    font-size: 0.94rem;
}

.summary-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 40px;
    margin-top: 18px;
    padding: 9px 12px;
    border: 1px solid var(--line-dark);
    border-radius: 6px;
    background: var(--green);
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

@media (max-width: 980px) {
    .site-header {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .main-nav {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 6px;
    }

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

    .landing-shell,
    .wiki-shell,
    .feature-grid,
    .topic-list,
    .test-grid,
    .video-grid,
    .about-grid,
    .profile-card {
        grid-template-columns: 1fr;
    }

    .wiki-shell {
        gap: 20px;
    }

    .wiki-toc,
    .wiki-summary {
        position: static;
        border: 0;
        padding: 0;
    }

    .wiki-toc {
        display: flex;
        gap: 12px;
        overflow-x: auto;
        border-bottom: 1px solid rgba(90, 58, 42, 0.22);
        padding-bottom: 10px;
    }

    .wiki-toc p {
        flex: 0 0 auto;
        margin: 0;
        padding: 7px 0;
    }

    .wiki-toc a {
        flex: 0 0 auto;
        border-bottom: 0;
    }

    .wiki-summary {
        border-top: 1px solid rgba(90, 58, 42, 0.22);
        padding-top: 18px;
    }
}

@media (max-width: 600px) {
    .site-header {
        min-height: auto;
    }

    .landing-shell::before,
    .landing-shell::after,
    .landing-diamond,
    .auth-shell::before,
    .auth-shell::after {
        display: none;
    }

    .brand {
        align-items: center;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
        padding: 3px;
    }

    .brand-logo-ibk {
        width: 58px;
        border-radius: 12px;
    }

    .landing-content,
    .auth-card,
    .profile-card {
        padding: 20px;
    }

    .feature-card,
    .topic-card,
    .test-card,
    .video-placeholder,
    .team-card {
        padding-right: 18px;
        padding-left: 18px;
    }

    .qr-panel {
        grid-template-columns: 1fr;
        box-shadow: 8px 8px 0 rgba(169, 54, 40, 0.15);
    }

    .qr-frame {
        width: min(230px, 100%);
    }

    .auth-actions,
    .button,
    .qr-actions,
    .mini-action {
        width: 100%;
    }

    .wiki-shell {
        width: min(100% - 28px, 1320px);
    }

    .wiki-table {
        display: block;
        overflow-x: auto;
    }
}
