:root {
  --bg: #eef1f4;
  --ink: #17191d;
  --muted: #69717d;
  --line: rgba(42, 48, 58, 0.11);
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.84);
  --blue: #2b6ef3;
  --cyan: #10a6bd;
  --rose: #d9487f;
  --green: #178b62;
  --shadow: 0 18px 50px rgba(28, 35, 45, 0.14);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 5%, rgba(255, 255, 255, 0.92), transparent 18rem),
    linear-gradient(135deg, #f8faf9 0%, #e8edf2 52%, #f4edf1 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(88px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

.app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 45;
  width: min(100%, 480px);
  margin: 0 auto;
  background: #0c1016;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--detail-scrim-duration, 220ms) var(--detail-scrim-easing, cubic-bezier(0.22, 0.61, 0.36, 1));
}

body.detail-swipe-active .app-shell::after {
  opacity: var(--detail-scrim-opacity, 0.44);
}

body.detail-swipe-dragging .app-shell::after {
  transition: none;
}

.glass {
  border: 1px solid rgba(255, 255, 255, 0.64);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}

.mini-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  color: #3a414d;
  font-size: 13px;
  font-weight: 800;
}

.brand-pill svg {
  width: 19px;
  height: 19px;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--radius);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.2;
}

p {
  color: var(--muted);
  line-height: 1.58;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.icon-button svg,
.search-box svg,
.nav-item svg,
.primary-button svg,
.link-button svg,
.rule-item svg,
.member-ring svg,
.empty-state svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
}

.view {
  display: none;
  padding-top: 14px;
}

.view.active {
  display: block;
}

.view.active.search-home {
  display: grid;
}

.search-home {
  align-content: start;
  gap: 18px;
  min-height: calc(100vh - 146px);
  padding-top: min(94px, 16vh);
}

.search-home.has-query {
  min-height: auto;
  padding-top: 18px;
}

.hero-title {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.search-home.has-query .hero-title {
  display: none;
}

.logo-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--blue);
  box-shadow: 0 16px 40px rgba(28, 35, 45, 0.1);
}

.logo-mark svg {
  width: 22px;
  height: 22px;
}

.hero-title h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.search-panel {
  position: relative;
  display: grid;
  gap: 12px;
  border-radius: 999px;
}

.search-box {
  display: grid;
  grid-template-columns: 26px 1fr 34px;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 0 10px 0 17px;
  border-radius: 999px;
  background: var(--glass-strong);
}

.search-box svg {
  color: #222832;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
}

.search-box input::placeholder {
  color: #8a929e;
  font-weight: 650;
}

.clear-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(237, 240, 244, 0.9);
  color: #5f6875;
}

.suggestion-list {
  display: grid;
  gap: 4px;
  max-height: 252px;
  padding: 8px;
  overflow-y: auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 55px rgba(28, 35, 45, 0.16);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
}

.suggestion-list[hidden] {
  display: none;
}

.suggestion-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  padding: 0 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.suggestion-item:hover,
.suggestion-item.active,
.suggestion-item[aria-selected="true"] {
  background: rgba(43, 110, 243, 0.09);
  color: var(--ink);
}

.quick-row,
.tag-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-row {
  justify-content: center;
  padding-top: 0;
}

.quick-row::-webkit-scrollbar,
.tag-row::-webkit-scrollbar,
.gallery-strip::-webkit-scrollbar {
  display: none;
}

.quick-chip,
.tag {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
  color: #303640;
  white-space: nowrap;
}

.quick-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 10px 24px rgba(28, 35, 45, 0.06);
}

.tag {
  padding: 5px 8px;
  font-size: 12px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 2px 10px;
}

.quiet-helper {
  display: flex;
  justify-content: center;
  color: #7a828d;
  font-size: 12px;
}

.search-results-block {
  display: grid;
  gap: 0;
}

#resultCount {
  display: inline-flex;
  min-width: 32px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 700;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.script-card {
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: var(--glass-strong);
  box-shadow: 0 14px 32px rgba(22, 29, 38, 0.12);
  text-align: left;
}

.script-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #111827;
}

.script-card h3 {
  margin: 8px 0 5px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.status-dot::before {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--green);
  content: "";
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 26px 18px;
  border-radius: var(--radius);
  text-align: center;
}

.empty-state h2,
.empty-state p {
  margin-bottom: 0;
}

.primary-button,
.secondary-button,
.link-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  font-weight: 700;
}

.clipboard-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border-radius: var(--radius);
}

.clipboard-entry p,
.clipboard-entry span {
  display: block;
  margin: 0;
}

.clipboard-entry p {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.clipboard-entry span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.clipboard-entry .primary-button {
  min-height: 42px;
  padding: 0 11px;
  white-space: nowrap;
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.timeline {
  display: grid;
  gap: 10px;
}

.benefit-notice {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: var(--radius);
}

.benefit-notice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.benefit-notice-head h3 {
  margin-bottom: 0;
}

.benefit-notice-head > svg {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: var(--green);
}

.benefit-list {
  display: grid;
  gap: 9px;
}

.benefit-list article {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
}

.benefit-list svg {
  width: 19px;
  height: 19px;
  margin-top: 1px;
  color: var(--blue);
}

.benefit-list p {
  min-width: 0;
  margin-bottom: 0;
  color: #3f4854;
  font-size: 13px;
  line-height: 1.48;
}

.timeline-item {
  display: grid;
  grid-template-columns: 7px 1fr;
  gap: 11px;
  padding: 12px;
  border-radius: var(--radius);
}

.timeline-mark {
  width: 7px;
  height: 100%;
  min-height: 54px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--blue), var(--rose));
}

.timeline-item h3,
.timeline-item p {
  margin-bottom: 3px;
}

.timeline-item time {
  color: var(--muted);
  font-size: 12px;
}

.member-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 2px;
  padding: 22px 18px;
  border-radius: var(--radius);
  text-align: center;
}

.member-card h2,
.member-card p {
  margin-bottom: 0;
}

.member-ring {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(43, 110, 243, 0.16), rgba(217, 72, 127, 0.16));
  color: var(--blue);
}

.member-actions {
  display: grid;
  width: 100%;
  max-width: 260px;
  gap: 7px;
  padding-top: 8px;
}

.member-actions .primary-button {
  width: 100%;
}

.member-action-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.auth-card,
.redeem-card {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius);
  background: rgba(237, 240, 244, 0.72);
}

.auth-tab {
  min-height: 38px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(28, 35, 45, 0.1);
}

.auth-form {
  display: none;
  gap: 10px;
}

.auth-form.active {
  display: grid;
}

.activation-notice {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid rgba(23, 139, 98, 0.2);
  border-radius: var(--radius);
  background: rgba(23, 139, 98, 0.08);
  color: #126a4a;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.clipboard-register-button {
  width: 100%;
}

.clipboard-register-help {
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 360px) {
  .clipboard-entry {
    grid-template-columns: 1fr;
  }

  .clipboard-entry .primary-button {
    width: 100%;
  }
}

.auth-card label,
.redeem-card label {
  display: grid;
  gap: 7px;
}

.auth-card span,
.redeem-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-card input,
.auth-card textarea,
.redeem-card input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.auth-card textarea {
  min-height: 74px;
  resize: vertical;
  padding-top: 10px;
  line-height: 1.42;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: end;
  gap: 8px;
}

.auth-card .primary-button {
  width: 100%;
}

.rule-list {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.rule-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 13px;
  border-radius: var(--radius);
}

.rule-item svg {
  margin-top: 1px;
  color: var(--cyan);
}

.rule-item p {
  margin-bottom: 0;
  font-size: 13px;
}

.detail-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(238, 241, 244, 0.6), rgba(238, 241, 244, 0.95)),
    #eef1f4;
  box-shadow: -18px 0 45px rgba(16, 24, 39, 0.2);
  overscroll-behavior: contain;
  touch-action: pan-y;
  transform: translate3d(0, 0, 0);
  transition: transform var(--detail-settle-duration, 220ms) var(--detail-settle-easing, cubic-bezier(0.22, 0.61, 0.36, 1));
  will-change: transform;
}

.detail-screen.is-dragging {
  transition: none;
}

.detail-screen.is-settling {
  transition: transform var(--detail-settle-duration, 260ms) var(--detail-settle-easing, cubic-bezier(0.16, 1, 0.3, 1));
}

.detail-nav {
  position: sticky;
  top: 10px;
  z-index: 2;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius);
  text-align: center;
}

.detail-nav strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin-top: 12px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 22px 60px rgba(16, 24, 39, 0.24);
}

.detail-body {
  margin-top: 12px;
  padding: 15px;
  border-radius: var(--radius);
}

.detail-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title-row span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.summary {
  margin: 13px 0;
  color: #46505c;
  font-size: 14px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0 0 14px;
}

.meta-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.64);
}

.meta-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.meta-grid dd {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-stack {
  display: grid;
  gap: 9px;
}

.link-button {
  width: 100%;
}

.link-button.secondary {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.link-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.gallery-strip {
  display: flex;
  gap: 9px;
  padding: 12px 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.gallery-strip img {
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(22, 29, 38, 0.12);
}

.bottom-nav {
  position: fixed;
  right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(calc(100% - 28px), 452px);
  margin: 0 auto;
  padding: 7px;
  border-radius: var(--radius);
}

.nav-item {
  display: grid;
  min-width: 0;
  height: 48px;
  place-items: center;
  gap: 2px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
}

.feedback-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: end;
  justify-items: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 24, 32, 0.3);
}

.sheet-panel {
  position: relative;
  width: min(100% - 24px, 456px);
  padding: 14px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.sheet-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sheet-panel h2 {
  font-size: 18px;
}

.sheet-panel label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sheet-panel input,
.sheet-panel select,
.sheet-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.sheet-panel input,
.sheet-panel select {
  height: 44px;
  padding: 0 10px;
}

.sheet-panel textarea {
  resize: vertical;
  padding: 10px;
}

.sheet-panel .primary-button {
  width: 100%;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 18px;
  z-index: 90;
  width: min(calc(100% - 36px), 420px);
  margin: 0 auto;
  padding: 11px 13px;
  border-radius: var(--radius);
  background: rgba(23, 25, 29, 0.92);
  color: white;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.review-toggle {
  position: fixed;
  right: 18px;
  top: calc(18px + env(safe-area-inset-top));
  z-index: 95;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: rgba(23, 25, 29, 0.88);
  color: white;
  box-shadow: 0 14px 34px rgba(22, 29, 38, 0.18);
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.review-toggle.active {
  background: var(--rose);
}

.review-pick-mode,
.review-pick-mode * {
  cursor: crosshair !important;
}

.review-pick-mode .app-shell {
  outline: 2px solid rgba(217, 72, 127, 0.72);
  outline-offset: -2px;
}

@media (min-width: 481px) {
  body {
    padding: 18px 0;
  }

  .app-shell {
    min-height: calc(100vh - 36px);
    border-radius: 24px;
    box-shadow: 0 24px 70px rgba(25, 31, 40, 0.16);
  }
}

@media (max-width: 350px) {
  .result-grid {
    grid-template-columns: 1fr;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }
}
