:root {
  color-scheme: light;
  --bg: #f5f3ff; --card: #ffffff; --ink: #1c1830; --muted: #6b6685; --line: #e5e0f5;
  --accent: #7c5cff; --accent-2: #ff6fb1; --accent-soft: #ece6ff; --bad: #d63d5c; --ok: #19a463;
  --shadow: 0 1px 2px rgba(40, 20, 90, .06), 0 10px 30px rgba(40, 20, 90, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #110e1c; --card: #1b1729; --ink: #eeeaff; --muted: #a39dbd; --line: #2e2844;
    --accent: #9b82ff; --accent-soft: #2a2245; --shadow: none;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 16px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 500px at 50% -200px, color-mix(in srgb, var(--accent) 22%, transparent), transparent), var(--bg);
}
.wrap { width: min(560px, 100% - 32px); margin: 0 auto; padding: 36px 0 48px; }
.top { text-align: center; margin-bottom: 22px; }
.logo { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.logo span { display: inline-block; animation: puff 3s ease-in-out infinite; }
@keyframes puff { 50% { transform: translateX(-4px) scale(1.08); } }
.tag { margin: 2px 0 0; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.center { text-align: center; }
h2 { font-size: 18px; margin: 0 0 6px; }
label, .label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.muted { color: var(--muted); margin: 0 0 12px; font-size: 14.5px; }
.row { display: flex; gap: 8px; align-items: center; }
input:not([type=radio]) {
  flex: 1; min-width: 0; width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--accent); }
#keyForm { display: flex; gap: 8px; }

.btn { font: inherit; font-weight: 650; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer; transition: transform .1s, opacity .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.big { width: 100%; padding: 14px; font-size: 17px; margin-top: 16px; }
.link-btn { background: none; border: 0; padding: 4px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.lives { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.lives input { position: absolute; opacity: 0; pointer-events: none; }
.lives span {
  display: block; text-align: center; padding: 10px 4px; border-radius: 12px; border: 1.5px solid var(--line);
  font-size: 14.5px; font-weight: 600; color: var(--ink); cursor: pointer; transition: all .15s;
}
.lives input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.lives .forever { grid-column: 1 / -1; }
.lives input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
#newForm > label:first-child + .row { margin-bottom: 16px; }
details { margin-top: 2px; }
summary { cursor: pointer; color: var(--muted); font-size: 14.5px; }
.custom { margin-top: 8px; }
.prefix { color: var(--muted); font-size: 14px; white-space: nowrap; }

.error { color: var(--bad); font-size: 14.5px; margin: 10px 0 0; min-height: 0; }
.error:empty { display: none; }

.result { border-color: var(--accent); animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
#shortLink { display: block; font-size: 20px; font-weight: 700; color: var(--accent); word-break: break-all; margin-bottom: 4px; }

.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.count { color: var(--muted); font-weight: 500; }
.links { list-style: none; margin: 0; padding: 0; }
.links li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 0; border-top: 1px solid var(--line); align-items: center; }
.links li:first-child { border-top: 0; }
.links .code { font-weight: 700; color: var(--ink); text-decoration: none; word-break: break-all; }
.links .to { grid-column: 1; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links .left { grid-column: 1; font-size: 13px; color: var(--accent); font-weight: 600; }
.links .left.soon { color: var(--accent-2); }
.links .left.forever { color: var(--muted); }
.links .acts { grid-column: 2; grid-row: 1 / span 3; display: flex; gap: 6px; }
.links .acts button { font: inherit; font-size: 13.5px; font-weight: 600; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 7px 11px; cursor: pointer; }
.links .acts button.del { color: var(--bad); }
.links li.going { animation: vanish .45s ease-in forwards; }
@keyframes vanish { to { opacity: 0; transform: translateX(14px) scale(.96); filter: blur(4px); } }
.foot { text-align: center; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; opacity: 0; transition: .2s; pointer-events: none; font-weight: 600; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

body.gone { display: grid; place-items: center; padding: 16px; }
body.gone .card { max-width: 440px; }
.big { font-size: 64px; line-height: 1; margin-bottom: 8px; animation: puff 3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
