:root {
  --bg: #f2f3f7;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #ffffff;
  --ink: #121826;
  --muted: #667085;
  --line: #dde1eb;
  --accent: #f97316;
  --accent-dark: #c2410c;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1117;
  --surface: rgba(28, 31, 40, .92);
  --surface-solid: #1c1f28;
  --ink: #f4f5f8;
  --muted: #a4abbc;
  --line: #323846;
  --accent: #fb923c;
  --accent-dark: #fdba74;
  --shadow: 0 18px 45px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 90% -10%, rgba(249, 115, 22, .16), transparent 27rem),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(760px, 100%); margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 8px 3px 27px; }
.eyebrow, .step { margin: 0 0 6px; color: var(--accent-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(31px, 8vw, 44px); line-height: 1; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -.02em; }
.subtitle { margin: 0; color: var(--muted); font-size: 15px; }
.icon-button { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 21px; box-shadow: var(--shadow); }
.card { margin-bottom: 25px; padding: 22px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.result-heading { margin: 3px 3px 16px; }
.counter { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent-dark); font-size: 12px; font-weight: 700; }
label { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
input { width: 100%; margin-top: 7px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: var(--surface-solid); color: var(--ink); font-size: 16px; transition: border-color .15s, box-shadow .15s; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 17%, transparent); }
.search-row { display: flex; gap: 10px; margin-top: 7px; }
.search-row input { margin-top: 0; }
.primary, .secondary { min-height: 48px; padding: 0 17px; border: 0; border-radius: 13px; font-weight: 800; white-space: nowrap; }
.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 33%, transparent); }
.primary:active { background: var(--accent-dark); transform: translateY(1px); }
.secondary { width: 100%; margin-top: 12px; background: color-mix(in srgb, var(--accent) 14%, var(--surface-solid)); color: var(--accent-dark); }
.hint { margin: 13px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.results-section { margin-bottom: 26px; }
.empty-state { display: grid; gap: 5px; padding: 31px 20px; border: 1px dashed var(--line); border-radius: 20px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.results-grid { display: grid; gap: 12px; }
.result-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-solid); box-shadow: 0 8px 22px rgba(15, 23, 42, .035); }
.result-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 11px; }
.brand-title { margin: 0 0 4px; font-size: 18px; }
.aliases { color: var(--muted); font-size: 12px; }
.copy-button { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.phrase { margin: 0; padding: 0 16px 14px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.platforms { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.platform-link { display: grid; place-items: center; min-height: 46px; color: var(--ink); font-size: 13px; font-weight: 800; text-decoration: none; }
.platform-link + .platform-link { border-left: 1px solid var(--line); }
.platform-link:active { background: color-mix(in srgb, var(--accent) 11%, transparent); color: var(--accent-dark); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.brand-list { display: grid; gap: 9px; margin-top: 17px; }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-solid); }
.brand-row__content { min-width: 0; flex: 1; }
.brand-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-row small { display: block; margin-top: 3px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remove-button { padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; color: #d92d20; font-size: 13px; font-weight: 700; }
.data-actions { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 16px; }
.text-button { padding: 7px 0; border: 0; background: transparent; color: var(--accent-dark); font-size: 13px; font-weight: 800; }
.danger { color: #d92d20; }
.import-label { cursor: pointer; }
footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 17px; padding: 0 3px; color: var(--muted); font-size: 12px; }
dialog { width: min(440px, calc(100% - 34px)); padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--surface-solid); color: var(--ink); box-shadow: 0 28px 90px rgba(0, 0, 0, .32); }
dialog::backdrop { background: rgba(15, 23, 42, .52); backdrop-filter: blur(3px); }
dialog article { position: relative; padding: 26px; }
dialog h2 { margin-bottom: 13px; }
dialog li { margin: 8px 0; line-height: 1.5; }
.dialog-close { position: absolute; top: 13px; right: 15px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; }

@media (max-width: 500px) {
  .app-shell { padding-right: 14px; padding-left: 14px; }
  .card { padding: 18px; border-radius: 19px; }
  .search-row { display: grid; grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; gap: 8px; }
}
