:root {
    --bg: #030305;
    --card: rgba(255, 255, 255, 0.04);
    --line: rgba(255, 255, 255, 0.09);
    --text: #e8e6f2;
    --muted: #94a3b8;
    --a1: #9333ea;
    --a2: #c084fc;
    --ok: #4ade80;
    --bad: #f87171;
    --warn: #fbbf24;
    --field: rgba(0, 0, 0, 0.5);
    --sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg) radial-gradient(circle at 50% 0%, rgba(168, 85, 247, 0.12) 0%, transparent 55%) no-repeat;
    color: var(--text);
    font: 500 14px/1.5 var(--sans);
    -webkit-tap-highlight-color: transparent;
    padding: env(safe-area-inset-top, 0px) 0 0;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { max-width: 860px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }

/* Header */
.top { display: flex; align-items: center; gap: 12px; padding: 16px 0 4px; }
.logo {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff;
    background: linear-gradient(135deg, var(--a1), var(--a2)); box-shadow: 0 6px 20px rgba(147, 51, 234, 0.35);
}
.top h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: #fff; }
.top p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* Card */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.lbl { font-size: 12px; color: var(--muted); font-weight: 700; margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; }
.lbl b { font-family: var(--mono); color: var(--a2); font-weight: 700; font-size: 13px; }
.note { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

input[type="range"] { width: 100%; height: 28px; accent-color: var(--a1); }
input[type="number"] {
    width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    font: 700 15px var(--mono); outline: none;
}
input[type="number"]:focus { border-color: var(--a2); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px;
    font-weight: 700; font-size: 12.5px;
}
.chip.on { border-color: var(--a2); background: rgba(168, 85, 247, 0.18); color: #fff; }
.seg { display: flex; gap: 4px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 12.5px; padding: 8px 10px; border-radius: 9px; }
.seg button.on { background: linear-gradient(135deg, var(--a1), var(--a2)); color: #fff; }
.start { margin-top: 8px; }

/* Dock */
.dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(10, 10, 14, 0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.dock-in { max-width: 860px; margin: 0 auto; display: flex; gap: 8px; }
.btn {
    border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 13px 14px;
    font-weight: 800; font-size: 13.5px; text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn.main { flex: 1; background: linear-gradient(135deg, var(--a1), var(--a2)); border: 0; color: #fff; font-size: 14.5px; box-shadow: 0 8px 24px rgba(147, 51, 234, 0.3); }
.btn.warn { border-color: rgba(251, 191, 36, 0.5); color: var(--warn); background: rgba(251, 191, 36, 0.08); }
.btn.danger { color: var(--bad); border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.07); }
.btn:disabled { opacity: 0.5; }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px);
    background: #0d0c14; border: 1px solid var(--a2); border-radius: 12px; padding: 10px 18px; font-weight: 700; font-size: 13px;
    opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--bad); }
@media (prefers-reduced-motion: reduce) { .toast, .bar i, .drop { transition: none; } .btn:active { transform: none; } }

/* ===== KanaaPlay Title ===== */
input[type="text"], input[type="number"], textarea {
    width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
    font: 700 14px var(--sans); color: var(--text); outline: none;
}
input:focus, textarea:focus { border-color: var(--a2); }
textarea { resize: vertical; min-height: 140px; font-weight: 500; line-height: 1.6; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg button { white-space: nowrap; }
.sect { font-size: 13px; font-weight: 800; color: #fff; margin: 0; display: flex; align-items: center; gap: 8px; }
.sect::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(var(--a1), var(--a2)); }

details.adv { border: 1px solid var(--line); border-radius: 14px; background: rgba(0, 0, 0, 0.25); }
details.adv > summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::after { content: '+'; font: 800 18px var(--mono); color: var(--a2); }
details.adv[open] > summary::after { content: '-'; }
details.adv .in { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 14px; }
.sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; font-size: 13px; }
.sw input { width: 44px; height: 24px; accent-color: var(--a1); }
.ep { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }

.tabs { display: flex; gap: 6px; }
.tab { flex: 1; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 12px; padding: 10px 8px; font-weight: 800; font-size: 13px; }
.tab[aria-selected="true"] { color: #fff; border-color: rgba(192, 132, 252, 0.6); background: rgba(168, 85, 247, 0.16); }
.tab .n { font: 700 11px var(--mono); color: var(--a2); margin-left: 4px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; animation: pop .25s ease-out; }
.item .t { margin: 0; font-weight: 800; font-size: 16px; line-height: 1.4; color: #fff; word-break: break-word; }
.item .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { font: 700 11px var(--mono); padding: 3px 8px; border-radius: 999px; background: rgba(168, 85, 247, 0.14); color: var(--a2); }
.len.ok { background: rgba(74, 222, 128, 0.14); color: var(--ok); }
.len.mid { background: rgba(251, 191, 36, 0.14); color: var(--warn); }
.len.bad { background: rgba(248, 113, 113, 0.16); color: var(--bad); }
.acts { display: flex; gap: 8px; }
.ab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--text); border-radius: 10px; padding: 9px 8px; font-weight: 800; font-size: 12.5px; }
.ab:active { background: rgba(168, 85, 247, 0.3); }
.ab.on { color: #fbbf24; border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.1); }
.ab.copy { background: linear-gradient(135deg, var(--a1), var(--a2)); border: 0; color: #fff; flex: 1.4; }
.empty { text-align: center; color: var(--muted); padding: 30px 14px; font-size: 13px; border: 1px dashed var(--line); border-radius: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .item { animation: none; } }
