:root {
    color-scheme: dark;
    font-family: Arial, Helvetica, sans-serif;
    background: #000;
    color: #fff;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: #000;
    color: #fff;
}

button,
input,
textarea {
    font: inherit;
}

button,
.button-link {
    border: 1px solid #666;
    border-radius: 0.45rem;
    background: #171717;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
}

button:hover,
button:focus-visible,
.button-link:hover,
.button-link:focus-visible {
    border-color: #fff;
    background: #292929;
    outline: none;
}

.viewer-page {
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.display-text {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.2rem 1.2rem 5.5rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.25;
    font-size: 44px;
}

.viewer-controls {
    position: fixed;
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem;
    border: 1px solid #444;
    border-radius: 0.6rem;
    background: rgba(0, 0, 0, 0.88);
    box-shadow: 0 0.2rem 1rem rgba(0, 0, 0, 0.65);
}

.viewer-controls button {
    min-width: 3rem;
    min-height: 2.8rem;
    padding: 0.45rem 0.8rem;
    font-weight: 700;
}

.font-size-label {
    min-width: 3.4rem;
    text-align: center;
    font-size: 0.9rem;
    color: #ddd;
}

.connection-status {
    min-width: 6.5rem;
    padding: 0 0.4rem;
    font-size: 0.9rem;
    color: #bbb;
}

.connection-status.connected {
    color: #b9ffb9;
}

.connection-status.disconnected {
    color: #ffb8b8;
}

.editor-page {
    min-height: 100vh;
    padding: 1rem;
}

.editor-card {
    width: min(1100px, 100%);
    margin: 0 auto;
}

.narrow-card {
    width: min(480px, 100%);
    padding-top: 8vh;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.editor-header h1,
.narrow-card h1 {
    margin: 0 0 0.35rem;
}

.editor-header p {
    margin: 0;
    color: #bbb;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-actions form {
    margin: 0;
}

label {
    display: block;
    margin: 0 0 0.4rem;
    font-weight: 700;
}

input[type="password"],
textarea {
    width: 100%;
    border: 1px solid #666;
    border-radius: 0.45rem;
    background: #080808;
    color: #fff;
}

input[type="password"] {
    margin-bottom: 1rem;
    padding: 0.75rem;
}

textarea {
    min-height: 68vh;
    resize: vertical;
    padding: 0.85rem;
    line-height: 1.4;
}

input[type="password"]:focus,
textarea:focus {
    border-color: #fff;
    outline: 2px solid #777;
    outline-offset: 1px;
}

.primary-button,
.secondary-button,
.button-link {
    min-height: 2.7rem;
    padding: 0.65rem 1rem;
}

.primary-button {
    background: #fff;
    color: #000;
    border-color: #fff;
    font-weight: 700;
}

.primary-button:hover,
.primary-button:focus-visible {
    background: #ddd;
    color: #000;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.message {
    margin: 0.75rem 0;
    padding: 0.75rem;
    border: 1px solid #666;
    border-radius: 0.45rem;
}

.message.success {
    border-color: #6ca96c;
}

.message.error {
    border-color: #b96969;
}

.secondary-link {
    margin-top: 1rem;
}

a {
    color: #fff;
}

@media (max-width: 700px) {
    .editor-header {
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .display-text {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .viewer-controls {
        left: max(0.5rem, env(safe-area-inset-left));
        right: max(0.5rem, env(safe-area-inset-right));
        justify-content: center;
    }

    .connection-status {
        min-width: 0;
    }
}
