/* ==========================================================================
   Live Odds PORMASI — design system
   Palet diturunkan dari Logo.png: hijau tua #206040, putih tulang #f0f0f0, hitam.
   Permukaan solid, border tipis. Tanpa backdrop-filter / tanpa glassmorphism.
   ========================================================================== */

:root {
  --bg: #080b09;
  --bg-grid: #0d120e;
  --surface: #101711;
  --surface-2: #151e17;
  --surface-3: #1a251c;

  --border: #223027;
  --border-strong: #2f4436;

  --brand: #1f7a4a;
  --brand-dim: #14512f;
  --brand-deep: #0e3721;
  --accent: #35c477;
  --accent-soft: #7fe0ab;

  --text: #eef3ef;
  --muted: #8ba394;
  --dim: #5d7367;

  --up: #35c477;
  --down: #d4574b;
  --gold: #c9a227;

  --radius: 6px;
  --radius-lg: 10px;

  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px -12px rgba(0, 0, 0, 0.9);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(31, 122, 74, 0.16), transparent 70%),
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 100% 100%, 46px 46px, 46px 46px;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
  text-transform: uppercase;
}

a {
  color: var(--accent);
}

::selection {
  background: var(--brand);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------- shell ---------------------------------- */

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px 72px;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0c120e, #090d0a);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  margin-right: auto;
}

.brand__logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 10px rgba(31, 122, 74, 0.4));
  transition: transform 0.4s var(--ease);
}

.brand:hover .brand__logo {
  transform: scale(1.06) rotate(-3deg);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand__name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand__sub {
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 5px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding: 8px 13px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a[aria-current='page'] {
  color: var(--accent-soft);
  background: var(--brand-deep);
  border-color: var(--border-strong);
}

/* --------------------------------- live dot -------------------------------- */

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.live__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}

.live[data-state='on'] {
  color: var(--accent-soft);
  border-color: var(--border-strong);
}

.live[data-state='on'] .live__dot {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(53, 196, 119, 0.55);
  animation: pulse 2.1s var(--ease) infinite;
}

.live[data-state='off'] {
  color: var(--down);
  border-color: #4a2622;
}

.live[data-state='off'] .live__dot {
  background: var(--down);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(53, 196, 119, 0.5);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(53, 196, 119, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(53, 196, 119, 0);
  }
}

/* ---------------------------------- hero ---------------------------------- */

.hero {
  padding: 42px 0 26px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 26px;
}

.hero__eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero__eyebrow::after {
  content: '';
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

.hero h1 {
  font-size: clamp(38px, 7vw, 68px);
  line-height: 0.94;
  letter-spacing: -0.005em;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  color: var(--muted);
  max-width: 60ch;
  margin: 14px 0 0;
}

/* --------------------------------- stats ---------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 30px;
}

.stat {
  background: var(--surface);
  padding: 15px 18px;
}

.stat__label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

.stat__value {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 600;
  margin-top: 3px;
  line-height: 1.1;
}

.stat__value small {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-body);
  letter-spacing: 0;
  margin-left: 3px;
}

/* --------------------------------- filters -------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.filters {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filters button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.filters button:hover {
  color: var(--text);
}

.filters button[aria-pressed='true'] {
  background: var(--brand);
  color: #fff;
}

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

.search input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 13px;
  transition: border-color 0.18s;
}

.search input::placeholder {
  color: var(--dim);
}

.search input:focus {
  outline: none;
  border-color: var(--brand);
}

/* --------------------------------- section -------------------------------- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 32px 0 13px;
}

.section-head h2 {
  font-size: 21px;
  letter-spacing: 0.1em;
}

.section-head .count {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------------------------------- card ---------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

.market {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.market:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.market[data-status='settled'] {
  opacity: 0.9;
}

.market__head {
  padding: 15px 17px 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.market__titlewrap {
  flex: 1;
  min-width: 0;
}

.market__title {
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0.03em;
}

.market__note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.badge {
  flex: none;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 3px;
  border: 1px solid;
}

.badge[data-status='open'] {
  color: var(--accent-soft);
  border-color: var(--border-strong);
  background: var(--brand-deep);
}

.badge[data-status='closed'] {
  color: #d9b96a;
  border-color: #4a3d18;
  background: #2a230d;
}

.badge[data-status='settled'] {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-3);
}

.market__body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

/* --------------------------------- outcome -------------------------------- */

.outcome {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.18s, border-color 0.18s;
}

.outcome:hover {
  background: var(--surface-2);
}

.outcome__no {
  flex: none;
  min-width: 26px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--accent-soft);
  background: var(--brand-deep);
  border: 1px solid var(--brand-dim);
  border-radius: 4px;
  padding: 2px 6px;
}

.outcome__label {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outcome__odds {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  transition: color 0.3s var(--ease);
}

.outcome__delta {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
}

.outcome[data-move='up'] .outcome__delta {
  color: var(--up);
}

.outcome[data-move='down'] .outcome__delta {
  color: var(--down);
}

.outcome.is-winner {
  background: linear-gradient(90deg, var(--brand-deep), transparent);
  border-color: var(--brand-dim);
}

.outcome.is-winner .outcome__label {
  font-weight: 600;
}

.outcome.is-winner .outcome__label::before {
  content: '★ ';
  color: var(--gold);
}

.outcome.is-loser .outcome__label,
.outcome.is-loser .outcome__odds {
  opacity: 0.42;
}

.outcome.is-loser .outcome__odds {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* --------------------------------- footer --------------------------------- */

.market__foot {
  padding: 10px 17px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.05em;
}

.market__foot .spacer {
  margin-left: auto;
}

.countdown {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

.countdown[data-urgent='true'] {
  color: #e0a83a;
}

.countdown[data-overdue='true'] {
  color: var(--down);
  font-weight: 700;
}

/* --------------------------------- utilities ------------------------------ */

.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 52px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.empty strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 6px;
}

.foot {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  align-items: center;
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: 0.06em;
}

.foot .spacer {
  margin-left: auto;
}

[hidden] {
  display: none !important;
}

/* ---------------------------------- forms --------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 18px;
}

.panel__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panel__head h2 {
  font-size: 19px;
  letter-spacing: 0.09em;
}

.panel__head .hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.field input,
.field select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
  transition: border-color 0.18s, background 0.18s;
}

.field input:hover,
.field select:hover {
  border-color: var(--border-strong);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
}

.field__hint {
  font-size: 11px;
  color: var(--dim);
}

/* Bidang yang membentang penuh melintasi kolom grid .row. */
.field--full {
  grid-column: 1 / -1;
}

.row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.outcome-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.outcome-row {
  display: grid;
  grid-template-columns: 62px 1fr 104px 42px;
  gap: 8px;
  align-items: center;
  animation: slidein 0.25s var(--ease);
}

@keyframes slidein {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.outcome-row input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px;
  width: 100%;
}

/* Kolom nomor peserta lebih ramping daripada kolom nama. */
.outcome-row .js-no {
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
}

.outcome-row input:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
}

.outcome-row input[type='number'] {
  font-variant-numeric: tabular-nums;
}

/* --------------------------------- buttons -------------------------------- */

.btn {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 11px 19px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s var(--ease), color 0.18s;
}

.btn:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--brand);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.btn--primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #06210f;
}

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

.btn--ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-2);
}

.btn--danger {
  color: var(--down);
  border-color: #452420;
  background: transparent;
}

.btn--danger:hover:not(:disabled) {
  background: #2a1512;
  border-color: var(--down);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 11px;
}

.btn--icon {
  padding: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
  letter-spacing: 0;
}

.btn--lock {
  width: 100%;
  grid-column: 1 / -1;
}

/* ---------------------------------- admin --------------------------------- */

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-toolbar .spacer {
  margin-left: auto;
}

.keychip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 13px;
}

.keychip b {
  color: var(--accent-soft);
  font-weight: 600;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s;
}

.admin-item:hover {
  border-color: var(--border-strong);
}

.admin-item__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  cursor: pointer;
}

.admin-item__head:hover {
  background: var(--surface-2);
}

.admin-item__title {
  flex: 1;
  min-width: 0;
}

.admin-item__title h3 {
  font-size: 16px;
  letter-spacing: 0.04em;
}

.admin-item__title p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--dim);
}

.admin-item__meta {
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-item__body {
  border-top: 1px solid var(--border);
  padding: 15px;
  background: var(--bg);
}

.chevron {
  transition: transform 0.22s var(--ease);
  color: var(--dim);
  font-size: 11px;
}

.admin-item[data-open='true'] .chevron {
  transform: rotate(90deg);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.winner-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}

.winner-pick:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.winner-pick input {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  flex: none;
}

.winner-pick__name {
  flex: 1;
}

.winner-pick b {
  font-family: var(--font-display);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------- toast --------------------------------- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 12px 15px;
  font-size: 13px;
  box-shadow: 0 14px 34px -14px #000;
  animation: toastin 0.28s var(--ease);
}

.toast[data-kind='error'] {
  border-left-color: var(--down);
}

.toast[data-kind='ok'] {
  border-left-color: var(--accent);
}

@keyframes toastin {
  from {
    opacity: 0;
    transform: translateX(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------- flash --------------------------------- */

.flash {
  animation: flash 1.1s var(--ease);
}

@keyframes flash {
  0% {
    background-color: rgba(53, 196, 119, 0.22);
  }
  100% {
    background-color: transparent;
  }
}

/* -------------------------------- responsive ------------------------------- */

@media (max-width: 720px) {
  .shell,
  .topbar__inner {
    padding-left: 15px;
    padding-right: 15px;
  }

  .brand__sub {
    display: none;
  }

  .nav a {
    padding: 8px 9px;
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .hero {
    padding: 28px 0 20px;
  }

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

  .outcome-row {
    grid-template-columns: 52px 1fr 88px 42px;
  }

  .toasts {
    left: 15px;
    right: 15px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
