:root {
    --bg: #070b10;
    --bg-soft: #0b1119;
    --card: rgba(15, 23, 34, 0.86);
    --line: rgba(120, 160, 200, 0.14);
    --line-strong: rgba(120, 200, 255, 0.28);
    --text: #dbe6f3;
    --muted: #7d8fa6;
    --green: #37e08f;
    --cyan: #46c8ff;
    --amber: #ffc857;
    --danger: #ff6b6b;
    --radius: 14px;
    --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(900px 500px at 12% -10%, rgba(55, 224, 143, 0.12), transparent 60%),
        radial-gradient(800px 500px at 92% 0%, rgba(70, 200, 255, 0.10), transparent 55%),
        linear-gradient(180deg, #070b10 0%, #060a0e 100%);
}

.bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(120, 160, 200, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(120, 160, 200, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 78%);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px clamp(18px, 5vw, 64px);
    border-bottom: 1px solid var(--line);
    background: rgba(7, 11, 16, 0.72);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}

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

.logo {
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    font: 700 20px/1 var(--mono);
    color: #04120b;
    background: linear-gradient(140deg, var(--green), #0fd0a0 60%, #00b3ff);
    box-shadow: 0 8px 26px rgba(55, 224, 143, 0.28);
}

.brand-text h1 { margin: 0; font-size: 18px; letter-spacing: 0.2px; }
.brand-text p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }

.tag {
    font: 600 10.5px/1 var(--mono);
    color: var(--green);
    border: 1px solid rgba(55, 224, 143, 0.35);
    background: rgba(55, 224, 143, 0.08);
    padding: 4px 6px;
    border-radius: 6px;
    vertical-align: 3px;
    margin-left: 4px;
}

.topnav { display: flex; align-items: center; gap: 22px; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 13.5px; }
.topnav a:hover { color: var(--text); }

.pill {
    font: 600 11.5px/1 var(--mono);
    color: var(--cyan);
    border: 1px solid rgba(70, 200, 255, 0.3);
    background: rgba(70, 200, 255, 0.07);
    padding: 7px 10px;
    border-radius: 999px;
}

main { padding: 0 clamp(18px, 5vw, 64px) 70px; }

.hero { padding: 54px 0 30px; max-width: 780px; }
.hero h2 {
    margin: 0 0 12px;
    font-size: clamp(24px, 3.2vw, 34px);
    line-height: 1.25;
    letter-spacing: -0.3px;
}
.hero p { margin: 0; color: var(--muted); font-size: 15px; }

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
    gap: 20px;
    align-items: start;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.card-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: #a9bccd;
    letter-spacing: 0.3px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.dot.cyan { background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.dot.amber { background: var(--amber); box-shadow: 0 0 12px var(--amber); }

.head-actions { margin-left: auto; display: flex; gap: 8px; }

button { font: inherit; cursor: pointer; }

.ghost {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
    color: #a9bccd;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 12.5px;
    transition: 0.15s ease;
}
.ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(70, 200, 255, 0.07); }

.editor-wrap { position: relative; }
.editor-wrap.drag { outline: 1px dashed var(--cyan); outline-offset: -8px; }

textarea#code {
    width: 100%;
    height: 430px;
    resize: vertical;
    border: 0;
    outline: none;
    display: block;
    background: transparent;
    color: #cfe3f5;
    padding: 18px 20px;
    font: 13.5px/1.72 var(--mono);
    tab-size: 4;
    white-space: pre;
    overflow: auto;
}
textarea#code::placeholder { color: #43536a; }

.card-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font: 12px/1.4 var(--mono);
}

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

.field { padding: 12px 16px 0; }
.field label { display: block; font-size: 12.5px; color: #a9bccd; margin-bottom: 7px; }
.field label em { color: var(--muted); font-style: normal; font-size: 11px; }

.field input, .field select {
    width: 100%;
    background: #0a1017;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 9px;
    padding: 9px 11px;
    font: 13px/1.4 var(--mono);
    outline: none;
    transition: 0.15s;
}
.field input:focus, .field select:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(70, 200, 255, 0.08); }
.field input::placeholder { color: #43536a; }

.switches { display: grid; gap: 10px; padding: 16px; }

.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #b8c9da; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch span {
    width: 34px; height: 19px;
    border-radius: 999px;
    background: #1a2532;
    border: 1px solid var(--line);
    position: relative;
    transition: 0.18s;
    flex: none;
}
.switch span::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 13px; height: 13px;
    border-radius: 50%;
    background: #5b6d82;
    transition: 0.18s;
}
.switch input:checked + span { background: rgba(55, 224, 143, 0.16); border-color: rgba(55, 224, 143, 0.45); }
.switch input:checked + span::after { left: 17px; background: var(--green); box-shadow: 0 0 10px rgba(55, 224, 143, 0.65); }

.primary {
    margin: 4px 16px 6px;
    width: calc(100% - 32px);
    padding: 12px 16px;
    border: 0;
    border-radius: 10px;
    color: #04120b;
    font-weight: 700;
    letter-spacing: 0.4px;
    background: linear-gradient(135deg, var(--green), #1fd0b0);
    box-shadow: 0 10px 30px rgba(55, 224, 143, 0.22);
    transition: 0.16s;
}
.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(55, 224, 143, 0.3); }
.primary:disabled { opacity: 0.55; cursor: progress; transform: none; }
.primary.sm { margin: 0; width: auto; padding: 9px 16px; font-size: 13px; }

.tiny { margin: 8px 16px 16px; color: #5d6f84; font-size: 11.5px; line-height: 1.6; }

.empty {
    padding: 38px 16px;
    text-align: center;
    color: #4d5d70;
    font-size: 13px;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--line);
    margin: 0;
}
.stats div {
    background: #0b1119;
    padding: 11px 14px;
    font: 12px/1.5 var(--mono);
    color: var(--muted);
}
.stats b { display: block; color: var(--text); font-size: 14px; font-weight: 600; margin-top: 2px; }

.result-actions { display: flex; gap: 10px; padding: 14px 16px; }

.how { margin-top: 58px; }
.how h3, .api h3 { font-size: 18px; margin: 0 0 18px; letter-spacing: 0.2px; }

.how-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.how-item {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    background: rgba(13, 20, 29, 0.6);
}
.how-item .num { font: 600 11px/1 var(--mono); color: var(--green); letter-spacing: 1px; }
.how-item h4 { margin: 9px 0 8px; font-size: 14.5px; }
.how-item p { margin: 0; color: var(--muted); font-size: 12.8px; line-height: 1.65; }

code {
    font-family: var(--mono);
    font-size: 0.92em;
    color: #9fe3c4;
    background: rgba(55, 224, 143, 0.07);
    border: 1px solid rgba(55, 224, 143, 0.14);
    padding: 1px 5px;
    border-radius: 5px;
}

.api { margin-top: 48px; color: var(--muted); font-size: 13.5px; }
.api pre {
    margin: 14px 0;
    padding: 16px 18px;
    background: #0a1017;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: auto;
}
.api pre code { background: none; border: 0; padding: 0; color: #b7d8ec; font-size: 12.5px; line-height: 1.7; }

footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 22px clamp(18px, 5vw, 64px);
    border-top: 1px solid var(--line);
    color: #53647a;
    font: 12px/1.5 var(--mono);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translate(-50%, 20px);
    background: #0e1720;
    border: 1px solid var(--line-strong);
    color: var(--text);
    padding: 11px 18px;
    border-radius: 10px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: 0.22s;
    z-index: 50;
    max-width: min(90vw, 520px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 107, 107, 0.5); color: #ffd7d7; }

@media (max-width: 960px) {
    .grid { grid-template-columns: 1fr; }
    .how-grid { grid-template-columns: 1fr 1fr; }
    textarea#code { height: 340px; }
}

@media (max-width: 620px) {
    .how-grid { grid-template-columns: 1fr; }
    .topnav a { display: none; }
    footer { flex-direction: column; }
}
