/* palette matched to assets/logo.png: crimson #e70d20 on black */
:root {
  --bg: #0a0a0c;
  --panel: #121214;
  --panel-2: #18181b;
  --border: #2a2a2f;
  --border-soft: #1f1f24;
  --fg: #ececee;
  --dim: #9a9aa2;
  --accent: #e70d20;
  --accent-deep: #9c0a18;
  --accent-2: #ff5a47;
  --link: #ff6473;
  --warn-bg: #2c2410;
  --warn-border: #9e6a03;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  line-height: 1.55;
  background-image:
    radial-gradient(1100px 520px at 12% -10%, rgba(231, 13, 32, 0.11), transparent 60%),
    radial-gradient(900px 480px at 92% -6%, rgba(255, 90, 71, 0.06), transparent 60%);
  background-repeat: no-repeat;
}

main { max-width: 1240px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

/* ── two-column layout (desktop); single column stacks on small screens ── */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 0 1rem;
  align-items: start;
}
@media (max-width: 980px) {
  /* panels become direct flex items so `order` can interleave the columns:
     mining → epoch → solution → wallet → log → faq */
  .layout { display: flex; flex-direction: column; }
  .col { display: contents; }
  #mining { order: 1; }
  #epoch { order: 2; }
  #solution { order: 3; }
  #wallet { order: 4; }
  .panel-log { order: 5; }
  #faq { order: 6; }
}

/* ── header ─────────────────────────────────────────────────────────────── */

header { text-align: center; margin-bottom: 1.1rem; }
.logos {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.9rem;
}
.logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  filter: drop-shadow(0 4px 18px rgba(231, 13, 32, 0.45));
}
.logo-epc {
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 6px;
  filter: drop-shadow(0 4px 18px rgba(185, 138, 63, 0.45));
}
h1 .x { color: var(--dim); font-weight: 400; }
.tagline {
  color: var(--dim);
  max-width: 640px;
  margin: 0.4rem auto 0;
  font-size: 0.95rem;
}
.tagline b { color: var(--fg); }
h1 {
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  margin: 0.35rem 0 0;
  font-weight: 750;
  letter-spacing: -0.02em;
}
h1 .grad {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: 1.1rem; margin-top: 0; }
.sub { color: var(--dim); margin: 0.35rem 0 0; }
.sub.links { font-size: 0.9rem; }
.sub .sep { margin: 0 0.5rem; color: var(--border); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; word-break: break-all; }

/* ── panels & banners ───────────────────────────────────────────────────── */

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel) 55%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-top: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.panel.found {
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 1px rgba(231, 13, 32, 0.25), 0 12px 40px rgba(231, 13, 32, 0.10);
}

.banner {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  border: 1px solid var(--border);
  background: var(--panel);
}
.banner.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.banner.error { background: #2d1215; border-color: #f85149; }

.hidden { display: none; }
.dim { color: var(--dim); }
.small { font-size: 0.85rem; }
.note { margin-bottom: 0; }

footer { text-align: center; margin-top: 1.5rem; padding: 0 1rem; }

/* ── rows, stats, hero ──────────────────────────────────────────────────── */

.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.4rem 0; }
.row.toolbar { justify-content: space-between; margin: 0 0 0.9rem; }

.chip {
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: 999px;
  padding: 0.25rem 0.85rem;
  font-size: 0.8rem;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0.7rem; margin: 0.9rem 0; }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; } }
.hero-stat {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.85rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.hero-stat .value {
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.hero-stat .value.accent {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
  margin: 0.8rem 0;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  display: flex;
  flex-direction: column;
}
.stat span:last-child { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.label {
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kv { margin: 0.6rem 0; }
.kv .label { display: block; margin-bottom: 0.25rem; }
.kv code {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.85rem;
}
.kv code.big { font-size: 1rem; border-color: var(--accent-deep); }
.kv button { margin-top: 0.4rem; }

/* ── collapsible sub-sections ───────────────────────────────────────────── */

details.sub {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  padding: 0.55rem 0.9rem;
  margin-top: 0.7rem;
}
details.sub summary {
  cursor: pointer;
  user-select: none;
  color: var(--dim);
  font-size: 0.88rem;
  font-weight: 600;
  list-style: none;
}
details.sub summary::-webkit-details-marker { display: none; }
details.sub summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--accent);
  transition: transform 0.15s ease;
}
details.sub[open] > summary::before { transform: rotate(90deg); }
details.sub summary:hover { color: var(--fg); }
details.sub[open] { padding-bottom: 0.8rem; }
details.sub[open] > summary { margin-bottom: 0.35rem; }

/* ── buttons & inputs ───────────────────────────────────────────────────── */

button {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.95rem;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, filter 0.12s ease;
}
button:hover:not(:disabled) { border-color: var(--dim); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary {
  background: linear-gradient(180deg, #e70d20, #9c0a18);
  border-color: rgba(231, 13, 32, 0.6);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(231, 13, 32, 0.3);
}
button.primary:hover:not(:disabled) { filter: brightness(1.1); }
button.big { padding: 0.6rem 1.35rem; font-size: 1rem; border-radius: 10px; }

label.tune {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--dim);
}
label.tune input[type="number"], label.tune select {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
label.tune input[type="number"] { width: 6.5rem; }
label.tune input:disabled, label.tune select:disabled { opacity: 0.55; }
input[type="checkbox"] { accent-color: var(--accent-deep); }

/* ── EPOCH rewards ──────────────────────────────────────────────────────── */
/* EPOCH brand palette (from the EPOCH repo's brand kit / icon bars):
   warm bronze #b98a3f · verdigris #5f8a7d · marker #e23b2e · bone #dfe4e2 */

:root {
  --epc: #b98a3f;
  --epc-2: #e23b2e;
  --epc-verdigris: #5f8a7d;
  --epc-bone: #dfe4e2;
}

.epc-icon {
  width: 20px;
  height: 20px;
  vertical-align: -3px;
  margin-right: 0.35rem;
}

.panel.about { padding: 0.9rem 1.25rem; }
.panel.about p { margin: 0.35rem 0; color: var(--dim); }
.panel.about b { color: var(--fg); }
.epc-name {
  background: linear-gradient(90deg, var(--epc) 0%, var(--epc-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

.addr-row { margin-bottom: 0.9rem; }
.addr-row .row { margin: 0.35rem 0 0; }

/* address callout: red "shares are wasted" warning without an address,
   gold "accumulating to 0x…" confirmation with one */
.nudge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  margin: 0 0 0.9rem;
  font-size: 0.9rem;
}
/* .nudge's display:flex would beat the earlier .hidden rule (equal specificity) */
.nudge.hidden { display: none; }
.nudge.waste {
  border: 1px solid rgba(248, 81, 73, 0.6);
  background: #2d1215;
}
.nudge.waste #nudge-lost { color: #ff8f88; font-weight: 600; }
.nudge.waste button { border-color: rgba(248, 81, 73, 0.6); white-space: nowrap; }
.nudge.waste button:hover:not(:disabled) { border-color: #f85149; }
.nudge.bound {
  border: 1px solid rgba(185, 138, 63, 0.5);
  background: rgba(185, 138, 63, 0.07);
}
.nudge.bound code { font-size: 0.82rem; color: var(--epc); }
#payout-address {
  flex: 1;
  min-width: 260px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
#payout-address.bad { border-color: #f85149; }
#payout-address:disabled { opacity: 0.6; }

.panel.epc { border-color: rgba(185, 138, 63, 0.45); }
#epc-counter-box { position: relative; overflow: visible; }
.value.epc-value {
  background: linear-gradient(90deg, var(--epc) 0%, var(--epc-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.row.spread { justify-content: space-between; }
.pool { margin: 0.6rem 0 0.8rem; }
.pool-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  margin-top: 0.35rem;
}
#epc-pool-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--epc), var(--epc-2));
  transition: width 0.6s ease;
}

/* "next share" progress — statistical estimate, resets on every share */
#share-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--epc), var(--epc-2));
  transition: width 0.5s ease;
}
#share-progress-fill.overdue {
  background: linear-gradient(90deg, var(--epc), var(--epc-2), var(--epc));
  background-size: 200% 100%;
  animation: share-shimmer 1.6s linear infinite;
}
@keyframes share-shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: -200% 0; }
}

.epoch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  padding: 0.5rem 0.8rem;
  margin-top: 0.5rem;
  font-size: 0.88rem;
}
.epoch-row code { font-size: 0.8rem; color: var(--dim); }
.epoch-row .chip { padding: 0.1rem 0.6rem; font-size: 0.72rem; }
.chip.live { border-color: var(--accent-deep); color: var(--accent); }
.chip.dead { border-color: var(--border); color: var(--dim); text-decoration: line-through; }
.chip.gold { border-color: var(--epc); color: var(--epc); }

/* endorphins: counter pop, floating +EPC chip, particle burst */
.pop { animation: pop 0.4s cubic-bezier(0.2, 2.2, 0.4, 1); }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.epc-float {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--epc);
  text-shadow: 0 2px 12px rgba(185, 138, 63, 0.6);
  animation: epc-float 1.1s ease-out forwards;
}
@keyframes epc-float {
  0% { opacity: 0; transform: translateY(6px) scale(0.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-46px) scale(1); }
}
.epc-float.big { font-size: 1.6rem; animation-duration: 1.6s; }

/* wasted shares: gray, sinks instead of rising */
.epc-float.waste {
  color: var(--dim);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  animation: epc-waste 1.3s ease-in forwards;
}
@keyframes epc-waste {
  0% { opacity: 0; transform: translateY(-4px) scale(1.05); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(44px) scale(0.85); }
}

.epc-particle {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--p-color, var(--epc));
  animation: epc-particle 0.8s cubic-bezier(0.1, 0.8, 0.4, 1) forwards;
}
@keyframes epc-particle {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

@keyframes epc-glow {
  0% { box-shadow: 0 0 0 0 rgba(185, 138, 63, 0.55); }
  100% { box-shadow: 0 0 26px 8px rgba(185, 138, 63, 0); }
}
.glow { animation: epc-glow 0.7s ease-out; }

/* ── log ────────────────────────────────────────────────────────────────── */

#log {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  max-height: 240px;
  min-height: 3rem;
  overflow-y: auto;
  font-size: 0.8rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  margin: 0.4rem 0 0;
}
