:root {
  color-scheme: dark;
  --bg: #050914;
  --panel: rgba(11, 18, 32, 0.92);
  --panel-2: rgba(17, 29, 49, 0.86);
  --text: #f8fbff;
  --muted: rgba(248, 251, 255, 0.66);
  --gold: #f3bd47;
  --yellow: #ffdc2e;
  --cyan: #35d9e8;
  --blue: #438dff;
  --red: #ff604f;
  --green: #55df8d;
  --purple: #b868ff;
  --orange: #ff9a35;
  --radius: 22px;
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 80% -10%, rgba(45, 121, 221, 0.35), transparent 28rem),
    linear-gradient(180deg, #081327 0%, #040711 100%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) clamp(14px, 3vw, 28px) 42px;
}

.village-header {
  position: relative;
  min-height: clamp(185px, 30vw, 290px);
  overflow: hidden;
  border: 1px solid rgba(67, 141, 255, 0.45);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(3, 7, 16, 0.9), rgba(3, 7, 16, 0.18) 58%, rgba(3, 7, 16, 0.72)),
    var(--header-image) center / cover;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.icon-button {
  position: absolute;
  z-index: 2;
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 18px;
  color: var(--gold);
  background: rgba(4, 8, 15, 0.32);
  display: grid;
  place-items: center;
}

.menu-button {
  left: 14px;
  top: 14px;
}

.admin-button {
  right: 14px;
  top: 14px;
  color: var(--blue);
}

svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-copy {
  position: absolute;
  left: clamp(24px, 6vw, 58px);
  bottom: clamp(24px, 6vw, 48px);
}

.header-copy h1 {
  margin: 0 0 6px;
  font-size: clamp(2.45rem, 8vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.header-copy p,
.header-copy strong {
  display: block;
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 2rem);
}

.header-copy p {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.header-copy strong {
  color: var(--gold);
}

.item-count {
  position: absolute;
  right: clamp(24px, 5vw, 48px);
  bottom: clamp(28px, 7vw, 56px);
  text-align: center;
}

.item-count strong {
  display: block;
  font-size: clamp(2.5rem, 8vw, 4.6rem);
  line-height: 0.9;
}

.item-count span {
  color: rgba(255, 255, 255, 0.74);
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  font-weight: 800;
}

.kind-nav,
.source-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 16px 0 10px;
  scrollbar-width: none;
}

.kind-nav::-webkit-scrollbar,
.source-row::-webkit-scrollbar {
  display: none;
}

.kind-button,
.source-row button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid color-mix(in srgb, currentColor 42%, transparent);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px 16px;
  font: inherit;
  font-size: clamp(1rem, 3.4vw, 1.35rem);
  font-weight: 900;
}

.kind-button strong {
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 22%, transparent);
}

.kind-button.active,
.source-row button.selected {
  background: color-mix(in srgb, currentColor 26%, transparent);
}

.gold { color: var(--gold); }
.yellow { color: var(--yellow); }
.cyan { color: var(--cyan); }
.blue { color: var(--blue); }
.red { color: var(--red); }
.green { color: var(--green); }
.purple { color: var(--purple); }
.orange { color: var(--orange); }

.section-stack {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.feed-section {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    var(--panel);
}

.section-header {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 22px;
  font: inherit;
  font-weight: 900;
}

.section-header span {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: clamp(1.8rem, 5vw, 2.65rem);
}

.section-header strong {
  border-radius: 999px;
  padding: 8px 14px;
  background: color-mix(in srgb, currentColor 18%, transparent);
  font-size: 1.15rem;
}

.source-row {
  padding: 0 22px 16px;
}

.source-row button {
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 1rem;
}

.section-body {
  display: grid;
  gap: 0;
  max-height: min(660px, 72vh);
  overflow: auto;
  padding: 0 22px 20px;
}

.feed-row {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text);
  padding: 18px 0;
  text-align: left;
  font: inherit;
}

.feed-row:first-child {
  border-top: 0;
}

.row-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: currentColor;
  background: color-mix(in srgb, currentColor 16%, transparent);
  display: grid;
  place-items: center;
}

.row-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.row-copy strong,
.preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: clamp(1.15rem, 4vw, 1.7rem);
  font-weight: 900;
}

.row-copy small {
  color: var(--muted);
  font-size: clamp(0.95rem, 3vw, 1.2rem);
}

.row-copy em {
  width: fit-content;
  border-radius: 999px;
  padding: 5px 10px;
  color: currentColor;
  background: color-mix(in srgb, currentColor 16%, transparent);
  font-style: normal;
  font-weight: 900;
}

.row-meta {
  color: currentColor;
  font-size: clamp(1rem, 3vw, 1.35rem);
  font-weight: 900;
  text-align: right;
}

.row-meta strong,
.row-meta small {
  display: block;
}

.row-meta.negative {
  color: var(--red);
}

.empty,
.preview {
  margin: 0 22px 20px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.footer-links button,
.drawer-close,
.action-row a,
.action-row button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--text);
  background: rgba(67, 141, 255, 0.2);
  font: inherit;
  font-weight: 900;
  text-decoration: none;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.58);
}

.drawer-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: 86vh;
  margin: 0 auto;
  overflow: auto;
  border-radius: 30px 30px 0 0;
  border: 1px solid rgba(67, 141, 255, 0.38);
  background:
    radial-gradient(circle at top right, rgba(67, 141, 255, 0.22), transparent 22rem),
    #07101e;
  padding: 36px clamp(20px, 4vw, 34px) calc(28px + env(safe-area-inset-bottom));
}

.drawer-grip {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 88px;
  height: 7px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
}

.drawer-close {
  position: absolute;
  top: 22px;
  right: 22px;
  color: var(--gold);
}

.drawer-hero,
.drawer-block {
  border: 1px solid rgba(53, 217, 232, 0.26);
  border-radius: 22px;
  background: var(--panel-2);
  padding: 20px;
}

.drawer-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
}

.drawer-hero > span {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: var(--cyan);
  background: rgba(53, 217, 232, 0.14);
  font-size: 2.2rem;
}

.drawer-hero p,
.drawer-hero h2,
.drawer-hero strong,
.drawer-block h3,
.drawer-block p {
  margin: 0;
}

.drawer-hero h2 {
  font-size: clamp(1.8rem, 6vw, 3rem);
}

.drawer-hero p,
.drawer-block h3 {
  color: var(--muted);
  font-weight: 900;
}

.drawer-block {
  margin-top: 14px;
}

.drawer-block p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.12rem;
  line-height: 1.45;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .app-shell {
    padding-left: 0;
    padding-right: 0;
  }

  .village-header {
    border-left: 0;
    border-right: 0;
    border-radius: 0 0 24px 24px;
  }

  .kind-nav,
  .section-stack,
  .footer-links {
    padding-left: 14px;
    padding-right: 14px;
  }

  .section-header,
  .source-row,
  .section-body {
    padding-left: 18px;
    padding-right: 18px;
  }
}
