:root {
    --bg: #3a3a3a;
    --text: #ffffff;
    --muted: #cfcfcf;
    --line: #6a6a6a;
    --font: "Cascadia Mono", "Segoe UI Symbol", "Noto Sans Symbols 2", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: var(--text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.main-nav {
    border-bottom: 1px solid var(--line);
}

.nav-container {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
}

.logo {
    display: inline-block;
    color: var(--text);
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
}

.logo-mark {
    display: grid;
    gap: 0.15rem;
    padding: 0.45rem 0.8rem;
    letter-spacing: 0.22em;
    font-size: 0.78rem;
    line-height: 1.15;
    background:
        linear-gradient(var(--text), var(--text)) left top / 12px 1.5px no-repeat,
        linear-gradient(var(--text), var(--text)) left top / 1.5px 12px no-repeat,
        linear-gradient(var(--text), var(--text)) right top / 12px 1.5px no-repeat,
        linear-gradient(var(--text), var(--text)) right top / 1.5px 12px no-repeat,
        linear-gradient(var(--text), var(--text)) left bottom / 12px 1.5px no-repeat,
        linear-gradient(var(--text), var(--text)) left bottom / 1.5px 12px no-repeat,
        linear-gradient(var(--text), var(--text)) right bottom / 12px 1.5px no-repeat,
        linear-gradient(var(--text), var(--text)) right bottom / 1.5px 12px no-repeat;
}

.page {
    flex: 1;
    width: min(40rem, calc(100% - 2.5rem));
    margin: 0 auto;
    padding: 3rem 0 4rem;
}

h1 {
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.lead,
.legal p {
    margin: 0 0 1.5rem;
    color: var(--muted);
}

.convert-form {
    display: grid;
    gap: 1rem;
}

#waf-captcha:empty {
    display: none;
}

.convert-form label,
.width-field {
    display: grid;
    gap: 0.35rem;
}

.width-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.width-control input[type="range"] {
    flex: 1;
    height: 1.6rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    accent-color: var(--text);
    cursor: pointer;
}

.width-control input[type="number"] {
    width: 4.5rem;
}

.hint {
    color: var(--muted);
    font-size: 0.85rem;
}

.convert-form input,
.convert-form select,
.convert-form button,
.convert-form input::file-selector-button {
    font: inherit;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 0;
    padding: 0.55rem 0.7rem;
}

.convert-form select {
    background-color: var(--bg);
    color: var(--text);
    font-family: "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.4;
}

.convert-form select option {
    background-color: #ffffff;
    color: #1a1a1a;
    font-family: "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.convert-form input[type="file"]::file-selector-button,
.convert-form input[type="file"]::-webkit-file-upload-button {
    margin-right: 0.75rem;
    cursor: pointer;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
}

.convert-form button {
    justify-self: start;
    cursor: pointer;
}

.convert-form button:disabled {
    color: var(--muted);
    cursor: not-allowed;
}

.convert-status {
    margin: 1rem 0 0;
    color: var(--muted);
}

.copy-btn {
    margin-top: 1rem;
    font: inherit;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--line);
    padding: 0.55rem 0.7rem;
    cursor: pointer;
}

.ascii-stage {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    display: flex;
    justify-content: center;
}

.ascii-output {
    margin: 1.25rem 0 0;
    overflow: hidden;
    white-space: pre;
    line-height: 1.05;
    font-size: 0.72rem;
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 1.25rem;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.site-footer p {
    margin: 0.75rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .page {
        width: min(40rem, calc(100% - 1.5rem));
        padding-top: 2rem;
    }

    .convert-form button[type="submit"] {
        position: fixed;
        z-index: 3;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        margin: 0;
        padding: 0.9rem 1rem calc(0.9rem + env(safe-area-inset-bottom));
        background: var(--bg);
        border-width: 1px 0 0;
    }

    body:has(.convert-form) {
        padding-bottom: calc(3.4rem + env(safe-area-inset-bottom));
    }
}
