:root {
    color-scheme: dark;
    --bg: #041216;
    --bg-deep: #02080b;
    --panel: rgba(9, 25, 31, 0.82);
    --panel-strong: rgba(13, 36, 43, 0.92);
    --text: #e9fbff;
    --muted: #87a5ad;
    --border: rgba(126, 247, 239, 0.18);
    --border-strong: rgba(126, 247, 239, 0.36);
    --accent: #16f1e6;
    --accent-dark: #0bb8bb;
    --accent-soft: rgba(22, 241, 230, 0.14);
    --error-bg: rgba(98, 20, 38, 0.72);
    --error-border: rgba(255, 103, 139, 0.42);
    --error-text: #ffd5de;
    --success-bg: rgba(8, 78, 72, 0.72);
    --success-border: rgba(93, 255, 215, 0.42);
    --success-text: #d8fff6;
    --warning-bg: rgba(96, 70, 11, 0.72);
    --warning-border: rgba(255, 210, 91, 0.38);
    --warning-text: #ffe7a6;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg-deep);
}

body {
    position: relative;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 20% 18%, rgba(22, 241, 230, 0.22), transparent 28rem),
        radial-gradient(circle at 78% 10%, rgba(62, 136, 255, 0.12), transparent 26rem),
        linear-gradient(135deg, #02080b 0%, #06181d 46%, #02090d 100%);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(126, 247, 239, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(126, 247, 239, 0.05) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 78%);
}

.drop-overlay {
    position: fixed;
    inset: 14px;
    z-index: 10;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(126, 247, 239, 0.82);
    border-radius: 14px;
    background: rgba(2, 11, 14, 0.84);
    box-shadow:
        inset 0 0 48px rgba(22, 241, 230, 0.18),
        0 0 80px rgba(22, 241, 230, 0.16);
    color: var(--accent);
    font-size: 1.05rem;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.985);
    transition: opacity 140ms ease, transform 140ms ease;
}

body.is-page-dragging .drop-overlay {
    opacity: 1;
    transform: scale(1);
}

a {
    color: var(--accent);
    text-underline-offset: 4px;
}

.app-shell {
    width: min(860px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0;
}

.app-tools {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: calc(100vw - 28px);
}

h1,
h2 {
    margin: 0;
    line-height: 1.03;
}

h1 {
    max-width: none;
    font-size: clamp(2rem, 5vw, 3.65rem);
    font-weight: 900;
    letter-spacing: 0;
    text-shadow:
        0 0 32px rgba(22, 241, 230, 0.18),
        0 1px 0 rgba(255, 255, 255, 0.18);
}

.intro {
    max-width: 36rem;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.45;
}

h2 {
    margin-bottom: 20px;
    color: #f5fdff;
    font-size: 1.2rem;
    font-weight: 800;
}

.hero-visual {
    position: relative;
    margin: 0 0 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    min-height: 218px;
    aspect-ratio: 16 / 4.3;
    background: rgba(2, 11, 14, 0.56);
    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.34),
        inset 0 0 0 1px rgba(255, 255, 255, 0.025);
    container-type: inline-size;
}

.hero-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(2, 8, 11, 0.86) 0%, rgba(2, 8, 11, 0.58) 26%, transparent 56%, rgba(2, 8, 11, 0.16)),
        linear-gradient(0deg, rgba(2, 8, 11, 0.58), transparent 48%),
        radial-gradient(circle at 78% 48%, rgba(22, 241, 230, 0.16), transparent 18rem);
}

.hero-visual img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-copy {
    position: absolute;
    z-index: 1;
}

.hero-copy {
    left: clamp(20px, 4vw, 34px);
    top: clamp(18px, 3.4vw, 30px);
    max-width: min(520px, calc(100% - 48px));
}

.lang-switch {
    display: inline-flex;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid rgba(126, 247, 239, 0.24);
    border-radius: 8px;
    background: rgba(6, 22, 27, 0.7);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.lang-switch a {
    display: inline-flex;
    min-height: 40px;
    min-width: 40px;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
}

.lang-switch a + a {
    border-left: 1px solid rgba(126, 247, 239, 0.16);
}

.lang-switch a:hover,
.lang-switch a.is-active {
    background: rgba(22, 241, 230, 0.14);
    color: var(--text);
}

.panel,
.notice {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.panel::before,
.notice::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 28%),
        linear-gradient(to bottom, rgba(22, 241, 230, 0.08), transparent 42%);
}

.panel {
    padding: 26px 28px 28px;
}

.notice {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px;
    padding: 16px;
}

.notice > * {
    position: relative;
    z-index: 1;
}

.notice.error {
    border-color: var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
}

.notice.success {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}

.notice.warning {
    border-color: var(--warning-border);
    background: var(--warning-bg);
    color: var(--warning-text);
}

.is-hidden {
    display: none !important;
}

.result-box {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
}

.result-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(93, 255, 215, 0.5);
    border-radius: 50%;
    background: rgba(93, 255, 215, 0.12);
    color: #8effe7;
    font-weight: 900;
    box-shadow: 0 0 24px rgba(93, 255, 215, 0.18);
}

.result-content {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.result-content span:first-child {
    color: #b8fff0;
    font-size: 0.86rem;
    font-weight: 800;
}

.result-box a {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 1rem;
    font-weight: 800;
}

.form-stack {
    display: grid;
    gap: 17px;
}

label {
    display: grid;
    gap: 9px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

small {
    color: #698990;
    font-weight: 600;
}

.field-help {
    margin-top: -2px;
    color: #7fa3aa;
    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.45;
}

.field-help strong {
    color: #c8fff7;
}

.preset-group {
    display: grid;
    gap: 9px;
    margin-top: -4px;
}

.preset-group > span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preset-button {
    min-height: 34px;
    border-color: rgba(126, 247, 239, 0.24);
    padding: 7px 11px;
    background: rgba(6, 22, 27, 0.74);
    color: var(--text);
    font-size: 0.84rem;
    box-shadow: none;
}

.preset-button:hover {
    background: rgba(22, 241, 230, 0.14);
}

input {
    width: 100%;
    min-height: 52px;
    border: 1px solid rgba(126, 247, 239, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
    background: rgba(1, 10, 13, 0.72);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

input::placeholder {
    color: #526c73;
}

input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(22, 241, 230, 0.16);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 0 28px rgba(22, 241, 230, 0.12);
}

.drop-field {
    border: 1px dashed transparent;
    border-radius: 10px;
    padding: 8px;
    margin: -8px;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.drop-field.is-dragging {
    border-color: rgba(126, 247, 239, 0.72);
    background: rgba(22, 241, 230, 0.08);
    box-shadow: inset 0 0 24px rgba(22, 241, 230, 0.08);
}

button,
.button-link {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(126, 247, 239, 0.34);
    border-radius: 8px;
    padding: 11px 18px;
    background:
        linear-gradient(135deg, rgba(22, 241, 230, 0.96), rgba(11, 184, 187, 0.86)),
        var(--accent);
    color: #021113;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 900;
    text-decoration: none;
    box-shadow:
        0 0 28px rgba(22, 241, 230, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

button:hover,
.button-link:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow:
        0 0 38px rgba(22, 241, 230, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

button:disabled {
    cursor: wait;
    opacity: 0.68;
    transform: none;
}

.ghost-button {
    min-height: 40px;
    border-color: rgba(126, 247, 239, 0.24);
    background: rgba(6, 22, 27, 0.7);
    color: var(--text);
    box-shadow: none;
}

.ghost-button:hover {
    background: rgba(22, 241, 230, 0.12);
}

.copy-button {
    min-height: 38px;
    padding: 8px 14px;
}

.copy-status {
    color: #8effe7;
    font-size: 0.82rem;
    font-weight: 800;
}

.muted {
    color: var(--muted);
}

code {
    border: 1px solid rgba(126, 247, 239, 0.18);
    border-radius: 5px;
    padding: 2px 5px;
    background: rgba(2, 11, 14, 0.55);
    color: inherit;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 640px) {
    .app-shell {
        width: min(100% - 24px, 860px);
        padding: 58px 0 18px;
    }

    .app-tools {
        top: 10px;
        right: 10px;
    }

    h1 {
        max-width: none;
        font-size: clamp(2rem, 11vw, 3rem);
    }

    .intro {
        font-size: 0.95rem;
    }

    .hero-visual {
        min-height: 0;
        aspect-ratio: 16 / 8;
    }

    .hero-copy {
        left: 18px;
        top: 18px;
        max-width: calc(100% - 36px);
    }

    .panel {
        padding: 20px;
    }

    .result-box {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .copy-button {
        grid-column: 1 / -1;
        width: 100%;
    }
}
