:root {
    --void: #07080c;
    --panel: #101218;
    --panel-2: #161920;
    --line: #2a3140;
    --text: #e6e9f0;
    --dim: #8b93a7;
    --mint: #3dffc8;
    --violet: #7c5cff;
    --warn: #ff5d7a;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: "IBM Plex Sans", system-ui, sans-serif;
    background:
        radial-gradient(ellipse 70% 50% at 0% 0%, rgba(124, 92, 255, 0.16), transparent 55%),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(61, 255, 200, 0.08), transparent 50%),
        var(--void);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(230, 233, 240, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(230, 233, 240, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 88%);
}

.shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
}

header {
    padding: 1.75rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

h1 {
    margin: 0;
    font-family: Syne, sans-serif;
    font-weight: 800;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    line-height: 0.85;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 0;
}

section {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

section + section {
    border-left: 1px solid var(--line);
    background: rgba(16, 18, 24, 0.55);
}

.kicker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--dim);
}

.dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--line);
    box-shadow: 0 0 0 4px rgba(42, 49, 64, 0.35);
}

.has-signal .dot {
    background: var(--mint);
    box-shadow: 0 0 0 4px rgba(61, 255, 200, 0.16);
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-height: 0;
}

label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

textarea {
    width: 100%;
    min-height: 16rem;
    flex: 1;
    resize: vertical;
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font: 500 1rem/1.55 "IBM Plex Sans", system-ui, sans-serif;
    outline: none;
}

textarea:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25);
}

button {
    align-self: start;
    border: 0;
    background: var(--violet);
    color: #fff;
    font-family: Syne, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem 1.35rem;
    cursor: pointer;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }

.preview {
    position: relative;
    flex: 1;
    min-height: 16rem;
    display: flex;
}

.output {
    flex: 1;
    width: 100%;
    min-height: 16rem;
    border: 1px dashed var(--line);
    background: #f3efe6;
}

.has-signal .output {
    border-style: solid;
    border-color: rgba(61, 255, 200, 0.35);
}

.hint {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 1.2rem;
    pointer-events: none;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--dim);
    text-align: center;
}

.has-signal .hint { display: none; }

.error {
    display: none;
    margin: 0;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--warn);
}

.has-error .error { display: block; }

.has-error .output {
    border-style: solid;
    border-color: rgba(255, 93, 122, 0.45);
}

@media (max-width: 800px) {
    header { padding-left: 1.1rem; padding-right: 1.1rem; }
    main { grid-template-columns: 1fr; }
    section + section { border-left: 0; border-top: 1px solid var(--line); }
    textarea, .output { min-height: 12rem; }
}
