@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Syne:wght@600;700&display=swap");

:root {
    color-scheme: light;
    --ink: #1e2022;
    --muted: #5a6270;
    --bg-a: #f4efe3;
    --bg-b: #e7f5f2;
    --line: rgba(30, 32, 34, 0.16);
    --card: rgba(255, 255, 255, 0.9);
    --accent: #1f7a66;
    --accent-soft: rgba(31, 122, 102, 0.15);
    --highlight: #f2b54a;
    --shadow: 0 18px 44px rgba(30, 32, 34, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    min-height: 100vh;
    background: linear-gradient(130deg, var(--bg-a), var(--bg-b));
    position: relative;
    overflow-x: hidden;
    isolation: isolate;
}

body.is-modal-open {
    overflow: hidden;
}

html {
    -webkit-text-size-adjust: 100%;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(
            circle at 12% 18%,
            rgba(255, 255, 255, 0.55),
            rgba(255, 255, 255, 0)
        ),
        radial-gradient(
            circle at 84% 88%,
            rgba(31, 122, 102, 0.08),
            rgba(31, 122, 102, 0)
        );
    pointer-events: none;
    z-index: -2;
}

.ambient .orb {
    position: fixed;
    width: var(--orb-size);
    height: var(--orb-size);
    top: var(--orb-top);
    left: var(--orb-left);
    transform: translate(-50%, -50%);
    border-radius: 999px;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(
        circle,
        rgba(var(--orb-rgb), var(--orb-alpha)),
        rgba(var(--orb-rgb), 0)
    );
}

.shell {
    max-width: 1040px;
    width: min(1040px, 100%);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px 20px 32px;
    position: relative;
    z-index: 1;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--highlight);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(242, 181, 74, 0.35);
}

.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    object-fit: cover;
}

.brand-text {
    font-family: "Syne", "Space Grotesk", sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.topbar-note {
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.lang-switch {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    overflow: hidden;
    flex-shrink: 0;
}

.lang-switch a {
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-decoration: none;
}

.lang-switch a.is-active {
    color: var(--ink);
    background: var(--accent-soft);
}

.layout {
    margin-top: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.site-footnote {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
    color: rgba(30, 32, 34, 0.5);
}

.site-footnote a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(30, 32, 34, 0.35);
    opacity: 0.75;
}

.top-alert {
    margin-bottom: 10px;
    border-radius: 14px;
    border: 1px solid rgba(177, 52, 39, 0.45);
    background: rgba(177, 52, 39, 0.14);
    color: var(--ink);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
}

.headline {
    margin-bottom: 14px;
    text-align: center;
}

.headline h1 {
    margin: 0;
    font-family: "Syne", "Space Grotesk", sans-serif;
    font-size: clamp(26px, 3vw, 38px);
    line-height: 1.08;
    max-width: 860px;
    margin-inline: auto;
}

.headline p {
    margin: 10px 0 0;
    font-size: 15px;
    color: var(--muted);
    max-width: 720px;
    margin-inline: auto;
}

.stats-strip {
    display: grid;
    margin: 10px auto 8px;
    width: min(100%, 640px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.stats-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow);
    padding: 8px 10px;
}

.stats-value {
    font-family: "Syne", "Space Grotesk", sans-serif;
    font-size: clamp(18px, 4.7vw, 22px);
    font-weight: 700;
    line-height: 1;
    color: var(--ink);
}

.stats-label {
    margin-top: 4px;
    font-size: 12px;
    letter-spacing: 0.15px;
    color: var(--muted);
}

.workspace {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 14px;
}

.workspace > .panel {
    width: min(100%, 620px);
}

.workspace.has-result {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.92fr);
}

.workspace.has-result > .panel {
    width: auto;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.alert {
    margin-bottom: 12px;
    border-radius: 12px;
    border: 1px solid rgba(177, 52, 39, 0.42);
    background: rgba(177, 52, 39, 0.1);
    color: var(--ink);
    padding: 10px 12px;
    font-size: 14px;
}

.action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.url-input,
.control select,
.preview-box input,
.result-box input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    font-size: 15px;
    color: var(--ink);
    background: #fff;
}

.control select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--ink) 50%),
        linear-gradient(135deg, var(--ink) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(1em + 1px),
        calc(100% - 13px) calc(1em + 1px);
    background-size:
        5px 5px,
        5px 5px;
    background-repeat: no-repeat;
}

.cta {
    border: none;
    border-radius: 12px;
    padding: 0 18px;
    min-height: 44px;
    background: var(--ink);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.controls-row {
    margin-top: 12px;
    display: grid;
    grid-template-columns: minmax(170px, 0.8fr) minmax(170px, 0.8fr) minmax(
            0,
            1.2fr
        );
    gap: 10px;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control > span,
.depth-head > span {
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.depth-control {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.68);
    overflow: hidden;
}

.depth-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.depth-display {
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    min-width: 56px;
    justify-content: center;
    white-space: nowrap;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--line);
}

.depth-display.is-max {
    min-width: 56px;
}

.depth-slider {
    width: 100%;
    margin-top: 8px;
    appearance: none;
    height: 7px;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(31, 122, 102, 0.8),
        rgba(242, 181, 74, 0.84)
    );
    outline: none;
}

.depth-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--ink);
    cursor: pointer;
}

.depth-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--ink);
    cursor: pointer;
}

.warning-note {
    margin: 10px 2px 0;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(177, 52, 39, 0.35);
    background: rgba(177, 52, 39, 0.08);
    font-size: 12px;
    line-height: 1.3;
    color: rgba(30, 32, 34, 0.86);
}

.warning-note.is-hidden {
    display: none;
}

.warning-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(30, 32, 34, 0.48);
}

.warning-modal-overlay.is-hidden {
    display: none;
}

.warning-modal {
    width: min(560px, 100%);
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
    padding: 16px;
}

.warning-modal h2 {
    margin: 0;
    font-family: "Syne", "Space Grotesk", sans-serif;
    font-size: 22px;
    line-height: 1.1;
}

.warning-modal p {
    margin: 10px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.warning-modal-check {
    margin-top: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.35;
}

.warning-modal-check input {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.warning-modal-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.warning-modal-cancel {
    background: #fff;
}

.warning-modal-confirm:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.theme-grid {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.theme-pill {
    display: inline-flex;
    cursor: pointer;
}

.theme-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-pill span {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    padding: 6px 10px;
    font-size: 12px;
    color: var(--ink);
}

.theme-pill input:checked + span {
    background: var(--accent-soft);
    border-color: rgba(31, 122, 102, 0.6);
}

.side-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preview {
    border-style: dashed;
}

.preview-box,
.result-box {
    display: flex;
    gap: 10px;
}

.result-title {
    margin-bottom: 10px;
    font-family: "Syne", "Space Grotesk", sans-serif;
    font-size: 18px;
    font-weight: 700;
}

.preview.is-loading {
    opacity: 0.72;
}

.ghost {
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--highlight);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    padding: 0 16px;
    min-height: 44px;
    cursor: pointer;
}

.ghost.is-copied {
    background: rgba(31, 122, 102, 0.35);
}

.result-meta {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

.target {
    word-break: break-word;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1080px) {
    .shell {
        min-height: auto;
        padding: 16px 16px 24px;
    }

    .layout {
        justify-content: flex-start;
    }

    .topbar {
        padding: 10px 12px;
    }

    .headline h1 {
        font-size: clamp(24px, 4.8vw, 34px);
    }

    .headline p {
        font-size: 14px;
    }

    .workspace.has-result {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .workspace.has-result > .panel,
    .side-column {
        width: min(100%, 700px);
        margin-inline: auto;
    }

    .side-column {
        display: block;
    }

    .controls-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .depth-control {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    .shell {
        padding: 22px 14px 28px;
    }

    .topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .brand {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
    }

    .lang-switch {
        margin-left: auto;
    }

    .headline {
        text-align: left;
    }

    .headline h1,
    .headline p {
        margin-inline: 0;
    }

    .stats-strip {
        display: none;
    }

    .controls-row {
        grid-template-columns: 1fr;
    }

    .action-row {
        grid-template-columns: 1fr;
    }

    .layout {
        flex: unset;
        justify-content: flex-start;
    }

    .site-footnote {
        margin-top: 16px;
        text-align: left;
    }

    .url-input,
    .control select,
    .result-box input {
        font-size: 16px;
    }

    .side-column {
        width: 100%;
        margin-inline: 0;
    }

    .preview-box,
    .result-box {
        flex-direction: column;
    }

    .warning-modal {
        padding: 14px;
    }

    .warning-modal h2 {
        font-size: 20px;
    }

    .warning-modal-actions {
        flex-direction: column-reverse;
    }
}

@media (max-width: 420px) {
    .shell {
        padding: 12px 10px 18px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .brand-logo {
        width: 29px;
        height: 29px;
    }

    .brand-text {
        font-size: 18px;
    }

    .lang-switch a {
        padding: 6px 9px;
    }
}
