:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 8px 24px rgba(17, 24, 39, 0.05);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

.wrap {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 80px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.25;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  color: #374151;
  margin: 0 0 8px;
}

textarea, button, input { font: inherit; }

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

.input-card { padding: 16px 16px 14px; }

#urls {
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--line);
  background: #fafafa;
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  resize: vertical;
}

#urls:focus, #names:focus, #count:focus, .icon-btn:focus-visible, button:focus-visible, .seg input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 8px;
}

.seg {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

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

.seg label {
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
}

.seg input:checked + label {
  background: var(--accent);
  color: #fff;
}

.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  height: 40px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.stepper button {
  width: 36px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.stepper button:hover { background: #f3f4f6; }

.stepper input[type="number"] {
  width: 3rem;
  border: 0;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  height: 40px;
  background: transparent;
  color: var(--ink);
  -moz-appearance: textfield;
  font-weight: 600;
}

.stepper input[type="number"]::-webkit-outer-spin-button,
.stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.primary {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 18px;
  height: 40px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}

.primary:hover { background: var(--accent-hover); }

.ghost, .icon-btn {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
}

.ghost {
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-weight: 500;
  font-size: 0.9rem;
}

.ghost:hover, .icon-btn:hover { background: #f3f4f6; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  flex: 0 0 auto;
}

.error {
  color: #b42318;
  font-size: 0.88rem;
  margin: 4px 0 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 12px;
}

.empty {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.6);
}

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

.group-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.group-url {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.review-item {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.who {
  font-weight: 600;
  margin: 0;
}

.copy-icon {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.copy-icon:hover { background: var(--accent-soft); color: var(--accent); }

.review {
  margin: 0;
  color: #1f2937;
  white-space: pre-wrap;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}

.overlay[hidden] { display: none; }

.modal {
  background: var(--card);
  width: min(520px, 100%);
  max-height: min(80vh, 720px);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(17, 24, 39, 0.18);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.modal-hint {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

#names {
  width: 100%;
  flex: 1;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fafafa;
  resize: vertical;
}

.modal-foot { margin-top: 12px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ink);
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: none;
}

[hidden] { display: none !important; }

textarea::placeholder { color: #9ca3af; }

@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); padding: 24px 0 64px; }
  .primary { margin-left: 0; }
  .controls-row { align-items: stretch; }
  .seg { width: 100%; display: flex; }
  .seg label { flex: 1; text-align: center; }
  .stepper { flex: 1; }
  .primary { flex: 1; }
}

.brand{display:flex;align-items:center;gap:14px}
.sticker{width:64px;height:64px;border-radius:50%;transform:rotate(-8deg);box-shadow:0 4px 14px rgba(15,23,42,.18),0 0 0 1px rgba(15,23,42,.06);flex-shrink:0;transition:transform .2s}
.sticker:hover{transform:rotate(0deg) scale(1.05)}
@media (max-width:520px){.sticker{width:52px;height:52px}}
