body {
    margin: 0;
    padding: 0;

    overflow: hidden;
}

.screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #08080a;
    background-image: radial-gradient(circle at 50% 32%, #16161c 0%, #08080a 68%);
    color: #d6d6da;
}

.container {
    width: min(640px, 92%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.masthead {
    text-align: center;
}

.title {
    margin: 0;
    color: #ececef;
    font-family: monospace;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 4px;
}

.subtitle {
    margin: 8px 0 0;
    color: #6b6b73;
    font-family: monospace;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.textarea-wrapper {
    position: relative;
    width: 100%;
}

.textfield {
    height: 50px;
    width: 100%;
    padding: 0 10px;
    line-height: 1;
    padding-top: 25px;
    margin-bottom: 20px;
    padding-left: 25px;
    resize: none;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    background-color: #0e0e12;
    border: 1px solid #2b2b33;
    border-radius: 10px;
    font-size: 20px;
    color: #d8d8de;
    caret-color: #6ea8fe;
    cursor: text;
    font-family: monospace;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.textfield:focus {
    outline: none;
    border-color: #464654;
    box-shadow: 0 0 0 3px rgba(110, 168, 254, 0.12);
}

.fake-placeholder {
    position: absolute;
    top: 26px;
    left: 24px;
    font-size: 20px;
    color: #57575f;
    opacity: 0.85;
    pointer-events: none;
    transition:
        transform 0.25s ease-out,
        opacity 0.35s ease-out;
    font-family: monospace;
}

.fake-placeholder.exit {
    transform: translateY(20px);
    opacity: 0;
}

.fake-placeholder.enter {
    transform: translateY(-20px);
    opacity: 0;
}

.fake-placeholder.hidden {
    opacity: 0;
}

/* Character counter: stays hidden until the input nears its cap, then fades in
   small and dim in the field's bottom-right corner. */
.char-counter {
    position: absolute;
    right: 14px;
    top: 48px;
    z-index: 4;
    font-family: monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: #57575f;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.char-counter.visible {
    opacity: 1;
}

.textfield::placeholder {
    font-weight: bold;
    color: grey;
    line-height: 60px;
}

.lang-switch {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}

.lang-option {
    padding: 5px 14px;
    border: 1px solid #2b2b33;
    border-radius: 999px;
    background-color: #141418;
    color: #b8b8c0;
    font-family: monospace;
    font-size: 12px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.lang-option:hover {
    color: #e6e6ec;
    border-color: #3a3a44;
}

.lang-option.active {
    color: #e6e6ec;
    border-color: #3aa675;
}

/* --- grammar analysis overlay -------------------------------------------- */

/* The textfield shows the real (grey) text; sits below the overlay. */
.textfield {
    position: relative;
    z-index: 1;
}

/* Underline overlay: mirrors the textfield's box exactly so its (transparent)
   text lines up character-for-character with the text beneath. Only error
   spans paint, and only those are clickable; everything else lets clicks and
   the caret pass through to the textfield. */
.highlights {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    box-sizing: content-box;
    width: 100%;
    height: 50px;
    margin: 0;
    padding: 0 10px;
    padding-top: 25px;
    padding-left: 25px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: monospace;
    font-size: 20px;
    line-height: 1;
    color: transparent;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
}

.highlights .err {
    pointer-events: auto;
    cursor: pointer;
    background-color: rgba(229, 72, 77, 0.10);
    border-radius: 3px;
    text-decoration: underline wavy #e5484d;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.fake-placeholder {
    z-index: 3;
}

/* Popover anchored under a clicked error span. */
.popover {
    position: absolute;
    z-index: 5;
    max-width: 320px;
    padding: 10px 12px;
    background-color: #161616;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    color: #dddddd;
    font-family: monospace;
    font-size: 13px;
    pointer-events: auto;
}

.popover[hidden] {
    display: none;
}

.popover .msg {
    margin-bottom: 4px;
}

.popover .rule {
    color: #777777;
    font-size: 11px;
}

.popover .fixes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.popover .fixes button {
    padding: 4px 8px;
    background-color: #222222;
    border: 1px solid #444444;
    border-radius: 6px;
    color: #dddddd;
    font-family: monospace;
    font-size: 12px;
    cursor: pointer;
}

.popover .fixes button:hover {
    background-color: #2c2c2c;
    border-color: #e5484d;
}

/* Subtle status line under the field. */
.status {
    min-height: 1.2em;
    margin-top: 4px;
    color: #777777;
    font-family: monospace;
    font-size: 13px;
}

.status.ok {
    color: #3aa675;
}

.status.bad {
    color: #e5775a;
}