/* 60/30/10 color scheme:
   60% = light background
   30% = dark neutral surfaces/text
   10% = accent
*/
:root {
    /* 60% background */
    --bg: #EEF2F7;

    /* 30% surfaces */
    --surface: #1E293B;
    --surface-2: #0F172A;

    /* 10% accent */
    --accent: #3B82F6;

    --muted: #64748B;
    --field: #FFFFFF;
    --danger: #EF4444;

    --radius: 14px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);

    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
        "Courier New", monospace;
    --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
        "Apple Color Emoji", "Segoe UI Emoji";

    /* all speeds */
    --t: 0.3s;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--sans);
    background: radial-gradient(1200px 600px at 50% -10%, rgba(59, 130, 246, 0.20), transparent 55%), var(--bg);
    color: var(--surface);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
}

.card {
    width: min(980px, 100%);
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid rgba(17, 24, 39, 0.08);
}

header {
    padding: 26px 24px 18px;
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.05), transparent);
    border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 0.2px;
}

.sub {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

main {
    padding: 20px 24px 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(31, 41, 55, 0.85);
}

input {
    width: 100%;
    padding: 12px 12px;
    border-radius: 12px;
    border: 1px solid rgba(17, 24, 39, 0.15);
    background: var(--field);
    outline: none;
    font-size: 14px;
    transition: border-color var(--t) ease, box-shadow var(--t) ease;
}

input:focus {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.btnbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

button {
    position: relative;
    overflow: hidden;
    /* ripple */
    border: none;
    cursor: pointer;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;

    transition:
        transform var(--t) ease,
        filter var(--t) ease,
        opacity var(--t) ease,
        background-color var(--t) ease,
        box-shadow var(--t) ease;
}

button:active {
    transform: translateY(1px);
}

button:hover {
    filter: brightness(1.1);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: none;
}

.primary {
    background: var(--accent);
    color: white;
    flex: 1;
    min-width: 180px;
}

.primary:hover {
    background: #2563EB;
}

.secondary {
    background: rgba(31, 41, 55, 0.08);
    color: var(--surface);
    min-width: 140px;
}

.secondary:hover {
    background: rgba(31, 41, 55, 0.12);
}

/* --------------------------------------
   Smooth dropdown that DOES NOT reserve space
   When hidden: display:none
   When shown: animate max-height + opacity + transform
-------------------------------------- */
.drop {
    margin-top: 10px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height var(--t) ease, opacity var(--t) ease, transform var(--t) ease;
}

.drop.is-open {
    max-height: 600px;
    opacity: 1;
    transform: translateY(0);
}

.is-hidden {
    display: none;
    /* <-- this removes it from layout completely (no gap) */
}

/* Output block */
.out {
    border-radius: 16px;
    background: rgba(31, 41, 55, 0.04);
    border: 1px solid rgba(17, 24, 39, 0.10);
    padding: 14px;
}

.out h2 {
    margin: 0 0 10px 0;
    font-size: 14px;
    letter-spacing: 0.2px;
}

.magic {
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.45;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px dashed rgba(17, 24, 39, 0.20);
    word-break: break-all;
}

.hint {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* Error block */
.error {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #7F1D1D;
    font-size: 13px;
}

footer {
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(17, 24, 39, 0.08);
    color: var(--muted);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

a {
    color: inherit;
}

/* --- Ripple Effect --- */
.ripple-ink {
    position: absolute;
    border-radius: 999px;
    transform: scale(0);
    opacity: 0.35;
    background: rgba(255, 255, 255, 0.9);
    pointer-events: none;
    animation: ripple var(--t) ease-out;
}

.secondary .ripple-ink {
    background: rgba(30, 41, 59, 0.25);
}

@keyframes ripple {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}