:root {
  --bg0: #0b1110;
  --bg1: #121a18;
  --panel: #17201d;
  --line: #2a3a34;
  --text: #e8f0ec;
  --muted: #8fa399;
  --accent: #c8f560;
  --accent-dim: #8fb82e;
  --warn: #ff8f6b;
  --neg: #ff7b7b;
  --glow: rgba(200, 245, 96, 0.14);
  --radius: 18px;
  --font-display: "Archivo Black", sans-serif;
  --font-body: "Sora", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg0);
  line-height: 1.45;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(200, 245, 96, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(56, 140, 120, 0.22), transparent 50%),
    linear-gradient(180deg, #0e1614 0%, #0b1110 45%, #101816 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  max-width: 920px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: 0.85rem;
  background: linear-gradient(145deg, var(--accent), #6f9a20);
  color: #10160f;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-actions {
  display: flex;
  gap: 0.5rem;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 3rem;
}

.hero {
  padding: 1.5rem 0 1.75rem;
  animation: rise 0.55s ease both;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent-dim);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.partner-line {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.payout {
  margin: 0.85rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #f4ffe0 10%, var(--accent) 45%, #7fd6b0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 0.7s 0.08s ease both;
}

.payout-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  animation: rise 0.65s 0.12s ease both;
}

@media (min-width: 720px) {
  .breakdown {
    grid-template-columns: repeat(5, 1fr);
  }
}

[hidden] {
  display: none !important;
}

.stat {
  padding: 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(8px);
}

.stat.accent {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: inset 0 0 0 1px var(--glow);
}

.stat-label {
  display: block;
  color: #b7c7bf;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f3faf6;
}

.stat-value.neg {
  color: var(--neg);
}

.panel {
  margin-bottom: 1.25rem;
  padding: 1.25rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  animation: rise 0.7s 0.16s ease both;
}

.panel h2 {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.bonus-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.bonus-list li,
.history-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid transparent;
}

.history-list li {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.history-list li:hover,
.history-list li.active {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: rgba(200, 245, 96, 0.06);
}

.bonus-list .amt,
.history-list .amt {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty[hidden],
.bonus-list:not(:empty) + .empty {
  display: none;
}

.editor {
  margin-top: 1.5rem;
  padding: 1.4rem 1.35rem 1.5rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  background:
    linear-gradient(180deg, rgba(200, 245, 96, 0.05), transparent 40%),
    var(--panel);
  animation: rise 0.45s ease both;
}

.editor-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
}

.editor-head p {
  margin: 0.35rem 0 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.form {
  display: grid;
  gap: 0.9rem;
}

.row {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 640px) {
  .row {
    grid-template-columns: 1fr 1fr;
  }
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

input[type="text"],
input[type="number"],
input[type="month"],
input[type="password"] {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1412;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--accent-dim);
}

fieldset.achievements {
  margin: 0.2rem 0 0;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
}

fieldset.achievements legend {
  padding: 0 0.35rem;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

label.inline {
  margin-bottom: 0.65rem;
}

.checks {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
}

.check input {
  margin-top: 0.15rem;
  accent-color: var(--accent);
}

.check.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.check .meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--accent-dim);
  font-size: 0.85rem;
  font-weight: 600;
}

.form-actions,
.settings,
.pin-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.4rem;
}

.settings {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.pin-box {
  flex-direction: column;
  align-items: stretch;
  max-width: 320px;
  margin: 0.5rem 0 0;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #15201c;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #9bcf3a);
  color: #12180f;
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: color-mix(in srgb, var(--neg) 45%, var(--line));
  color: var(--neg);
}

.foot {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.gate-card {
  width: min(100%, 400px);
  padding: 1.75rem 1.5rem;
  border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  background: #18241f;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 0.75rem;
  text-align: center;
  animation: rise 0.45s ease both;
}

.gate-mark {
  margin: 0 auto 0.25rem;
}

.gate-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 400;
}

.gate-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.gate-defaults {
  margin-top: 0.35rem !important;
  font-size: 0.78rem !important;
}

.role-pill {
  align-self: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-only {
  display: none;
}

body.is-admin .admin-only {
  display: revert;
}

body.is-admin form.add-game.admin-only {
  display: flex;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.panel-head h2 {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -0.2rem;
}

table.games {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

table.games th,
table.games td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.games thead th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}

table.games tfoot th {
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

table.games input[type="text"],
table.games input[type="number"] {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.65rem;
}

table.games .num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--neg);
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
}

.add-game {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
  align-items: center;
}

.add-game input {
  flex: 1 1 180px;
}

.life-views {
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
}

.progress-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.progress-item {
  display: grid;
  gap: 0.35rem;
}

.progress-item header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.progress-item .name {
  font-weight: 650;
}

.progress-item .meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6f9a20, var(--accent));
  width: 0%;
}

.progress-item.done .bar > span {
  background: #3d6b58;
}

.progress-item.done .name {
  color: var(--muted);
}

.progress-item.next .name {
  color: var(--accent);
}
