/* ---------- tokens ---------- */
:root {
  --safe-top: max(env(safe-area-inset-top, 0px), var(--eazo-safe-area-top, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--eazo-safe-area-right, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--eazo-safe-area-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--eazo-safe-area-left, 0px));

  --bg: #08090d;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3f4f7;
  --muted: #98a0af;
  --accent: #ff7a45;
  --accent-soft: #ffb547;
  --radius: 18px;

  --cat-love: #ff5f7e;
  --cat-people: #ffb547;
  --cat-growth: #3fd6a4;
  --cat-mind: #7c9cff;

  --serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
}

.safe-pt { padding-top: var(--safe-top); }
.safe-pb { padding-bottom: var(--safe-bottom); }
.safe-px {
  padding-left: calc(var(--safe-left) + 16px);
  padding-right: calc(var(--safe-right) + 16px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.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;
}

/* ---------- backdrop ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.backdrop__glow {
  position: absolute;
  width: 70vw; height: 70vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}
.backdrop__glow--warm {
  top: -26vw; left: -20vw;
  background: radial-gradient(circle, rgba(255, 122, 69, 0.55), transparent 68%);
}
.backdrop__glow--deep {
  bottom: -30vw; right: -24vw;
  background: radial-gradient(circle, rgba(124, 62, 138, 0.5), transparent 70%);
}
.backdrop__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
}

/* ---------- shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- header ---------- */
.head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(8, 9, 13, 0.94) 62%, rgba(8, 9, 13, 0.72) 100%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.head__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 12px;
}

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

.brand__mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  flex: none;
  border-radius: 13px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  color: #1a0f07;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent));
  box-shadow: 0 8px 22px -8px rgba(255, 122, 69, 0.85);
}

.brand__copy { min-width: 0; }

.brand__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand__subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang { flex: none; }

.lang__select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  padding: 7px 22px 7px 10px;
  border-radius: 999px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.lang__select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- search ---------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
  padding-top: 2px;
  padding-bottom: 12px;
}

.search__icon {
  position: absolute;
  left: calc(var(--safe-left) + 28px);
  width: 17px; height: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.9;
  stroke-linecap: round;
  pointer-events: none;
}

.search__input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 12px 40px 12px 40px;
  border-radius: 14px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.search__input::placeholder { color: rgba(152, 160, 175, 0.8); }
.search__input:focus {
  outline: none;
  border-color: rgba(255, 122, 69, 0.55);
  background: var(--panel-strong);
}
.search__input::-webkit-search-cancel-button { display: none; }

.search__clear {
  position: absolute;
  right: calc(var(--safe-right) + 26px);
  width: 26px; height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- filters ---------- */
.filters { padding-bottom: 12px; }

.filters__row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filters__row::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease,
    transform 0.12s ease;
}
.chip:active { transform: scale(0.96); }
.chip.is-active {
  color: #1a0f07;
  border-color: transparent;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent));
  font-weight: 700;
}

/* ---------- content ---------- */
.content { flex: 1; padding-top: 16px; padding-bottom: 8px; }

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

.toolbar__meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.favtab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.favtab__icon {
  width: 14px; height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}
.favtab__count {
  min-width: 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-soft);
}
.favtab.is-active {
  color: var(--cat-love);
  border-color: rgba(255, 95, 126, 0.5);
  background: rgba(255, 95, 126, 0.12);
}
.favtab.is-active .favtab__icon { fill: currentColor; }

/* ---------- list ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }

.card {
  position: relative;
  padding: 17px 17px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--cat);
  opacity: 0.85;
}

.card::after {
  content: "”";
  position: absolute;
  right: 10px; bottom: -22px;
  font-family: var(--serif);
  font-size: 96px;
  line-height: 1;
  color: var(--cat);
  opacity: 0.09;
  pointer-events: none;
}

.card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card__cat {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--cat);
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cat) 15%, transparent);
}

.card__index {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  color: rgba(152, 160, 175, 0.7);
  letter-spacing: 0.12em;
}

.card__text {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.78;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #eef0f4;
  text-wrap: pretty;
}

.card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.07);
}

.act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.act:active { transform: scale(0.94); }
.act:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.act svg {
  width: 14px; height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.act--fav.is-on { color: var(--cat-love); }
.act--fav.is-on svg { fill: currentColor; stroke: currentColor; }
.act--fav.is-on .act__label { font-weight: 700; }
.act--fav.pop svg { animation: pop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1); }

@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.42); }
  100% { transform: scale(1); }
}

/* ---------- empty ---------- */
.empty {
  text-align: center;
  padding: 54px 20px 40px;
}
.empty__mark {
  font-family: var(--serif);
  font-size: 68px;
  line-height: 0.6;
  color: rgba(255, 122, 69, 0.32);
}
.empty__title {
  margin: 14px 0 6px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}
.empty__desc {
  margin: 0 auto;
  max-width: 260px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.empty__action {
  margin-top: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
}
.empty__action:hover { border-color: rgba(255, 122, 69, 0.5); }

/* ---------- footer ---------- */
.foot {
  padding-top: 26px;
  padding-bottom: calc(var(--safe-bottom) + 26px);
  text-align: center;
}
.foot__line {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  color: rgba(243, 244, 247, 0.55);
  letter-spacing: 0.04em;
}
.foot__tag {
  margin: 8px 0 0;
  font-size: 11px;
  color: rgba(152, 160, 175, 0.62);
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 26px);
  transform: translate(-50%, 18px);
  z-index: 40;
  max-width: min(88vw, 420px);
  padding: 11px 18px;
  border: 1px solid rgba(255, 122, 69, 0.32);
  border-radius: 999px;
  background: rgba(20, 16, 14, 0.94);
  backdrop-filter: blur(12px);
  color: var(--text);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 600px) {
  .list { gap: 14px; }
  .card { padding: 20px 22px 14px; }
  .card__text { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
