:root {
  --bg: #f6f2ea;
  --panel: #fffaf2;
  --ink: #242321;
  --muted: #6d655b;
  --line: #ded2c1;
  --brand: #147c72;
  --brand-dark: #0d5f58;
  --brand-soft: #d9f0eb;
  --accent: #d85f3c;
  --accent-soft: #ffe1d8;
  --gold-soft: #ffedc8;
  --green-soft: #e2f2db;
  --danger: #b64242;
  --danger-soft: #ffe1df;
  --shadow: 0 18px 48px rgba(58, 43, 24, 0.12);
  --radius: 8px;
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.18) 30rem), var(--bg);
  font-family: var(--font);
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.app-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #fff;
  background: #fff;
  box-shadow: 0 1px 4px rgba(58,43,24,.12);
  flex: 0 0 auto;
  font-weight: 900;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.toolbar-row,
.admin-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-actions { justify-content: flex-end; }

.donate-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.donate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(58, 43, 24, .08);
}

.donate-btn.designer {
  color: #6f3b00;
  border: 1px solid #e1a840;
  background: linear-gradient(180deg, #fff1bd, #ffd978);
}

.donate-btn.server {
  color: #0b4d62;
  border: 1px solid #7bbfcb;
  background: linear-gradient(180deg, #d9f7ff, #9ee2ef);
}

.donate-btn:hover {
  transform: translateY(-1px);
  filter: saturate(1.05);
}

.auth-status {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,253,248,.72);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.surface {
  background: rgba(255,250,242,.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.main-board {
  display: flex;
  flex-direction: column;
  overflow: visible;
  max-height: calc(100vh - 126px);
}

.board-toolbar {
  position: relative;
  z-index: 7;
  display: block;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.42);
}

.board-toolbar > .toolbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  min-width: 0;
}

.filter-panel {
  position: absolute;
  right: 14px;
  top: calc(100% - 2px);
  z-index: 11;
  display: none;
  width: min(520px, calc(100vw - 32px));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(255,250,242,.98);
  box-shadow: 0 18px 34px rgba(58,43,24,.16);
}

.filter-panel.open {
  display: grid;
}

.filter-group {
  display: grid;
  gap: 6px;
}

.filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 76px;
  min-height: 42px;
  padding: 8px 12px;
}

.search {
  position: relative;
  min-width: 220px;
  flex: 1 1 240px;
}

.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search input,
.field > input,
.field textarea,
.field select,
.merge-select {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

.search input {
  min-height: 42px;
  padding-left: 40px;
}

.search input:focus,
.field > input:focus,
.field textarea:focus,
.field select:focus,
.merge-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20,124,114,.14);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field > label,
.field-label {
  color: #4b463e;
  font-size: 13px;
  font-weight: 800;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.field-row label {
  color: #4b463e;
  font-size: 13px;
  font-weight: 800;
}

.tag-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.radio-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  color: #4b463e;
  cursor: pointer;
}

.radio-card input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.radio-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.radio-card:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(20,124,114,.14);
}

.field textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.55;
}

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

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 31px;
}

.quick-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(126,103,76,.22);
  border-radius: 999px;
  color: #4d463d;
  background: #f4eadb;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.quick-tag:hover {
  border-color: rgba(20,124,114,.32);
  background: #eef7f4;
}

.quick-tag.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.quick-tag:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
  min-height: 42px;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.segmented button.active {
  color: #fff;
  background: var(--brand);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  white-space: nowrap;
  text-decoration: none;
}

.btn.primary {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn.ghost { background: transparent; }

.btn.warn {
  color: #734714;
  background: var(--gold-soft);
  border-color: #e3ba71;
}

.btn.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #edb9b5;
}

.wish-list {
  display: grid;
  min-height: 320px;
  max-height: calc(100vh - 196px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.wish-list::-webkit-scrollbar {
  width: 10px;
}

.wish-list::-webkit-scrollbar-track {
  background: rgba(246,242,234,.76);
}

.wish-list::-webkit-scrollbar-thumb {
  border: 2px solid rgba(246,242,234,.76);
  border-radius: 999px;
  background: rgba(126,103,76,.36);
}

.wish-list::-webkit-scrollbar-thumb:hover {
  background: rgba(20,124,114,.48);
}

.wish-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,250,242,.62);
}

.wish-card:last-child { border-bottom: 0; }
.wish-card:hover { background: rgba(255,255,255,.55); }

.wish-head {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.wish-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.wish-desc {
  margin: 0 0 12px;
  color: #3e3a35;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.meta-line,
.tag-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.tag-line { margin-top: 8px; }

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #f4eadb;
  border: 1px solid rgba(126,103,76,.18);
  white-space: nowrap;
}

.pill.game {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: rgba(20,124,114,.22);
}

.pill.feature {
  color: #9a432c;
  background: var(--accent-soft);
  border-color: rgba(216,95,60,.22);
}

.pill.pending {
  color: #744913;
  background: var(--gold-soft);
  border-color: rgba(183,122,28,.28);
}

.pill.approved {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: rgba(20,124,114,.22);
}

.pill.building {
  color: #7a3e16;
  background: #ffe3c2;
  border-color: rgba(196,107,33,.28);
}

.pill.online {
  color: #336b2d;
  background: var(--green-soft);
  border-color: rgba(79,138,72,.28);
}

.pill.hidden {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(182,66,66,.24);
}

.vote-box {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  min-width: 104px;
}

.vote-count {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: var(--brand-dark);
}

.vote-label {
  color: var(--muted);
  font-size: 12px;
}

.vote-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

.vote-btn.voted {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid rgba(20,124,114,.26);
}

.reaction-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: center;
  gap: 8px;
  min-width: 210px;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fffdf8;
  white-space: nowrap;
}

.reaction-icon {
  font-size: 15px;
  line-height: 1;
}

.reaction-btn strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
}

.reaction-btn span {
  font-size: 12px;
  font-weight: 800;
}

.reaction-btn.support.active {
  color: var(--brand-dark);
  border-color: rgba(20,124,114,.3);
  background: var(--brand-soft);
}

.reaction-btn.dislike.active {
  color: var(--danger);
  border-color: rgba(182,66,66,.26);
  background: var(--danger-soft);
}

.comment-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border: 1px solid rgba(126,103,76,.2);
  border-radius: 999px;
  color: var(--brand-dark);
  background: #fffdf8;
  font-size: 12px;
  font-weight: 800;
}

.side-stack {
  display: grid;
  gap: 14px;
}

.panel { padding: 16px; }

.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.25;
}

.panel-subtitle {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.stat {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  font-size: 24px;
  line-height: 1;
}

.rank-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-item {
  display: grid;
  grid-template-columns: 26px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.rank-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.rank-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.rank-votes {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 14px;
  padding: 16px;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-filterbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) minmax(130px, 180px);
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}

.admin-search {
  min-height: 40px;
  background: #fffdf8;
}

.admin-filterbar select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.admin-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.muted-card {
  background: rgba(246,242,234,.64);
}

.admin-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.admin-card p {
  margin: 0 0 10px;
  color: #3e3a35;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.hit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.merge-row {
  display: grid;
  grid-template-columns: minmax(160px,1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.login-panel {
  width: min(460px, calc(100vw - 32px));
  margin: 80px auto;
  padding: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(34,31,27,.46);
  z-index: 20;
}

.modal-backdrop.open { display: flex; }

.modal {
  width: min(720px,100%);
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 26px 80px rgba(30,24,18,.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.36);
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.modal-body { padding: 16px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  color: var(--muted);
  border: 1px solid var(--line);
  background: #fffdf8;
  font-size: 24px;
}

.duplicate-box,
.notice {
  display: none;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  border: 1px solid;
  line-height: 1.55;
  font-size: 13px;
}

.duplicate-box.show,
.notice.show { display: block; }

.duplicate-box {
  color: #70420d;
  background: var(--gold-soft);
  border-color: #e7bd70;
}

.notice {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: rgba(20,124,114,.24);
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 14px;
}

.auth-modal {
  width: min(460px, 100%);
}

.auth-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.auth-switch button {
  min-height: 34px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.auth-switch button.active {
  color: #fff;
  background: var(--brand);
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.captcha-question {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-weight: 900;
  white-space: nowrap;
}

.text-btn {
  color: var(--brand-dark);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.comment-modal {
  width: min(760px, 100%);
}

.comment-form {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.comment-item p {
  margin: 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

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

.donate-modal {
  width: min(760px, 100%);
}

.donate-image-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: center;
  gap: 12px;
  min-height: 260px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.donate-image-wrap img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  max-width: 420px;
  line-height: 1.55;
}

.empty-state.compact {
  min-height: 92px;
  padding: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  max-width: min(520px, calc(100vw - 28px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #fff;
  background: rgba(36,35,33,.92);
  box-shadow: 0 18px 38px rgba(0,0,0,.22);
  transition: opacity .18s ease, transform .18s ease;
  line-height: 1.45;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hidden-view { display: none !important; }

@media (max-width: 1080px) {
  .layout,
  .admin-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1400px);
    padding-top: 12px;
  }
  .topbar,
  .board-toolbar {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
  .main-board {
    overflow: visible;
    max-height: calc(100vh - 172px);
  }
  .board-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: block;
    padding: 8px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: rgba(255,250,242,.96);
    backdrop-filter: blur(10px);
  }
  .board-toolbar > .toolbar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .filter-panel {
    left: 8px;
    right: 8px;
    top: calc(100% - 2px);
    width: auto;
    padding: 10px;
  }
  .filter-group.compact {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }
  .filter-group.compact .filter-label {
    margin-right: 2px;
  }
  .topbar {
    gap: 10px;
    margin-bottom: 12px;
  }
  .brand {
    align-items: flex-start;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .brand h1 {
    font-size: 20px;
  }
  .brand p {
    font-size: 12px;
    line-height: 1.35;
  }
  .top-actions,
  .toolbar-row,
  .admin-actions { justify-content: stretch; }
  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .donate-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .donate-btn {
    min-height: 34px;
    padding: 7px 8px;
    font-size: 13px;
  }
  .auth-status {
    justify-content: center;
    width: auto;
    min-height: 36px;
  }
  #openAuth,
  #logoutBtn {
    min-height: 36px;
    padding: 7px 10px;
  }
  #openCreate {
    grid-column: 1 / -1;
  }
  .btn,
  .vote-btn { width: 100%; }
  .segmented {
    width: 100%;
    overflow-x: auto;
  }
  .segmented button { flex: 1 0 auto; }
  .wish-card { grid-template-columns: 1fr; }
  .wish-list {
    min-height: 320px;
    max-height: calc(100vh - 238px);
  }
  .vote-box {
    grid-template-columns: auto minmax(110px,1fr);
    justify-items: stretch;
    min-width: 0;
  }
  .reaction-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    display: grid;
    justify-content: stretch;
    min-width: 0;
  }
  .side-stack,
  .stat-grid { grid-template-columns: 1fr; }
  .merge-row { grid-template-columns: 1fr; }
}


.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.admin-main {
  min-width: 0;
  padding: 24px 24px 48px;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 16px;
  color: #fff;
  background: #1f3633;
  border-right: 1px solid rgba(255,255,255,.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}

.sidebar-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.sidebar-title span {
  color: rgba(255,255,255,.64);
  font-size: 12px;
}

.admin-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.admin-nav button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.78);
  background: transparent;
  text-align: left;
}

.admin-nav button.active,
.admin-nav button:hover {
  color: #fff;
  background: rgba(255,255,255,.12);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: #1f3633;
  background: var(--brand-soft);
  font-size: 13px;
  font-weight: 900;
}

.nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.nav-count {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #1f3633;
  background: #fffaf2;
  text-align: center;
  font-size: 12px;
}

.sidebar-collapse {
  min-height: 38px;
  border-radius: var(--radius);
  color: #fff;
  background: rgba(255,255,255,.12);
}

.admin-sidebar.collapsed {
  width: 76px;
  padding-inline: 12px;
}

.admin-sidebar.collapsed .sidebar-title,
.admin-sidebar.collapsed .nav-text,
.admin-sidebar.collapsed .nav-count {
  display: none;
}

.admin-sidebar.collapsed .admin-nav button {
  grid-template-columns: 1fr;
  justify-items: center;
}

.admin-tab-panel {
  padding: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0 0 8px;
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    align-items: center;
  }

  .admin-nav {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .admin-sidebar.collapsed {
    width: auto;
  }

  .admin-sidebar.collapsed .sidebar-title,
  .admin-sidebar.collapsed .nav-text,
  .admin-sidebar.collapsed .nav-count {
    display: initial;
  }

  .admin-main {
    padding: 14px 9px 36px;
  }
}


.admin-mobile-tabs {
  display: none;
}

@media (max-width: 760px) {
  .admin-sidebar {
    display: none;
  }

  .admin-mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 8px;
    margin: -2px 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 250, 242, .96);
    box-shadow: 0 12px 28px rgba(58, 43, 24, .12);
    backdrop-filter: blur(10px);
  }

  .admin-mobile-tabs button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
    background: #fffdf8;
    text-align: center;
  }

  .admin-mobile-tabs button.active {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
  }

  .admin-mobile-tabs .nav-icon {
    display: none;
  }

  .admin-mobile-tabs .nav-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
  }

  .admin-mobile-tabs .nav-count {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: 12px;
    text-align: center;
  }

  .admin-mobile-tabs button.active .nav-count {
    color: var(--brand-dark);
    background: #fff;
  }

  .admin-main {
    padding: 10px 9px 36px;
  }

  .admin-main .topbar {
    margin-bottom: 10px;
  }

  .admin-tab-panel {
    padding: 12px;
  }

  .admin-filterbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .admin-mobile-tabs {
    gap: 6px;
    padding: 6px;
  }

  .admin-mobile-tabs button {
    min-height: 38px;
    padding-inline: 8px;
  }
}

.traffic-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.section-head.compact {
  align-items: flex-start;
  margin-bottom: 10px;
}

.section-head.compact h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.traffic-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 210px;
  padding: 8px 0 0;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to top, rgba(222,210,193,.7) 1px, transparent 1px) 0 34px / 100% 48px;
}

.traffic-column {
  display: grid;
  grid-template-rows: 22px 150px 24px;
  align-items: end;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.traffic-value {
  color: var(--ink);
  font-weight: 800;
  line-height: 1;
}

.traffic-column-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 150px;
  min-width: 0;
  border-radius: 7px 7px 0 0;
}

.traffic-column-bar {
  display: block;
  width: min(34px, 72%);
  min-height: 0;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #1f9b8d, var(--brand-dark));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

.traffic-day {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 0;
}

.user-row-head {
  display: grid;
  grid-template-columns: minmax(130px, 220px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.user-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.user-identity span,
.user-time-line {
  color: var(--muted);
  font-size: 12px;
}

.user-time-line {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.user-card {
  padding: 10px 12px;
}

.user-stat-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(246,242,234,.66);
  color: var(--ink);
  text-align: left;
}

.user-stat-button:hover,
.user-stat-button:focus-visible {
  border-color: rgba(20,124,114,.42);
  background: var(--brand-soft);
  outline: none;
}

.user-stat-button span {
  color: var(--muted);
  font-size: 12px;
}

.user-stat-button strong {
  color: var(--brand-dark);
  font-size: 19px;
  line-height: 1;
}

.user-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

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

.detail-section {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,250,242,.74);
}

.detail-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(222,210,193,.64);
}

.detail-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-item strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.detail-item span,
.empty-text {
  color: var(--muted);
  font-size: 12px;
}

.detail-item p {
  margin: 0;
  color: #3e3a35;
  font-size: 13px;
  line-height: 1.5;
}

.admin-detail-modal {
  width: min(860px, 100%);
}

.admin-detail-modal .modal-body {
  padding: 12px;
}

.scrollable-detail-list {
  max-height: min(620px, calc(100vh - 168px));
  overflow: auto;
  padding-right: 4px;
}

.scrollable-detail-list .detail-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.log-card h3 {
  font-size: 15px;
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}

.log-agent {
  color: var(--muted) !important;
  font-size: 12px;
}

.site-footer {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 28px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.site-footer p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.site-footer img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

@media (max-width: 760px) {
  .traffic-chart {
    gap: 6px;
    min-height: 178px;
  }

  .traffic-column {
    grid-template-rows: 20px 118px 22px;
  }

  .traffic-column-track {
    height: 118px;
  }

  .traffic-column-bar {
    width: min(26px, 74%);
  }

  .user-summary-grid,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-row-head {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .user-time-line {
    justify-content: flex-start;
    gap: 6px 10px;
  }
}

@media (max-width: 420px) {
  .user-summary-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}
