:root {
    --bg: #020617;
    --card-bg: #020617;
    --card-border: #1e293b;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --text: #e5e7eb;
    --muted: #9a9fb3;
    --danger: #f97373;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background: radial-gradient(circle at top, #0f172a 0, #020617 55%, #000 100%);
    color: var(--text);
}

.card {
    width: 100%;
    max-width: 720px;
    background: radial-gradient(circle at top left, #111827 0, #020617 60%);
    border-radius: 18px;
    padding: 1.8rem 1.7rem 1.3rem;
    border: 1px solid var(--card-border);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.9);
}

.card-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.4rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
}

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

.pill {
    font-size: 0.75rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #c7d2fe;
    border: 1px solid rgba(129, 140, 248, 0.4);
    white-space: nowrap;
}

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

label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-text {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #020617;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.input-text::placeholder {
    color: #4b5563;
}

.input-text:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.8);
    background: #020617;
}

.input-text[readonly] {
    border-style: dashed;
    cursor: default;
}

.actions-row {
    display: flex;
    justify-content: flex-end;
}

button[type="submit"] {
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.3rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 12px 32px rgba(79, 70, 229, 0.7);
    transition:
        transform 0.08s ease,
        box-shadow 0.12s ease,
        filter 0.12s ease;
}

button[type="submit"]:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 16px 40px rgba(79, 70, 229, 0.9);
}

button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 8px 22px rgba(79, 70, 229, 0.7);
}

.arrow {
    font-size: 1rem;
}

.output-section {
    margin-top: 0.5rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(55, 65, 81, 0.7);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

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

.hidden {
    display: none;
}

.error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: -0.15rem;
}

.status {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: -0.15rem;
}

/* Adjustable width output container */
.output-wrapper {
    display: inline-flex;
    /* shrink/grow to content width */
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    /* never overflow card */
}

.output-flex-input {
    display: inline-block;
    /*width: auto;
    min-width: 6ch;*/
    /* width adjusts to content */
    max-width: 100%;
    /* clamp to card width */
    overflow-x: auto;
    /* allow horizontal scroll if extremely long */
    white-space: nowrap;
    /* keep long result on one line */
}

@media (max-width: 640px) {
    .card {
        padding: 1.3rem 1.15rem 1rem;
    }
}