* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    --background: #dfe3e7;
    --panel: #f5f5f5;
    --text: #1a1a1a;
    --muted: #4e5358;
    --accent: #1e1e1e;
    --border: #c6ccd1;
    --soft: #efefef;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--text);
    background: var(--background);
    font-family: Arial, Helvetica, sans-serif;
}

.container {
    width: min(100%, 700px);
    padding: clamp(28px, 6vw, 52px);
    text-align: center;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 10px 26px rgba(21, 25, 28, 0.08);
}

.eyebrow {
    margin: 0 0 18px;
    color: #2d2d2d;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 18px;
    color: #111111;
    font-size: clamp(2.6rem, 7vw, 5rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

h1 span {
    display: block;
    color: var(--muted);
    font-size: 0.42em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

p {
    margin: 12px 0;
    color: var(--muted);
    line-height: 1.6;
}

.status {
    margin-top: 18px;
    color: var(--text);
    font-size: 1rem;
}

.warning {
    margin-top: 8px;
    color: #2f2f2f;
    font-size: 0.95rem;
}

.available-pages-panel {
    margin-top: 26px;
    padding-top: 12px;
    text-align: left;
}

.available-pages-label {
    margin: 0 0 12px;
    color: #2a2a2a;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.option-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.05);
}

.option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.option-status {
    color: #b35a2e;
    font-weight: 700;
}

.option-card h2 {
    margin: 0;
    color: #1a1a1a;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    letter-spacing: -0.04em;
}

.option-card p {
    margin: 0;
    color: var(--muted);
}

.option-button {
    width: fit-content;
    margin-top: 8px;
    padding: 12px 18px;
    color: #ffffff;
    background: #111111;
    border: 1px solid #111111;
    border-radius: 0;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.72;
    cursor: not-allowed;
}

button {
    margin-top: 20px;
    padding: 12px 18px;
    color: #ffffff;
    background: var(--accent);
    border: 1px solid #101010;
    border-radius: 0;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

button.secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

button:hover,
button:focus-visible {
    filter: brightness(1.06);
}

button:focus-visible {
    outline: 2px solid #111111;
    outline-offset: 2px;
}

.return-message {
    min-height: 1.5em;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--muted);
}

.stealth-page {
    background: #eaeced;
}

.stealth-container {
    width: min(100%, 560px);
    padding: clamp(28px, 5vw, 42px);
    background: rgba(245, 245, 245, 0.96);
    border-color: #b7bdc2;
}

.error-box {
    position: relative;
    z-index: 1;
    width: min(100%, 580px);
    margin: clamp(24px, 10vh, 96px) auto;
    padding: 22px 24px 20px;
    overflow: hidden;
    color: #d7f8e4;
    background: #111c19;
    border: 1px solid #5e9f7a;
    box-shadow: 8px 8px 0 rgb(26 61 43 / 18%), 0 0 0 5px rgb(255 255 255 / 58%);
    font-family: "Courier New", Courier, monospace;
}

.error-box::before,
.error-box::after {
    position: absolute;
    inset: 0;
    pointer-events: none;
    content: "";
}

.error-box::before {
    z-index: 2;
    background: repeating-linear-gradient(0deg, transparent 0 9px, rgb(173 255 204 / 14%) 10px 11px);
    mix-blend-mode: screen;
    animation: error-scan 5s linear infinite;
}

.error-box::after {
    z-index: 3;
    top: 35%;
    height: 2px;
    background: #b5ffd0;
    box-shadow: 0 0 8px #7dffac;
    opacity: 0.7;
    animation: error-line 3.2s steps(4, end) infinite;
}

.error-code,
.error-status,
.access-page .error-box h1 {
    position: relative;
    z-index: 1;
}

.error-code {
    margin: 0 0 16px;
    color: #83dca1;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
}

.access-page .error-box h1 {
    max-width: 100%;
    margin: 0;
    color: #e1ffeb;
    font-size: clamp(0.68rem, 1.5vw, 0.9rem);
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}

.error-status {
    margin: 18px 0 0;
    padding-top: 12px;
    color: #ffcb79;
    border-top: 1px dashed #477a5b;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
}

@keyframes error-scan {
    from { transform: translateY(-10px); }
    to { transform: translateY(10px); }
}

@keyframes error-line {
    0%, 100% { transform: translateY(-100px); }
    50% { transform: translateY(170px); }
}

@media (max-width: 560px) {
    body {
        padding: 12px;
    }

    button {
        width: 100%;
    }

    .error-box {
        margin-top: 10vh;
        padding: 18px 16px;
    }
}
    border: 1px solid var(--border);
    border-radius: 2px;
    font: inherit;
}

.account-form button {
    width: 100%;
    margin-top: 16px;
}

.account-details {
    margin-top: 24px;
    padding: 18px;
    background: #eef4f9;
    border: 1px solid var(--border);
}

.account-details h2 {
    margin: 0;
    color: #183d63;
    font-size: 1.1rem;
}

.account-details strong {
    display: inline-block;
    padding: 10px 14px;
    color: #183d63;
    background: #ffffff;
    border: 1px dashed var(--accent);
    font-size: 1.3rem;
    letter-spacing: 0.12em;
}

@media (max-width: 620px) {
    .auth-forms {
        grid-template-columns: 1fr;
    }
}

/* 403 access page */
.access-page {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    background:
        linear-gradient(rgb(255 255 255 / 78%), rgb(255 255 255 / 78%)),
        linear-gradient(90deg, rgb(47 103 161 / 8%) 1px, transparent 1px),
        linear-gradient(rgb(47 103 161 / 8%) 1px, transparent 1px),
        #dce7f2;
    background-size: auto, 32px 32px, 32px 32px, auto;
}

.access-page::before,
.access-page::after {
    position: fixed;
    z-index: 0;
    width: 360px;
    height: 360px;
    border: 1px solid rgb(47 103 161 / 16%);
    content: "";
    pointer-events: none;
    transform: rotate(45deg);
}

.access-page::before {
    top: -220px;
    left: -190px;
}

.access-page::after {
    right: -190px;
    bottom: -220px;
}

.access-page .container {
    position: relative;
    z-index: 1;
    width: min(100%, 760px);
    margin: clamp(24px, 6vh, 64px) auto;
    padding: clamp(28px, 6vw, 64px);
    border: 1px solid rgb(143 167 191 / 80%);
    box-shadow: 0 24px 60px rgb(53 79 104 / 18%), 0 0 0 8px rgb(255 255 255 / 58%);
}

.access-page .cool-briks-logo {
    width: min(100%, 470px);
    margin: -10px auto 10px;
}

.access-page .eyebrow {
    display: inline-block;
    margin: 0 0 18px;
    padding: 7px 12px;
    color: #24527f;
    background: #eef4f9;
    border: 1px solid #b5c8d9;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
}

.access-page h1 {
    margin-bottom: 20px;
    font-size: clamp(3rem, 10vw, 6.4rem);
    letter-spacing: 0.02em;
}

.access-page h1 span {
    margin-top: 8px;
    color: #526273;
    font-size: 0.22em;
    letter-spacing: 0.28em;
}

.access-page main > p:not(.eyebrow):not(.status):not(.return-message) {
    max-width: 540px;
    margin-right: auto;
    margin-left: auto;
    font-size: 0.95rem;
}

.access-page .status {
    max-width: 540px;
    margin: 26px auto 0;
    padding: 14px 18px;
    color: #183d63;
    background: #f4f8fb;
    border-left: 4px solid var(--accent);
    text-align: left;
}

.access-page .button,
.access-page #return-button {
    min-width: 190px;
    margin-top: 26px;
}

.access-page .button {
    margin-right: 6px;
}

.access-page #return-button {
    margin-left: 6px;
}

.access-page .return-message {
    color: #526273;
}

@media (max-width: 560px) {
    .access-page .container {
        padding: 26px 20px;
    }

    .access-page .cool-briks-logo {
        width: min(100%, 390px);
    }

    .access-page .button,
    .access-page #return-button {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-left: 0;
    }
}

/* Read-only archive page */
.archive-page {
    background: #edf3f8;
}

.archive-shell {
    width: min(100%, 980px);
    padding: clamp(24px, 5vw, 48px);
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: 0 14px 36px rgb(53 79 104 / 15%);
}

.archive-header,
.archive-nav,
.workspace-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.archive-header h1 {
    margin-bottom: 8px;
    font-size: clamp(2.4rem, 7vw, 4.5rem);
}

.archive-subtitle {
    margin: 0;
}

.archive-status,
.readonly-label {
    display: grid;
    gap: 5px;
    padding: 10px 12px;
    color: #24527f;
    background: #eef4f9;
    border: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
}

.archive-status span {
    color: var(--accent);
}

.archive-nav {
    justify-content: flex-start;
    margin-top: 28px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.archive-tab,
.archive-link {
    margin: 0;
    padding: 9px 12px;
    font-size: 0.78rem;
}

.archive-tab:not(.is-active) {
    color: var(--accent);
    background: #ffffff;
}

.archive-link {
    color: var(--accent);
    text-decoration: none;
}

.archive-toolbar {
    margin: 24px 0 16px;
}

.archive-toolbar label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 0.8rem;
}

#archive-search {
    width: 100%;
    padding: 11px;
    border: 1px solid var(--border);
    font: inherit;
}

.archive-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.archive-card {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 15px;
    color: var(--text);
    background: #eef4f9;
    border: 1px solid var(--border);
    text-align: left;
}

.archive-card span {
    color: var(--muted);
    font-size: 0.8rem;
}

.archive-empty {
    grid-column: 1 / -1;
}

.archive-workspace {
    margin-top: 22px;
    padding: 18px;
    background: #f7fafc;
    border: 1px solid var(--border);
}

.workspace-heading .eyebrow {
    margin-bottom: 8px;
}

.workspace-heading h2 {
    margin: 0;
    color: #183d63;
}

.archive-description {
    margin: 14px 0;
}

.archive-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.archive-actions button {
    margin: 0;
    padding: 9px 12px;
    font-size: 0.72rem;
}

.archive-actions button:nth-child(3),
.archive-actions button:nth-child(4),
.archive-actions button:nth-child(5),
.archive-actions button:nth-child(6) {
    color: var(--accent);
    background: #ffffff;
}

.archive-opening-note {
    margin-bottom: 0;
    font-size: 0.8rem;
}

#snapshot-viewer {
    width: 100%;
    height: 220px;
    margin-top: 16px;
    border: 1px solid var(--border);
}

.archive-message {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .archive-header,
    .workspace-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .archive-list {
        grid-template-columns: 1fr;
    }

    .archive-nav {
        align-items: stretch;
        flex-direction: column;
    }
}
