/* ============================================================
   Fortnite Chest Counter — "treasure ledger" theme
   Dark ink-blue base + loot gold. No images anywhere: all art is CSS.
   Homepage: cover → tap → counter loads in place (engine player),
   all content sections rendered directly on the page for crawlers.
   ============================================================ */

:root {
  --bg: #0a1120;
  --bg-soft: #0e1730;
  --surface: #121e38;
  --surface-2: #182647;
  --line: #24365e;
  --line-soft: #1b2a4c;
  --text: #eaf0fb;
  --muted: #93a3c4;
  --gold: #f5b73d;
  --gold-hi: #ffdf8e;
  --gold-deep: #c8871a;
  --on-gold: #241a03;
  --blue: #63a9ff;
  --purple: #b98aff;
  --danger: #ff7a70;
  --radius: 16px;
  --radius-lg: 20px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 50% -8%, rgba(245, 183, 61, 0.12), transparent 62%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 340px);
  background-color: var(--bg);
}

.wrap { max-width: 1020px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 760px; }

h1, h2, h3 { line-height: 1.25; color: var(--text); }

a { color: var(--gold-hi); text-underline-offset: 3px; }
a:hover { color: var(--gold); }

:focus-visible {
  outline: 3px solid rgba(245, 183, 61, 0.65);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: rgba(245, 183, 61, 0.35); }

/* ---------- Header ---------- */

.site-head {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 17, 32, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-glyph { position: relative; width: 26px; height: 20px; flex: none; }
.brand-glyph .bg-lid,
.brand-glyph .bg-base {
  position: absolute;
  left: 0;
  width: 100%;
  border: 1.5px solid var(--gold);
}
.brand-glyph .bg-lid {
  top: 0;
  height: 10px;
  border-radius: 7px 7px 2px 2px;
  background: linear-gradient(180deg, #2e4478, #1d2d55);
}
.brand-glyph .bg-base {
  bottom: 0;
  height: 9px;
  border-radius: 2px 2px 4px 4px;
  background: linear-gradient(180deg, #1d2d55, #16233f);
}
.brand-glyph .bg-lock {
  position: absolute;
  left: 50%;
  top: 7px;
  transform: translateX(-50%);
  width: 5px;
  height: 7px;
  border-radius: 1.5px;
  background: var(--gold);
  z-index: 1;
}

.site-nav { display: flex; gap: 20px; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.site-nav a:hover { color: var(--gold-hi); }

/* ---------- Hero ---------- */

.hero { padding: 36px 0 24px; text-align: center; }

.hero-title {
  margin: 0 0 10px;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub { margin: 0 auto; max-width: 34em; color: var(--muted); font-size: 1.05rem; }

/* ---------- Stage (engine player: cover → tap → counter) ---------- */

.stage-sec { padding-bottom: 8px; }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(420px 260px at 50% 30%, rgba(245, 183, 61, 0.08), transparent 70%),
    var(--surface);
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

@media (min-width: 720px) {
  .stage { aspect-ratio: 16 / 10; }
}

.stage[data-gf-state="loading"] .loader { display: flex; }

.cover,
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}

.cover { z-index: 2; }
.loader { display: none; z-index: 3; }

.cover-line { margin: 4px 0 0; color: var(--muted); max-width: 26em; }
.cover-note { margin: 0; color: var(--muted); font-size: 0.85rem; opacity: 0.85; }

/* CSS-only treasure chest on the cover */
.chest { position: relative; width: 170px; height: 118px; }
.chest-glow {
  position: absolute;
  inset: -40px;
  background: radial-gradient(closest-side, rgba(245, 183, 61, 0.22), transparent 72%);
}
.chest-lid,
.chest-base {
  position: absolute;
  left: 0;
  width: 100%;
  border: 3px solid var(--gold);
}
.chest-lid {
  top: 0;
  height: 52px;
  border-radius: 26px 26px 6px 6px;
  background: linear-gradient(180deg, #31497e, #1e2f5a);
}
.chest-base {
  bottom: 0;
  height: 46px;
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(180deg, #22346a, #182748);
}
.chest .band {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  transform: translateX(-50%);
  width: 14px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-deep));
}
.chest .lock {
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  width: 18px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 1;
}
.chest .lock::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  transform: translateX(-50%);
  width: 4px;
  height: 7px;
  border-radius: 2px;
  background: var(--on-gold);
}

/* Loader: coins dropping into the chest */
.loader-coins { position: relative; width: 120px; height: 70px; }
.loader-coins i {
  position: absolute;
  bottom: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-hi), var(--gold-deep));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  animation: coin-drop 1.1s ease-in infinite;
}
.loader-coins i:nth-child(1) { left: 8px; animation-delay: 0s; }
.loader-coins i:nth-child(2) { left: 50px; animation-delay: 0.35s; }
.loader-coins i:nth-child(3) { left: 92px; animation-delay: 0.7s; }

@keyframes coin-drop {
  0%   { transform: translateY(-34px) scale(0.9); opacity: 0; }
  30%  { opacity: 1; }
  70%  { transform: translateY(2px) scale(1); opacity: 1; }
  100% { transform: translateY(16px) scale(0.95); opacity: 0; }
}

.loader-text { margin: 0; color: var(--muted); }

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { border-color: var(--gold-deep); }
.btn:active { transform: translateY(2px); }

.btn-gold {
  border-color: transparent;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-deep));
  color: var(--on-gold);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(245, 183, 61, 0.25);
}
.btn-gold:hover { filter: brightness(1.05); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }

.btn-play { font-size: 1.2rem; padding: 14px 34px; border-radius: 14px; }

[data-gf-like][aria-pressed="true"] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(245, 183, 61, 0.12);
}

/* ---------- Stage action row ---------- */

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.mini-msg { color: var(--muted); font-size: 0.85rem; }
.mini-msg:empty { display: none; }

/* ---------- Ad slot ---------- */

.ad-slot {
  margin-top: 44px; /* keeps >=32px of air between the player and this slot */
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- Content sections ---------- */

.sec { padding: 44px 0 6px; }
.sec h2 {
  font-size: clamp(1.4rem, 3.4vw, 1.8rem);
  margin: 0 0 14px;
  padding-left: 14px;
  border-left: 4px solid var(--gold);
}

.sec p { color: var(--muted); }
.sec p strong, .sec li strong { color: var(--text); }
.gold { color: var(--gold); }

.steps { margin: 16px 0 0; padding-left: 22px; color: var(--muted); }
.steps li { margin-bottom: 12px; }
.sec ul.steps strong { color: var(--text); }

.fineprint,
.countdown-note {
  margin-top: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--gold-deep);
  border-radius: 10px;
  background: rgba(245, 183, 61, 0.05);
  color: var(--text) !important;
  font-size: 0.95rem;
}
.countdown-note { margin-top: 0; }

.panel {
  margin-top: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- Odds tools ---------- */

.field-row {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .field-row { grid-template-columns: 1fr 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 0.95rem; }

input[type="number"], input[type="text"], input[type="date"], textarea, input[name="name"], select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
select { cursor: pointer; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; }
input:disabled { opacity: 0.7; }
input[type="checkbox"] { accent-color: var(--gold); width: auto; }

.check-line { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.check-line label { cursor: pointer; }

.field-note { color: var(--muted); font-size: 0.88rem; margin: 10px 0 0; }

.odds-result { margin-top: 16px; }
.odds-p { margin: 0; color: var(--text); font-size: 1.1rem; }
.odds-p strong {
  font-size: 1.5em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.odds-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }
.odds-sub:empty { display: none; }
.odds-sub:last-child { color: var(--danger); }

.odds-table { margin-top: 18px; width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.odds-table caption { text-align: left; color: var(--muted); font-size: 0.88rem; padding-bottom: 8px; }
.odds-table th, .odds-table td { border: 1px solid var(--line-soft); padding: 8px 12px; text-align: left; }
.odds-table thead th { color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.odds-table td { color: var(--gold-hi); font-weight: 700; }

.pace-box {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(10, 17, 32, 0.4);
}
.pace-title { margin: 0; color: var(--text); font-weight: 600; font-size: 0.95rem; }
.pace-fields { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 10px; }
@media (min-width: 480px) {
  .pace-fields { grid-template-columns: 1fr 1fr; }
}
.pace-out { margin: 12px 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Session log ---------- */

.log-counts { display: grid; gap: 14px; grid-template-columns: 1fr; margin-top: 14px; }
@media (min-width: 560px) {
  .log-counts { grid-template-columns: repeat(3, 1fr); }
}

.pill { border-left: 4px solid var(--line); padding-left: 10px; border-radius: 4px; }
.pill-common { border-left-color: var(--gold); }
.pill-rare   { border-left-color: var(--blue); }
.pill-event  { border-left-color: var(--purple); }

.log-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.form-msg { min-height: 1.2em; margin: 10px 0 0; color: var(--gold-hi); font-size: 0.92rem; }
.form-msg.is-error { color: var(--danger); }

.log-list { list-style: none; margin: 18px 0 0; padding: 0; }
.log-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  padding: 12px 4px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.95rem;
}
.log-date { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.log-counts-line { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-counts-line b { color: var(--text); font-weight: 600; }
.log-note-line { color: var(--muted); font-style: italic; }

.log-empty { color: var(--muted); font-size: 0.95rem; margin-top: 14px; }
.log-empty:empty, .log-list:not(:empty) + .log-empty { display: none; }

/* ---------- FAQ / myths / sources ---------- */

#faq h3, #myths h3 { font-size: 1.12rem; margin: 26px 0 6px; color: var(--gold-hi); }
#faq p, #myths p { margin: 0; }

/* ---------- Comments ---------- */

.comments { margin-top: 18px; }
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.comment-form .btn { align-self: flex-start; }

.replying-note { display: none; margin: 0; color: var(--gold-hi); font-size: 0.9rem; }
.comment-form[data-gf-replying] .replying-note { display: flex; align-items: center; gap: 10px; }

.linkish {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: var(--gold-hi);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comment-list { margin-top: 18px; }
.comment {
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
  margin-bottom: 10px;
}
.comment.is-reply { margin-left: 28px; }
.c-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.c-name { font-weight: 700; color: var(--text); }
.c-time { color: var(--muted); font-size: 0.82rem; }
.c-to { color: var(--muted); font-size: 0.85rem; }
.c-to:empty, .c-owner-tag:empty { display: none; }
.c-owner-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.c-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.c-tools { margin-top: 6px; }
.c-replies { margin-top: 10px; }

.c-invite { display: none; color: var(--muted); font-size: 0.95rem; }
[data-gf-empty] .c-invite { display: block; }
[data-gf-off] { display: none; }

/* ---------- Footer ---------- */

.site-foot {
  margin-top: 60px;
  border-top: 1px solid var(--line-soft);
  padding: 28px 0 40px;
  text-align: center;
}
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin-bottom: 14px; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.foot-links a:hover { color: var(--gold-hi); }
.foot-legal { color: var(--muted); font-size: 0.85rem; max-width: 42em; margin: 0 auto 6px; }
.foot-copy { color: var(--muted); font-size: 0.85rem; margin: 0; opacity: 0.8; }

/* ---------- Generic prose pages (About / Privacy / Terms / Contact) ---------- */

.crumbs { padding: 18px 0 0; font-size: 0.9rem; }
.crumbs-sep { margin: 0 8px; color: var(--muted); }
.crumbs-here { color: var(--muted); }

.prose { padding: 10px 0 10px; }
.prose h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.4rem);
  margin: 8px 0 18px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prose h2 { font-size: 1.25rem; margin: 28px 0 8px; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }

/* ---------- Embed counter page (inside the iframe) ---------- */

.embed-root {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px 24px;
  background:
    radial-gradient(500px 300px at 50% 0%, rgba(245, 183, 61, 0.1), transparent 65%),
    var(--bg);
}

.ctr { width: 100%; max-width: 440px; text-align: center; }

.ctr-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ctr-num-wrap { margin-bottom: 4px; }

.ctr-num {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font);
  font-size: clamp(4.2rem, 22vw, 7.6rem);
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  background-image: linear-gradient(180deg, var(--gold-hi), var(--gold) 60%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  border-bottom: 2px dashed transparent;
}
.ctr-num:hover { border-bottom-color: rgba(245, 183, 61, 0.5); }

.ctr-edit { font-size: clamp(2.4rem, 13vw, 4.4rem); text-align: center; font-weight: 800; color: var(--gold-hi); }

.ctr-edit-hint { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; min-height: 1.2em; }
.ctr-edit-hint.is-error { color: var(--danger); }
.ctr-edit-hint:empty { display: none; }

.btn-add {
  width: 100%;
  min-height: 76px;
  font-size: 1.35rem;
  border-radius: 16px;
  margin-top: 14px;
  letter-spacing: 0.01em;
}
.btn-add .plus { font-size: 1.15em; }

/* 三类分计芯片：总数 = 三类之和 */
.ctr-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.ctype {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 12px;
  background: rgba(10, 17, 32, 0.4);
  padding: 10px 8px;
}
.ctype-common { border-left-color: var(--gold); }
.ctype-rare   { border-left-color: var(--blue); }
.ctype-event  { border-left-color: var(--purple); }

.ctype-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ctype-num {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  width: 100%;
}
.ctype-num:hover { color: var(--gold-hi); }
.ctype-edit { font-size: 1.05rem; text-align: center; font-weight: 700; color: var(--gold-hi); padding: 4px 6px; }
.ctype-add { width: 100%; padding: 4px 6px; font-size: 0.88rem; border-radius: 8px; }

.ctr-tools { display: flex; gap: 10px; margin-top: 14px; }
.ctr-tools .btn { flex: 1; padding: 10px 6px; font-size: 0.95rem; }

#fcc-reset.is-confirm { color: var(--danger); border-color: var(--danger); background: rgba(255, 122, 112, 0.1); }
#fcc-undo:disabled { opacity: 0.45; cursor: default; }

.ctr-keys { margin: 18px 0 0; color: var(--muted); font-size: 0.85rem; }
.ctr-keys-note { opacity: 0.75; }
kbd {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.82rem;
}

.ctr-note { margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; }
.ctr-note.is-error { color: var(--danger); }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  .loader-coins i { animation: none; opacity: 0.9; }
  .btn, .btn:active { transition: none; transform: none; }
}
