:root {
  color-scheme: dark;
  --ink: #100d1b;
  --ink-2: #191429;
  --ink-3: #241d38;
  --paper: #f7f4ff;
  --paper-2: #eeebf7;
  --card: #ffffff;
  --text: #171224;
  --muted: #6b647a;
  --purple: #9b63f6;
  --purple-dark: #6f36c8;
  --pink: #ec4899;
  --gold: #f6c65b;
  --cyan: #54d8ee;
  --coral: #ff6b73;
  --line: rgba(36, 27, 58, 0.11);
  --shadow: 0 24px 70px rgba(7, 5, 13, 0.22);
  --radius: 24px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    var(--ink);
  background-size: 52px 52px;
  overflow-x: hidden;
}

button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 460px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.16;
}

.ambient-one { top: -160px; right: -90px; background: var(--purple); }
.ambient-two { top: 520px; left: -280px; background: var(--pink); opacity: 0.1; }

.site-header {
  position: relative;
  z-index: 5;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 11px; min-height: 52px; }

.brand-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
}

.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo-full { width: 60px; height: 60px; flex-basis: 60px; }
.brand-copy { display: flex; flex-direction: column; gap: 3px; }
.brand-copy strong { font-size: 18px; line-height: 1.2; letter-spacing: .045em; }
.brand-copy span { color: #a9a0bb; font-size: 10px; font-weight: 800; letter-spacing: .22em; }
.brand-catalog::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #d6a6ff;
  box-shadow: 0 0 0 4px rgba(155,99,246,.13), 0 0 18px rgba(210,145,255,.9), 0 0 30px rgba(236,72,153,.42);
}
.brand-tag {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 7px;
  padding: 0 11px;
  color: #bdb4ca;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.brand-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 0 4px rgba(155,99,246,.12); }

.header-actions { display: flex; align-items: center; gap: 14px; }
.live-status {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: #d8d1e5;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,.045);
}
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: #58e6a9; box-shadow: 0 0 0 5px rgba(88,230,169,.13); }
.live-status.is-offline i { background: #f6c65b; box-shadow: 0 0 0 5px rgba(246,198,91,.13); }
.admin-link, .back-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  border-radius: 13px;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  background: var(--ink-3);
  border: 1px solid rgba(255,255,255,.12);
  transition: transform .2s ease, background .2s ease;
}
.admin-link:hover, .back-link:hover { transform: translateY(-2px); background: #30264b; }
.back-link svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 40px;
  min-height: 440px;
  padding-block: 44px 68px;
}

.hero-content { position: relative; z-index: 2; }
.eyebrow { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; }
.eyebrow span { color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: .26em; }
.eyebrow b { color: #9a90ad; font-size: 13px; font-weight: 650; }
.eyebrow b::before { content: ""; display: inline-block; width: 28px; height: 1px; margin: 0 12px 4px 0; background: #5f566e; }
.hero h1 { margin: 0; max-width: 650px; font-size: clamp(46px, 5.8vw, 76px); line-height: 1.03; letter-spacing: -.055em; }
.hero h1 em { font-style: normal; color: transparent; background: linear-gradient(105deg, #fff 12%, #cf9fff 48%, #ff8dbf 84%); background-clip: text; -webkit-background-clip: text; }
.hero-lead { max-width: 560px; margin: 22px 0 0; color: #aea6bb; font-size: 16px; line-height: 1.75; }

.hero-mark { position: relative; min-height: 340px; display: grid; place-items: center; }
.hero-mark::before, .hero-mark::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(190,151,255,.18);
}
.hero-mark::before { inset: 17px; }
.hero-mark::after { inset: 62px; border-style: dashed; animation: spin 22s linear infinite; }
.hero-logo-card {
  position: relative;
  z-index: 2;
  width: 270px;
  height: 270px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 52px;
  background: #fff;
  transform: rotate(3deg);
  box-shadow: 0 34px 80px rgba(0,0,0,.4), 18px 18px 0 rgba(155,99,246,.14), -12px -10px 0 rgba(236,72,153,.08);
}
.hero-logo-card img { width: 100%; height: 100%; object-fit: contain; transform: rotate(-3deg); }
.orbit { position: absolute; z-index: 3; width: 16px; height: 16px; border-radius: 50%; }
.orbit-a { top: 45px; left: 78px; background: var(--gold); box-shadow: 0 0 22px rgba(246,198,91,.7); }
.orbit-b { right: 55px; bottom: 70px; width: 11px; height: 11px; background: var(--pink); box-shadow: 0 0 20px rgba(236,72,153,.7); }
.spark { position: absolute; z-index: 3; width: 23px; height: 23px; border: solid var(--purple); border-width: 0 5px 5px 0; transform: rotate(45deg); }
.spark-a { right: 22px; top: 115px; }
.spark-b { left: 32px; bottom: 105px; transform: rotate(225deg) scale(.7); border-color: var(--cyan); }

.catalog {
  position: relative;
  z-index: 2;
  color: var(--text);
  padding: 54px;
  background: var(--paper);
  border-radius: 34px;
  box-shadow: var(--shadow);
}

.catalog-top { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.section-kicker { margin: 0 0 9px; color: var(--purple-dark); font-size: 11px; font-weight: 900; letter-spacing: .23em; }
.catalog h2, .admin-intro h1 { margin: 0; font-size: clamp(29px, 4vw, 45px); letter-spacing: -.045em; }
.faction-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-width: 380px; padding: 6px; background: #e6e1f0; border-radius: 18px; }
.faction-tab {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  color: #6a6278;
  background: transparent;
  border: 0;
  border-radius: 13px;
  font-weight: 800;
  transition: .2s ease;
}
.faction-tab:hover { color: var(--text); }
.faction-tab.is-active { color: #fff; background: var(--ink-2); box-shadow: 0 8px 22px rgba(20,15,35,.2); }
.tab-index { font-size: 10px; opacity: .6; letter-spacing: .08em; }

.catalog-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 10px 0 22px; padding-top: 24px; border-top: 1px solid var(--line); }
.search-field { position: relative; flex: 1; max-width: 380px; display: flex; align-items: center; }
.search-field svg { position: absolute; left: 17px; width: 19px; fill: none; stroke: #756c82; stroke-width: 2; pointer-events: none; }
.search-field input { width: 100%; min-height: 50px; padding: 0 18px 0 47px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 14px; outline: none; }
.search-field input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(155,99,246,.13); }
.heat-filters { display: flex; align-items: center; gap: 8px; }
.heat-filter { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; color: #706779; background: transparent; border: 1px solid #dad4e5; border-radius: 12px; font-size: 13px; font-weight: 750; transition: .2s ease; }
.heat-filter:hover { border-color: #afa6bb; color: var(--text); }
.heat-filter.is-active { color: #fff; background: var(--ink-2); border-color: var(--ink-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.cold { background: #4ebcf1; }.dot.warm { background: #aa6cf2; }.dot.hot { background: #ff6976; }

.heat-section { margin-top: 18px; }
.heat-heading { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 19px; color: #fff; border-radius: 16px 16px 7px 7px; overflow: hidden; }
.heat-blue .heat-heading { background: linear-gradient(100deg, #194f90, #167da0); }
.heat-violet .heat-heading { background: linear-gradient(100deg, #6536a4, #9b4f88); }
.heat-coral .heat-heading { background: linear-gradient(100deg, #ba3d62, #d95c45); }
.heat-heading > div { display: flex; align-items: baseline; gap: 9px; }
.heat-heading h3 { margin: 0; font-size: 16px; }
.heat-heading small { color: rgba(255,255,255,.65); font-size: 10px; letter-spacing: .08em; }
.heat-pulse { width: 8px; height: 8px; align-self: center; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px rgba(255,255,255,.12); }
.heat-summary { font-size: 12px; color: rgba(255,255,255,.8); }
.table-head, .role-row { display: grid; grid-template-columns: minmax(190px, 1.35fr) repeat(4, 1fr); align-items: center; }
.table-head { min-height: 46px; padding: 0 22px; color: #847c90; font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.table-head span:not(:first-child) { text-align: center; }
.role-list { display: grid; gap: 6px; }
.role-row { min-height: 63px; padding: 0 22px; background: #fff; border: 1px solid var(--line); border-radius: 13px; animation: row-in .35s both; animation-delay: var(--delay); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.role-row:hover { z-index: 1; transform: translateY(-2px); border-color: rgba(155,99,246,.26); box-shadow: 0 10px 24px rgba(25,18,42,.08); }
.role-name { display: flex; align-items: center; gap: 15px; }
.role-name span { width: 27px; color: #b3abba; font-size: 10px; font-variant-numeric: tabular-nums; }
.role-name b { font-size: 15px; }
.price-cell { text-align: center; }
.price-cell small { display: none; }
.price-cell strong { color: #5b5365; font-size: 17px; font-variant-numeric: tabular-nums; }
.price-cell.price-s strong { color: var(--purple-dark); font-size: 18px; }

.loading-state, .empty-state { min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--muted); }
.loading-state span { width: 34px; height: 34px; border: 3px solid #ded8e8; border-top-color: var(--purple); border-radius: 50%; animation: spin 1s linear infinite; }
.loading-state p, .empty-state p { margin: 0; font-size: 13px; }
.empty-state b { color: var(--text); font-size: 18px; }
.empty-state.error b { color: #ba3150; }

.notice { position: relative; z-index: 1; display: flex; align-items: center; gap: 17px; margin-top: 26px; padding: 24px 30px; color: #d4ccdf; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.09); border-radius: 20px; }
.notice-icon { width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center; border-radius: 13px; background: rgba(155,99,246,.16); }
.notice-icon svg { width: 21px; fill: none; stroke: #c398ff; stroke-width: 1.8; stroke-linecap: round; }
.notice b { display: block; margin-bottom: 4px; font-size: 14px; }
.notice p { margin: 0; color: #968da4; font-size: 12px; line-height: 1.7; }

.site-footer { position: relative; z-index: 1; min-height: 190px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #71697f; }
.footer-brand { display: flex; align-items: center; gap: 13px; }
.footer-brand span { color: #fff; font-size: 19px; font-weight: 900; }
.footer-brand small { font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.site-footer p { font-size: 12px; }

/* Admin */
.admin-body { background: #efecf7; color: var(--text); }
.admin-header { color: #fff; }
.admin-main { padding: 54px 0 100px; }
.admin-intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.admin-intro > div > p:last-child { margin: 14px 0 0; color: var(--muted); }
.demo-badge { min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px; color: #7846b9; background: #e8dafc; border: 1px solid #d4baf7; border-radius: 999px; font-size: 12px; font-weight: 800; }
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 34px; }
.admin-stats > div { min-height: 136px; display: flex; flex-direction: column; justify-content: center; padding: 24px; color: #fff; background: var(--ink-2); border-radius: 20px; box-shadow: 0 12px 30px rgba(18,13,31,.12); }
.admin-stats > div:nth-child(2) { background: #513889; }
.admin-stats > div:nth-child(3) { background: #8e3f68; }
.admin-stats > div:nth-child(4) { background: #255d61; }
.admin-stats small { color: rgba(255,255,255,.66); font-size: 12px; }
.admin-stats strong { margin: 5px 0 3px; font-size: 34px; line-height: 1; }
.admin-stats span { color: rgba(255,255,255,.45); font-size: 9px; font-weight: 850; letter-spacing: .16em; }
.admin-stats .status-word { color: #84f2c0; font-size: 27px; }
.admin-panel { margin-top: 22px; padding: 25px; background: #fff; border-radius: 26px; box-shadow: 0 20px 60px rgba(29,20,48,.1); }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.faction-tabs.compact { min-width: 290px; }
.faction-tabs.compact .faction-tab { min-height: 46px; }
.admin-search { max-width: 290px; }
.admin-table-head, .admin-row { display: grid; grid-template-columns: minmax(130px, 1.25fr) .7fr repeat(4, .85fr) .72fr; align-items: center; gap: 12px; }
.admin-table-head { min-height: 44px; padding: 0 15px; color: #898092; font-size: 11px; font-weight: 800; }
.admin-rows { display: grid; gap: 7px; }
.admin-row { min-height: 67px; padding: 9px 15px; background: #f8f6fc; border: 1px solid #ebe7f2; border-radius: 13px; transition: .2s ease; }
.admin-row.is-dirty { border-color: #c6a7f4; box-shadow: 0 0 0 3px rgba(155,99,246,.09); }
.admin-role { display: flex; align-items: center; gap: 10px; }
.admin-role span { color: #aaa1b4; font-size: 10px; }
.admin-role b { font-size: 14px; }
.heat-tag { width: max-content; min-height: 27px; display: inline-flex; align-items: center; padding: 0 9px; border-radius: 8px; font-size: 10px; font-weight: 800; }
.heat-tag.cold { color: #166988; background: #d8f3fd; }.heat-tag.warm { color: #7343a3; background: #eddffc; }.heat-tag.hot { color: #a83b49; background: #fee1e5; }
.admin-row label span { display: none; }
.admin-row input { width: 100%; min-height: 40px; padding: 0 10px; color: var(--text); background: #fff; border: 1px solid #ded8e7; border-radius: 9px; outline: none; font-weight: 750; text-align: center; }
.admin-row input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(155,99,246,.12); }
.save-button { min-height: 40px; color: #fff; background: var(--ink-2); border: 0; border-radius: 9px; font-size: 12px; font-weight: 800; transition: .2s ease; }
.save-button:hover { background: var(--purple-dark); }
.save-button:disabled { cursor: wait; opacity: .68; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 26px; min-width: 260px; padding: 15px 20px; color: #fff; background: #245f4d; border-radius: 13px; box-shadow: 0 15px 40px rgba(0,0,0,.25); text-align: center; font-size: 13px; font-weight: 750; opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: .25s ease; }
.toast.error { background: #a8394e; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; min-height: 390px; padding-block: 36px 58px; }
  .hero-mark { min-height: 275px; }
  .hero-logo-card { width: 215px; height: 215px; border-radius: 42px; }
  .catalog { padding: 38px 30px; }
  .catalog-top { align-items: stretch; flex-direction: column; }
  .faction-tabs { min-width: 0; width: 100%; }
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .admin-table-head { display: none; }
  .admin-row { grid-template-columns: 1.3fr .8fr repeat(4, .8fr) .8fr; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 1180px); }
  .site-header { min-height: 78px; }
  .brand-logo { width: 42px; height: 42px; flex-basis: 42px; }
  .brand-logo-full { width: 52px; height: 52px; flex-basis: 52px; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy span { max-width: 190px; overflow: hidden; font-size: 7px; white-space: nowrap; }
  .brand-catalog::before { width: 7px; height: 7px; flex-basis: 7px; }
  .brand-tag { display: none; }
  .live-status { display: none; }
  .admin-link { min-height: 40px; padding: 0 13px; font-size: 12px; }
  .hero { display: block; min-height: 0; padding: 28px 0 44px; }
  .eyebrow { gap: 10px; margin-bottom: 14px; }
  .eyebrow span { font-size: 9px; letter-spacing: .22em; }
  .eyebrow b { font-size: 11px; }
  .eyebrow b::before { width: 20px; margin-right: 9px; }
  .hero h1 { max-width: 560px; font-size: clamp(38px, 10.6vw, 49px); line-height: 1.06; letter-spacing: -.045em; }
  .hero-lead { max-width: 96%; margin-top: 17px; font-size: 14px; line-height: 1.68; }
  .hero-mark {
    position: absolute;
    right: 34px;
    top: -14px;
    bottom: auto;
    width: clamp(118px, 23vw, 150px);
    min-height: clamp(118px, 23vw, 150px);
    display: grid;
    place-items: center;
    opacity: 1;
    pointer-events: none;
  }
  .hero-mark::before { inset: -5px; }
  .hero-mark::after, .hero-mark .orbit, .hero-mark .spark { display: none; }
  .hero-logo-card {
    width: clamp(108px, 21vw, 140px);
    height: clamp(108px, 21vw, 140px);
    aspect-ratio: 1 / 1;
    border-radius: 24px;
    transform: none;
    box-shadow: 0 18px 38px rgba(0,0,0,.34), 8px 8px 0 rgba(155,99,246,.13);
  }
  .hero-logo-card img { transform: none; }
  .catalog { width: 100%; padding: 26px 12px 30px; border-radius: 27px 27px 0 0; }
  .catalog-top { padding-inline: 5px; margin-bottom: 20px; }
  .catalog h2 { font-size: 29px; }
  .faction-tab { min-height: 54px; padding: 0 12px; }
  .catalog-controls { align-items: stretch; flex-direction: column; margin: 8px 0 18px; padding-top: 20px; }
  .search-field { max-width: none; }
  .heat-filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .heat-filter { min-width: 0; padding: 0 5px; font-size: 11px; }
  .heat-heading { min-height: 55px; padding: 0 14px; }
  .heat-heading small { display: none; }
  .heat-summary { font-size: 10px; }
  .table-head { display: none; }
  .role-list { gap: 7px; margin-top: 7px; }
  .role-row { grid-template-columns: 1.5fr repeat(4, .7fr); min-height: 67px; padding: 0 10px; border-radius: 12px; }
  .role-name { gap: 7px; }
  .role-name span { width: 20px; font-size: 9px; }
  .role-name b { font-size: 13px; }
  .price-cell small { display: block; margin-bottom: 2px; color: #aaa2b0; font-size: 8px; font-weight: 750; }
  .price-cell strong, .price-cell.price-s strong { font-size: 13px; }
  .notice { margin-top: 12px; padding: 19px 18px; border-radius: 0; }
  .site-footer { min-height: 140px; align-items: flex-start; flex-direction: column; justify-content: center; }
  .site-footer p { margin: 0; }

  .admin-header .brand-copy span { display: none; }
  .back-link { min-height: 40px; padding: 0 12px; font-size: 11px; }
  .admin-main { padding-top: 32px; }
  .admin-intro { align-items: flex-start; flex-direction: column; }
  .admin-intro h1 { font-size: 34px; }
  .admin-stats { gap: 8px; margin-top: 25px; }
  .admin-stats > div { min-height: 112px; padding: 17px; border-radius: 16px; }
  .admin-stats strong { font-size: 28px; }
  .admin-panel { padding: 12px; border-radius: 20px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .faction-tabs.compact, .admin-search { width: 100%; max-width: none; min-width: 0; }
  .admin-row { grid-template-columns: 1fr 1fr; gap: 9px; padding: 13px; }
  .admin-role { grid-column: 1; }
  .heat-tag { grid-column: 2; justify-self: end; }
  .admin-row label { display: flex; align-items: center; gap: 7px; }
  .admin-row label span { width: 28px; display: inline; color: var(--muted); font-size: 9px; font-weight: 800; }
  .admin-row input { flex: 1; }
  .save-button { grid-column: 1 / -1; min-height: 43px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
