:root {
    color-scheme: dark;
    font-family: "Courier New", Courier, monospace;
    background: #090909;
    color: #d0d0d0;
    --red: #a80d13;
    --paper: #f4ecd7;
    --ink: #211f1b;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 50% 38%, rgb(94 14 16 / 22%), transparent 32rem),
        repeating-linear-gradient(135deg, #0c0c0c 0 3px, #080808 3px 7px);
}

button,
textarea,
input {
    font: inherit;
}

.page-shell {
    width: min(940px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding-bottom: 2rem;
    background:
        linear-gradient(110deg, transparent 35%, rgb(90 10 12 / 12%) 35% 65%, transparent 65%),
        radial-gradient(ellipse at center 48%, rgb(255 255 255 / 3%), transparent 60%);
}

.masthead {
    padding: 1.2rem 1rem 1rem;
    text-align: center;
    background: rgb(12 12 12 / 90%);
    border-bottom: 1px solid #292929;
}

.brand {
    display: inline-block;
    color: #f4f4f4;
    font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
    font-size: clamp(2.8rem, 8vw, 4.5rem);
    line-height: 1;
    letter-spacing: .025em;
    text-decoration: none;
    transform: rotate(-1deg);
}

.brand span {
    color: #777;
}

.brand strong {
    color: var(--red);
    font-weight: inherit;
}

.masthead > p {
    margin: 1rem 0 .35rem;
    font-size: clamp(.72rem, 2vw, 1rem);
    letter-spacing: .04em;
}

details {
    font-size: .85rem;
}

summary {
    color: #cb2d32;
    cursor: pointer;
    text-transform: uppercase;
}

.explanation {
    max-width: 720px;
    margin: .8rem auto 0;
    text-align: left;
    line-height: 1.5;
}

.instructions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.5rem clamp(1rem, 5vw, 3rem);
    padding: 1rem;
    color: #929292;
    background: rgb(16 16 16 / 86%);
    border: 2px dashed #414141;
    border-radius: .4rem;
}

.instructions div {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .84rem;
    line-height: 1.25;
}

.instructions b {
    color: var(--red);
    font-family: Impact, sans-serif;
    font-size: 2.2rem;
    font-weight: 400;
}

.paper {
    --ruler-offset: clamp(4.5rem, 10vw, 6rem);
    position: relative;
    min-height: 440px;
    margin: 1.5rem clamp(1rem, 5vw, 3rem);
    padding: clamp(1.4rem, 5vw, 2.5rem);
    padding-left: calc(var(--ruler-offset) + 1.25rem);
    overflow: hidden;
    color: var(--ink);
    background: repeating-linear-gradient(#f6eed9 0 31px, #ded5be 31px 32px);
    border-radius: .7rem 1.2rem .8rem 1rem;
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 45%);
}

.paper::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--ruler-offset);
    width: 2px;
    content: "";
    background: rgb(170 13 19 / 15%);
    pointer-events: none;
}

.paper::after {
    position: absolute;
    right: -1.5rem;
    bottom: -1.3rem;
    width: 10rem;
    height: 10rem;
    content: "SECRET";
    display: grid;
    place-items: center;
    color: rgb(168 13 19 / 10%);
    border: .6rem double rgb(168 13 19 / 10%);
    border-radius: 50%;
    font-family: Impact, sans-serif;
    font-size: 2rem;
    transform: rotate(-18deg);
    pointer-events: none;
}

label,
.paper h1 {
    display: block;
    margin: 0 0 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

textarea {
    display: block;
    width: 100%;
    min-height: 270px;
    padding: .8rem;
    resize: vertical;
    color: #161616;
    background: rgb(255 255 255 / 44%);
    border: 1px solid #b8ae98;
    border-radius: .2rem;
    outline: none;
}

textarea:focus,
input:focus,
button:focus-visible {
    outline: 3px solid rgb(168 13 19 / 35%);
    outline-offset: 2px;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.primary,
#copy-button {
    min-height: 2.8rem;
    padding: .65rem 1.3rem;
    color: #eee;
    background: #171717;
    border: 0;
    border-radius: .25rem;
    font-weight: 700;
}

.primary {
    margin-top: 1.2rem;
}

.primary span {
    color: #d22229;
}

.copy-row {
    display: flex;
    gap: .5rem;
}

.copy-row input {
    min-width: 0;
    flex: 1;
    padding: .7rem;
    color: #171717;
    background: rgb(255 255 255 / 70%);
    border: 1px solid #a59a82;
}

.share-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: start;
}

.qr-wrap {
    margin-top: .15rem;
}

#qr-code {
    display: block;
    width: min(152px, 42vw);
    height: auto;
    background: white;
    border: .4rem solid white;
}

.warning {
    margin: -.5rem 0 1.5rem;
    padding: 1rem;
    color: #f5e9d2;
    background: #7f0c10;
    border-radius: .3rem;
}

.warning h1,
.warning p {
    margin: 0;
}

.warning p {
    margin-top: .5rem;
}

.cleartext {
    min-height: 230px;
    padding: .8rem;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    background: rgb(255 255 255 / 35%);
}

.cleartext a {
    color: #780b0f;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

#status {
    position: relative;
    z-index: 1;
    min-height: 2rem;
    margin-top: 1rem;
    font-weight: 700;
}

#status.error {
    color: #9a0b10;
}

[hidden] {
    display: none !important;
}

@media (max-width: 680px) {
    .instructions {
        grid-template-columns: 1fr;
        gap: .2rem;
    }

    .paper {
        padding-left: clamp(1.4rem, 5vw, 2.5rem);
    }

    .paper::before {
        display: none;
    }

    .share-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .qr-wrap {
        margin-top: 0;
        justify-self: center;
    }

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