:root {
  --bg: #12110e;
  --bg-2: #1c1a16;
  --line: #343026;
  --text: #f4efe6;
  --muted: #a79d8d;
  --amber: #e6a23c;
  --amber-ink: #2a1c08;
  --danger: #ff8d7d;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(230, 162, 60, 0.16), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.45 "Segoe UI", sans-serif;
}

body { padding: 28px 22px 64px; }

a { color: var(--amber); }

button, input { font: inherit; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.top {
  max-width: 1080px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.banner {
  max-width: 1080px;
  margin: 0 auto 22px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(230, 162, 60, 0.08);
}

.banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.banner-photo,
.banner-preview {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 12px;
  background: #100f0c;
}

.banner-preview { max-width: 420px; max-height: 180px; margin: 4px 0 12px; }

.banner-kicker {
  margin: 0;
  color: var(--amber);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.banner-copy { flex: 1; min-width: 0; }

.banner-copy strong, .banner-copy span { display: block; }

.banner-copy span { color: var(--muted); }

.field {
  display: block;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
}

.field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: #100f0c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
}

.tabs {
  max-width: 1080px;
  margin: 0 auto 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs button[aria-pressed="true"] {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: transparent;
}

.thread, .user-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-top: 12px;
  background: #100f0c;
}

.thread p, .user-card p { margin: 0 0 8px; }

.user-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.user-actions input {
  width: min(100%, 280px);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}

.user-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.user-photos img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: #000;
  cursor: zoom-in;
}

.month { margin-top: 12px; }

.key-panel .month > .text-btn {
  display: block;
  width: 100%;
  text-align: left;
  white-space: normal;
}

.chart-switch { display: flex; gap: 8px; margin-bottom: 12px; }

.key-panel .chart-switch button[aria-pressed="true"] {
  background: var(--amber);
  color: var(--amber-ink);
}

.chart svg { width: 100%; height: auto; display: block; }

.chart .grid { stroke: #343026; stroke-width: 1; }

.chart .axis { fill: #b7aa96; font-size: 11px; font-family: inherit; }

.chart .bar-fresh { fill: #e6a23c; }

.chart .bar-back { fill: #6e624f; }

.chart .trend { fill: none; stroke: #f4efe6; stroke-width: 2; }

.chart .hit { fill: transparent; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 10px 0 0;
  color: #b7aa96;
  font-size: 13px;
}

.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.swatch { width: 12px; height: 12px; border-radius: 3px; background: #e6a23c; }

.swatch.back { background: #6e624f; }

.swatch.line { height: 2px; background: #f4efe6; }

.month .admin-table { margin-top: 10px; }

.mail {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  text-align: left;
  background: #100f0c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.mail strong {
  color: var(--amber);
  width: 12px;
}

.key-panel.in-chat > .hint { display: none; }

.chat-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 2px 0 10px;
  background: var(--bg-2);
}

.chat-bar .hint { margin: 0; }

.key-panel button.back-chat {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
}

.chat { display: grid; gap: 8px; margin: 14px 0; }

.bubble {
  margin: 0;
  max-width: min(520px, 100%);
  padding: 10px 12px;
  border-radius: 14px;
  background: #1a1814;
  border: 1px solid var(--line);
}

.bubble.admin {
  justify-self: end;
  background: rgba(230, 162, 60, 0.16);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.86);
}

.lightbox img {
  max-width: min(1100px, 94vw);
  max-height: 82vh;
  border-radius: 12px;
}

.lightbox button {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
}

.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.lang { display: flex; gap: 4px; }

.lang .text-btn { padding: 8px 10px; }

.lang .text-btn[aria-pressed="true"] {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: transparent;
}

.foot { max-width: 1080px; margin: 42px auto 0; }

.foot a { color: var(--muted); font-size: 13px; text-decoration: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 8px 0 22px;
}

.stat {
  background: #100f0c;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.stat span { display: block; color: var(--muted); font-size: 13px; }

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
}

.admin-table { width: 100%; border-collapse: collapse; }

.admin-table th, .admin-table td {
  text-align: left;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.admin-table th { color: var(--muted); font-weight: 600; }

.packs { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }

.packs li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.packs s {
  color: var(--muted);
  font-weight: 500;
  margin-right: 6px;
}

.pay-link {
  display: inline-block;
  background: var(--amber);
  color: var(--amber-ink);
  text-decoration: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
}

.brand { display: flex; align-items: center; gap: 14px; }

.mark {
  width: 42px;
  height: 42px;
  border: 2px solid var(--amber);
  border-radius: 50%;
  box-shadow: inset 0 0 0 7px #12110e, inset 0 0 0 9px var(--amber);
}

.name {
  margin: 0;
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 28px;
  letter-spacing: 0.04em;
}

.tag { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

main { max-width: 1080px; margin: 0 auto; }

.text-btn, .key-panel button, .actions button {
  border: 0;
  cursor: pointer;
}

.text-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
  display: inline-block;
}

.text-btn:hover, .key-panel button:hover, #search:hover:not(:disabled) {
  border-color: var(--amber);
}

.key-panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.key-panel h2 { margin: 0 0 8px; font-size: 18px; }

.key-panel p { margin: 0 0 14px; color: var(--muted); }

#key-form, #gate-form { display: flex; gap: 8px; }

.note-form { display: block; }

.key-panel textarea,
#support-text,
#ads-text {
  display: block;
  width: 100%;
  min-height: 140px;
  margin: 0 0 12px;
  background: #100f0c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  resize: vertical;
}

#key-input, #pin {
  flex: 1;
  min-width: 0;
  background: #100f0c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.key-panel button, #search {
  background: var(--amber);
  color: var(--amber-ink);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
}

.key-panel button.text-btn {
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.key-panel button.mail {
  display: flex;
  width: 100%;
  background: #100f0c;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}

.hint { min-height: 0; }
.hint:empty { display: none; }

.form-error, .status.error { color: var(--danger); }

.stage { display: grid; justify-items: center; gap: 16px; }

.lens {
  width: min(420px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed #6d624e;
  background:
    radial-gradient(circle at 50% 45%, rgba(230, 162, 60, 0.12), transparent 42%),
    #17160f;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow), inset 0 0 0 18px rgba(18, 17, 14, 0.55);
}

.lens.hot { border-color: var(--amber); }

.lens input { display: none; }

#preview {
  position: absolute;
  inset: 18px;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  object-fit: cover;
  border-radius: 50%;
}

.lens-copy {
  position: relative;
  text-align: center;
  display: grid;
  gap: 6px;
  padding: 24px;
}

.lens-copy strong { font-size: 22px; }
.lens-copy span { color: var(--muted); }

.lens.has-photo .lens-copy { display: none; }

.actions { display: flex; align-items: center; gap: 12px; }

#search:disabled {
  opacity: 0.45;
  cursor: default;
}

.status { min-height: 1.4em; margin: 0; color: var(--muted); text-align: center; }

.block { margin-top: 36px; }

.block h2 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 650;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  min-height: 100%;
}

a.card:hover { border-color: var(--amber); }

.card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #0d0c0a;
}

.card-face > div { padding: 0 12px 12px; display: grid; gap: 4px; }

.card.locked { position: relative; }

.card.locked .card-face {
  filter: blur(8px);
  transform: scale(1.05);
  pointer-events: none;
  user-select: none;
}

.veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(18, 17, 14, 0.28);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.guess.locked { position: relative; }

.guess.locked .guess-body {
  filter: blur(7px);
  user-select: none;
  pointer-events: none;
}

.limited-note {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
}

.card strong {
  font-size: 15px;
  line-height: 1.3;
}

.card span, .card em {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.empty {
  color: var(--muted);
  text-align: center;
  margin-top: 28px;
}

.words { width: min(420px, 100%); }

.words input {
  width: 100%;
  background: #100f0c;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

.filters button[aria-pressed="true"] {
  background: var(--amber);
  color: var(--amber-ink);
  border-color: transparent;
}

.guess {
  margin-top: 8px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(230, 162, 60, 0.16), var(--bg-2));
}

.guess .kicker {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--amber);
}

.guess a, .guess div.guess-body {
  color: inherit;
  text-decoration: none;
  display: grid;
  gap: 4px;
}

.guess strong { font-size: 22px; font-family: Palatino, "Palatino Linotype", Georgia, serif; }

.guess span { color: var(--muted); }

.history { margin-top: 42px; }

.history h2 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.history-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.history-row button {
  width: 92px;
  flex: 0 0 auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.history-row button:hover { border-color: var(--amber); }

.history-row img {
  width: 92px;
  height: 68px;
  object-fit: cover;
  display: block;
  background: #0d0c0a;
}

.history-row span {
  display: block;
  padding: 6px 8px 8px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  body { padding: 18px 14px 48px; }
  .name { font-size: 24px; }
  #key-form, #gate-form { flex-direction: column; }
  .banner-row { flex-direction: column; align-items: flex-start; }
  .lens { width: min(320px, 100%); }
}
