/* =========================================================
   DIAPPREK — core stylesheet
   Design: floodlit-pitch scoreboard aesthetic
   ========================================================= */

:root {
  --bg: #0B120D;
  --surface: #121D16;
  --surface-raised: #17241B;
  --line: #24352A;
  --lime: #C8FF4D;
  --lime-dim: #8FCC2E;
  --amber: #F5B942;
  --red: #FF6B5E;
  --text: #EDF2EC;
  --text-muted: #7E8C82;
  --text-faint: #4C594F;

  --font-display: 'Archivo', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  --radius-s: 6px;
  --radius-m: 10px;
  --container: 1080px;
}

* { box-sizing: border-box; }

html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em 0;
  color: var(--text);
}

p { margin: 0 0 1em 0; color: var(--text-muted); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: rgba(11, 18, 13, 0.96);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.logo span { color: var(--lime); }

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

.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-s);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--lime);
  color: #0B120D;
}
.btn-primary:hover { background: var(--lime-dim); }

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

.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--line);
}

.hero .eyebrow {
  color: var(--lime);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  max-width: 14ch;
}

.hero p.lede {
  max-width: 52ch;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 36px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.hero-stat .num {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--lime);
  line-height: 1;
}
.hero-stat .label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------------- Section ---------------- */
.section {
  padding: 48px 0;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-head h2 { font-size: 1.5rem; }
.section-head .date-pill {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 20px;
}

/* ---------------- Match card ---------------- */
.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px;
}

.match-card .league {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.team img { width: 40px; height: 40px; object-fit: contain; }
.team span {
  font-size: 0.82rem;
  text-align: center;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.vs {
  font-family: var(--font-display);
  color: var(--text-faint);
  font-size: 0.8rem;
  padding-bottom: 20px;
}

.match-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.odds-block .odds-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.odds-block .odds-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--lime);
  line-height: 1.1;
}

.tier {
  text-align: right;
}
.tier .confidence {
  font-size: 0.72rem;
  color: var(--amber);
  font-weight: 700;
}
.tier .price {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
}

.pick-row {
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--surface-raised);
  border-radius: var(--radius-s);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}
.pick-row.locked { color: var(--text-muted); }
.pick-row.unlocked { color: var(--lime); font-weight: 700; }
.pick-row .lock-icon { flex-shrink: 0; opacity: 0.7; }

.result-badge {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-badge.won { background: rgba(200,255,77,0.1); color: var(--lime); }
.result-badge.lost { background: rgba(255,107,94,0.1); color: var(--red); }

.result-comment {
  margin-top: 8px;
  font-size: 0.83rem;
  color: var(--text-muted);
  font-style: italic;
}

.wallet-chip {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--lime);
  background: rgba(200,255,77,0.1);
  border: 1px solid rgba(200,255,77,0.25);
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
}

/* ---------------- Recovery phrase ---------------- */
.phrase-box {
  background: var(--bg);
  border: 1px solid var(--lime);
  border-radius: var(--radius-m);
  padding: 18px;
  margin: 16px 0;
}
.phrase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.phrase-word {
  background: var(--surface-raised);
  border-radius: var(--radius-s);
  padding: 8px 10px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--lime);
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.phrase-word .idx {
  color: var(--text-faint);
  font-size: 0.7rem;
}
.warning-box {
  background: rgba(255,107,94,0.1);
  border: 1px solid rgba(255,107,94,0.3);
  border-radius: var(--radius-s);
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 16px;
}
.warning-box strong { color: var(--red); }

.choice-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.choice-card:hover { border-color: var(--lime); }
.choice-card h4 { margin-bottom: 4px; font-size: 1rem; }
.choice-card p { margin: 0; font-size: 0.85rem; }

/* ---------------- Multi-game prediction card (scorecard style) ---------------- */
.game-scorecard {
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
}
.game-scorecard:last-child { border-bottom: none; }

.scorecard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.scorecard-teams {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.scorecard-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.scorecard-team img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}
.scorecard-team span {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.scorecard-vs {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-faint);
  flex-shrink: 0;
  padding: 0 4px;
}

.scorecard-pick {
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--lime);
  font-weight: 700;
}
.scorecard-pick.locked { color: var(--text-muted); font-weight: 500; }

.scorecard-score {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
  padding: 0 4px;
}
.scorecard-finished {
  text-align: center;
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------------- Notification bell ---------------- */
.notif-wrap { position: relative; display: inline-flex; }
.notif-bell {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
}
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
/* Rendered as a direct child of <body> (not nested inside .site-header,
   which uses backdrop-filter — a CSS property that turns any descendant's
   position:fixed into "relative to this element" instead of the real
   viewport, breaking a dropdown positioned this way). Fixed everywhere,
   not just on mobile, so there's one reliable code path. */
.notif-panel {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top, 0px) + 8px);
  right: 16px;
  left: auto;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: min(420px, calc(100vh - 100px));
  overflow-y: auto;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  z-index: 300;
}
.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: block;
  color: var(--text);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface); }
.notif-item .t { font-size: 0.85rem; font-weight: 700; margin-bottom: 2px; }
.notif-item .b { font-size: 0.8rem; color: var(--text-muted); }
.notif-item .d { font-size: 0.7rem; color: var(--text-faint); margin-top: 4px; }
.notif-empty { padding: 24px 14px; text-align: center; font-size: 0.85rem; color: var(--text-muted); }

@media (max-width: 480px) {
  .notif-panel { right: 10px; left: 10px; width: auto; max-width: none; }
}

/* ---------------- Amount presets (top-up) ---------------- */
.preset-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.preset-btn {
  padding: 8px 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.preset-btn.active { border-color: var(--lime); color: var(--lime); }

/* ---------------- Toast notifications ---------------- */
#toast-container {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.toast {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--lime);
  border-radius: var(--radius-s);
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: var(--lime); }
.toast-error { border-left-color: var(--red); }
.toast-info { border-left-color: var(--amber); }

@media (max-width: 480px) {
  #toast-container { left: 14px; right: 14px; max-width: none; }
}

.match-card .cta {
  margin-top: 14px;
}

.closed-flag {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--red);
  text-align: center;
}

/* ---------------- Confidence bar ---------------- */
.conf-bar {
  height: 5px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin: 6px 0 0;
}
.conf-bar-fill {
  height: 100%;
  background: var(--amber);
}

/* ---------------- Pricing table ---------------- */
.tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.tier-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 20px;
}
.tier-card .conf {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--amber);
}
.tier-card .price-line {
  margin-top: 6px;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ---------------- Forms ---------------- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 28px;
  max-width: 440px;
  margin: 0 auto;
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 11px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--lime);
}
.field-hint {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 4px;
}

.form-msg {
  font-size: 0.85rem;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  margin-bottom: 16px;
  display: none;
}
.form-msg.show { display: block; }
.form-msg.error { background: rgba(255,107,94,0.12); color: var(--red); }
.form-msg.success { background: rgba(200,255,77,0.1); color: var(--lime); }

/* ---------------- Banner / notice ---------------- */
.notice {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-s);
  padding: 16px 18px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.notice strong { color: var(--text); }
.notice ul { margin: 10px 0 0; padding-left: 18px; }
.notice li { margin-bottom: 6px; }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
  margin-top: 40px;
}
.site-footer p {
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* ---------------- Tabs ---------------- */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active {
  color: var(--lime);
  border-bottom-color: var(--lime);
  font-weight: 600;
}

/* ---------------- Table (admin) ---------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-pending { background: rgba(245,185,66,0.15); color: var(--amber); }
.badge-approved { background: rgba(200,255,77,0.15); color: var(--lime); }
.badge-rejected { background: rgba(255,107,94,0.15); color: var(--red); }

/* ---------------- Utility ---------------- */
.muted { color: var(--text-muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.hidden { display: none !important; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ---------------- Mobile nav (hamburger) ---------------- */
.nav-hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 640px) {
  .container { padding: 0 16px; }

  .nav-hamburger { display: inline-flex; }
  .nav-links { gap: 10px; }
  .nav-links a:not(.btn) { display: none; }
  .nav-links.nav-open {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 28px rgba(0,0,0,0.45);
    padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
    z-index: 250;
  }
  .nav-links.nav-open a:not(.btn) {
    display: block;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
  }
  .nav-links.nav-open #auth-area,
  .nav-links.nav-open .notif-wrap {
    order: 99;
  }
  .nav-links.nav-open #auth-area {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 10px;
  }
  .nav-links.nav-open .wallet-chip { justify-content: center; }

  .hero { padding: 32px 0 28px; }
  .hero h1 { max-width: none; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .hero-stats { gap: 20px; }

  .section { padding: 32px 0; }
  .section-head { gap: 10px; }

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

  .tabs { gap: 2px; }
  .tab { padding: 9px 12px; font-size: 0.85rem; }

  .scorecard-teams { gap: 10px; }
  .scorecard-team img { width: 42px; height: 42px; }
  .scorecard-team span { font-size: 0.78rem; }
  .scorecard-vs, .scorecard-score { font-size: 1.25rem; }

  .form-card { padding: 20px; max-width: none; }

  .preset-row { gap: 6px; }
  .preset-btn { padding: 7px 11px; font-size: 0.8rem; }

  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px; }

  /* Bottom-sheet style on small screens instead of a centered box,
     easier to reach one-handed and never taller than the viewport */
  div[style*="position:fixed"][style*="inset:0"] > .form-card {
    max-height: 85vh;
    overflow-y: auto;
  }

  /* Two-column inline form grids (date/time, home/away team, etc.)
     stack into one column instead of cramming on a narrow screen. */
  div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 400px) {
  .hero-stats, #profile-info, #profile-wallet, #overview-block {
    gap: 14px !important;
  }
  .hero-stat .num { font-size: 1.5rem; }
  #auth-area { flex-wrap: wrap; justify-content: flex-end; }
  .btn-sm { padding: 6px 10px; font-size: 0.8rem; }
}
