/* ------------------------------------------------------------------------
   HSB Přełož UI — dark futuristic theme
   - Deep navy base with subtle gradient grid
   - Cyan/mint accents
   - Animated starfield background
   - Energy-pulse progress traversal through stage nodes
   ------------------------------------------------------------------------ */

:root {
    --bg-0:    #050810;
    --bg-1:    #0a1020;
    --bg-2:    #131a2e;
    --panel:   rgba(15, 22, 38, 0.85);
    --panel-2: rgba(20, 30, 50, 0.6);
    --border:  rgba(80, 160, 220, 0.18);
    --border-strong: rgba(100, 200, 240, 0.35);
    --text:    #c7d4e5;
    --text-dim:#7a8aa3;
    --accent:  #00d9ff;
    --accent-2:#5aa3ff;
    --accent-glow: rgba(0, 217, 255, 0.45);
    --mint:    #56e8a2;
    --danger:  #ff6470;
    --font-stack: 'Helvetica Neue', 'Inter', system-ui, -apple-system,
                  'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-stack);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100dvh;
}

body {
    /* Layered gradient + faint grid for futuristic feel */
    background:
        radial-gradient(ellipse at top, rgba(40, 70, 130, 0.18), transparent 60%),
        radial-gradient(ellipse at bottom right, rgba(0, 80, 120, 0.12), transparent 70%),
        linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 70%, var(--bg-0) 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* Starfield — pure CSS, three layers of scrolling stars */
.starfield {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        radial-gradient(1px 1px at 23% 17%, rgba(200, 230, 255, 0.6), transparent),
        radial-gradient(1px 1px at 67% 33%, rgba(180, 220, 255, 0.5), transparent),
        radial-gradient(1px 1px at 41% 71%, rgba(220, 240, 255, 0.4), transparent),
        radial-gradient(1.5px 1.5px at 88% 52%, rgba(0, 217, 255, 0.7), transparent),
        radial-gradient(1px 1px at 12% 88%, rgba(100, 180, 230, 0.5), transparent),
        radial-gradient(1.5px 1.5px at 50% 8%, rgba(86, 232, 162, 0.5), transparent);
    background-size: 100% 100%;
    animation: drift 90s linear infinite;
    opacity: 0.7;
}

@keyframes drift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-2%, -3%); }
}

/* Faint grid overlay */
body::before {
    content: '';
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(80, 160, 220, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(80, 160, 220, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

.app {
    position: relative;
    z-index: 1;
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 60px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Header ----------------------------------------------------------- */

.head {
    text-align: center;
    padding-top: 8px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.logo {
    color: var(--accent);
    font-size: 32px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
    animation: logo-pulse 4s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% { filter: drop-shadow(0 0 6px var(--accent-glow)); }
    50%      { filter: drop-shadow(0 0 16px var(--accent-glow)); }
}

.title {
    background: linear-gradient(90deg, #ffffff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 6px;
    letter-spacing: 0.03em;
}

/* --- Tool cross-nav (Přełož ⇄ Pytaj) --------------------------------- */
.toolnav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 14px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-2);
    font-size: 13px;
}
.toolnav-here,
.toolnav-link {
    padding: 5px 14px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-decoration: none;
    line-height: 1;
}
.toolnav-here {
    background: linear-gradient(135deg, #0a2a3a, #0e3a4a);
    color: var(--accent);
    border: 1px solid var(--border-strong);
}
.toolnav-link {
    color: var(--text-dim);
    border: 1px solid transparent;
    transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.toolnav-link:hover {
    color: var(--accent);
    border-color: var(--border);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* --- Language picker -------------------------------------------------- */

.picker {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: end;
}

.lang-col { display: flex; flex-direction: column; gap: 4px; }

.lang-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.lang-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%2300d9ff' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.lang-select:focus {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.12);
}

.lang-select option {
    background: var(--bg-1);
    color: var(--text);
}

.swap {
    background: var(--panel);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px; height: 44px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.15s, box-shadow 0.15s;
}

.swap:hover {
    border-color: var(--border-strong);
    box-shadow: 0 0 16px var(--accent-glow);
    transform: rotate(180deg);
}

/* --- Panels (input + output) ----------------------------------------- */

.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.panel {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(6px);
    transition: border-color 0.2s;
}

.panel:focus-within { border-color: var(--border-strong); }

.text {
    width: 100%;
    min-height: 200px;
    background: transparent;
    color: var(--text);
    border: none;
    padding: 18px 18px 36px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.55;
    resize: vertical;
}

.text:focus { outline: none; }
.text::placeholder { color: var(--text-dim); opacity: 0.6; }

.meter {
    position: absolute;
    right: 14px;
    bottom: 10px;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    pointer-events: none;
}

.charcount.over { color: var(--danger); }

.elapsed { color: var(--mint); opacity: 0.85; }

/* --- Honeypot -------------------------------------------------------- */
.hp {
    position: absolute;
    left: -9999px;
    width: 1px; height: 1px;
    overflow: hidden;
}

/* --- Translate button ------------------------------------------------ */

.actions { display: grid; place-items: center; }

.translate-btn {
    position: relative;
    background: linear-gradient(135deg, #0d1b2c 0%, #16263d 100%);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 14px 36px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.translate-btn:hover:not(:disabled) {
    box-shadow: 0 0 24px var(--accent-glow);
    border-color: var(--accent);
}

.translate-btn:active:not(:disabled) { transform: scale(0.98); }

.translate-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: var(--border);
    box-shadow: none;
}

.btn-label { position: relative; z-index: 2; }

.btn-glow {
    position: absolute; inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 217, 255, 0.25) 50%,
        transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.translate-btn:hover:not(:disabled) .btn-glow {
    transform: translateX(100%);
}

/* --- Progress indicator ---------------------------------------------- */

.progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-height: 80px;
    padding: 16px 12px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s, transform 0.3s;
}

.progress.active {
    opacity: 1;
    transform: translateY(0);
}

.progress-track {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 720px;
    height: 64px;
}

.progress-node {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--bg-2);
    border: 2px solid var(--border);
    display: grid;
    place-items: center;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-node.done {
    background: linear-gradient(135deg, #0a2a3a, #0e3a4a);
    border-color: var(--mint);
    color: var(--mint);
    box-shadow: 0 0 12px rgba(86, 232, 162, 0.35);
}

.progress-node.active {
    background: linear-gradient(135deg, #0a2a3a, #0e3a4a);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 18px var(--accent-glow);
    animation: node-pulse 1.5s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { box-shadow: 0 0 12px var(--accent-glow); transform: scale(1); }
    50%      { box-shadow: 0 0 24px var(--accent-glow), 0 0 36px var(--accent-glow);
               transform: scale(1.08); }
}

.progress-node .label {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    transition: color 0.3s;
}

.progress-node.done .label  { color: var(--mint); }
.progress-node.active .label { color: var(--accent); }

.progress-link {
    flex: 1 1 auto;
    height: 2px;
    background: var(--border);
    position: relative;
    overflow: hidden;
}

.progress-link.done {
    background: var(--mint);
    box-shadow: 0 0 6px rgba(86, 232, 162, 0.4);
}

.progress-link.active {
    background: var(--border);
}

/* Animated energy pulse traversing the link */
.progress-link.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent) 50%,
        transparent 100%);
    width: 50%;
    animation: link-pulse 1.2s linear infinite;
    filter: drop-shadow(0 0 4px var(--accent-glow));
}

@keyframes link-pulse {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(300%); }
}

.progress-status {
    font-size: 13px;
    color: var(--text-dim);
    letter-spacing: 0.04em;
    text-align: center;
    min-height: 1.2em;
}

/* --- Error ----------------------------------------------------------- */

.err {
    min-height: 1.5em;
    text-align: center;
    color: var(--danger);
    font-size: 14px;
    letter-spacing: 0.02em;
}

.err:empty { min-height: 0; }

/* --- Footer ---------------------------------------------------------- */

.foot {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    letter-spacing: 0.08em;
    opacity: 0.6;
    margin-top: 12px;
}

/* --- Responsive ------------------------------------------------------ */

@media (max-width: 720px) {
    .app { padding: 20px 14px 40px; gap: 18px; }
    .brand { font-size: 22px; }
    .panels { grid-template-columns: 1fr; }
    .text { min-height: 160px; font-size: 15px; }
    .picker { grid-template-columns: 1fr; }
    .swap { justify-self: center; transform: rotate(90deg); }
    .swap:hover { transform: rotate(270deg); }
    .progress-node {
        width: 32px; height: 32px;
        font-size: 11px;
    }
    .progress-node .label { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .starfield, .logo, .progress-node.active, .progress-link.active::before {
        animation: none;
    }
    .btn-glow { transition: none; }
}
