/* ============================================================
   MATCH MONEY — "Dual Metal on Lava" theme (v2)
   Silver + gold metals (from the brand wordmark) on a warm
   lava-black base, with ember red reserved for live states.
   Matches the Flutter app palette (AppColors in config.dart).
   ============================================================ */

:root {
  /* Base */
  --pubg-black:       #0B0A08;  /* page base (lava black) */
  --pubg-dark:        #100F0C;  /* header / section tint  */
  --pubg-surface:     #1A1712;  /* lifted surface          */
  --pubg-card:        #211D16;  /* cards / menus           */
  --pubg-border:      #3A3428;  /* warm border             */
  --pubg-text:        #FFFFFF;
  --pubg-muted:       #B0A99A;

  /* Gold metal (primary) */
  --pubg-primary:     #FFB422;
  --pubg-primary-dk:  #E59400;
  --pubg-gold-hi:     #FFD25E;

  /* Silver metal (secondary — the "MATCH" in the wordmark) */
  --pubg-silver-hi:   #F4F3F0;
  --pubg-silver:      #C9CBD1;
  --pubg-silver-dk:   #8E93A1;

  /* Ember red (live / danger accents — the crown in the logo) */
  --pubg-ember:       #E23636;
  --pubg-success:     #34D399;
  --pubg-danger:      #F87171;
  --pubg-warning:     #F59E0B;

  --gold-gradient:        linear-gradient(135deg, #FFD25E 0%, #FFB422 46%, #E59400 100%);
  --gold-gradient-soft:   linear-gradient(135deg, rgba(255,180,34,.20), rgba(229,148,0,.07));
  --gold-glow:            0 0 0 1px rgba(255,180,34,.38), 0 8px 30px -8px rgba(255,180,34,.5);
  --silver-gradient:      linear-gradient(135deg, #FFFFFF 0%, #C9CBD1 45%, #8E93A1 100%);
  --ember-glow:           0 0 0 1px rgba(226,54,54,.35), 0 8px 26px -8px rgba(226,54,54,.5);
}

/* ---- Base ------------------------------------------------- */
* { -webkit-tap-highlight-color: transparent; }

body {
  background-color: var(--pubg-black);
  /* Lava field: a faint gold sunrise up top, a whisper of ember
     at the bottom edge — like the cracked-lava logo texture. */
  background-image:
    radial-gradient(1200px 700px at 85% -10%, rgba(255,180,34,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 112%, rgba(226,54,54,.05), transparent 55%),
    linear-gradient(0deg, rgba(255,210,94,.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,210,94,.014) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
  background-attachment: fixed;
  color: var(--pubg-text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Rajdhani', 'Inter', sans-serif;
  letter-spacing: .01em;
}

/* ---- Dual-metal text (brand signature) -------------------- */
.text-gold-gradient {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.text-silver-gradient {
  background: var(--silver-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Wide-tracked section eyebrow */
.eyebrow {
  font-size: .78rem; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--pubg-primary);
}

/* Live pulse dot (ember red — reserved for live matches) */
.live-dot { position: relative; display: inline-flex; height: .5rem; width: .5rem; }
.live-dot::before {
  content: ''; position: absolute; inset: 0; border-radius: 999px;
  background: var(--pubg-ember); opacity: .75;
  animation: mm-ping 1.4s cubic-bezier(0,0,.2,1) infinite;
}
.live-dot::after {
  content: ''; position: relative; display: inline-flex;
  height: .5rem; width: .5rem; border-radius: 999px; background: var(--pubg-ember);
}
@keyframes mm-ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

/* ---- Buttons --------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; border-radius: .625rem;
  padding: .7rem 1.4rem; line-height: 1;
  min-height: 44px; /* comfortable tap target on touch devices */
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, background .2s ease;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,180,34,.45); }

.btn-gold {
  position: relative; overflow: hidden;
  background: var(--gold-gradient);
  color: #17130B;
  font-family: 'Rajdhani', sans-serif; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  box-shadow: 0 6px 20px -6px rgba(255,180,34,.55);
  /* Bladed corners — echoes the angular letterforms of the wordmark. */
  border-radius: .625rem;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.btn-gold::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  transform: translateX(-130%); transition: transform .6s ease;
}
.btn-gold:hover::after { transform: translateX(130%); }
.btn-gold:hover { filter: brightness(1.05); box-shadow: 0 10px 28px -6px rgba(255,180,34,.7); }

.btn-outline {
  background: transparent; color: var(--pubg-primary);
  border-color: var(--pubg-border);
  font-family: 'Rajdhani', sans-serif; font-weight: 600;
  letter-spacing: .02em; text-transform: uppercase;
}
.btn-outline:hover { border-color: var(--pubg-primary); background: var(--gold-gradient-soft); }

.btn-silver {
  background: var(--silver-gradient);
  color: #14130F;
  font-family: 'Rajdhani', sans-serif; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  box-shadow: 0 6px 20px -8px rgba(201,203,209,.4);
}
.btn-silver:hover { filter: brightness(1.05); }

.btn-ghost { background: transparent; color: var(--pubg-muted); }
.btn-ghost:hover { color: var(--pubg-text); background: rgba(255,255,255,.04); }

.btn-block { width: 100%; }

/* ---- Cards ----------------------------------------------- */
.card {
  background: var(--pubg-card);
  border: 1px solid var(--pubg-border);
  border-radius: 1rem;
}
.card-glow { transition: border-color .2s ease, box-shadow .25s ease, transform .2s ease; }
.card-glow:hover {
  border-color: rgba(255,180,34,.6);
  box-shadow: var(--gold-glow);
}
/* Live tournaments get the ember treatment instead. */
.card-live { border-color: rgba(226,54,54,.45); }
.card-live:hover { border-color: rgba(226,54,54,.7); box-shadow: var(--ember-glow); }

/* gradient hairline on top of a panel */
.gold-rule {
  height: 2px; border: none;
  background: var(--gold-gradient);
  opacity: .85;
}
/* dual-metal hairline: silver fades into gold, like the wordmark */
.metal-rule {
  height: 2px; border: none;
  background: linear-gradient(90deg, transparent, #C9CBD1 30%, #FFB422 70%, transparent);
  opacity: .8;
}

/* ---- Brand logo ------------------------------------------ */
.brand-logo {
  height: 2.4rem; width: 2.4rem;
  border-radius: .6rem;
  object-fit: cover;
  box-shadow: 0 6px 18px -6px rgba(255,180,34,.55);
}
.brand-logo-lg { height: 3.4rem; width: 3.4rem; border-radius: .85rem; }

/* Legacy text mark (kept for any page not yet using the image) */
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: .6rem;
  background: var(--gold-gradient); color: #17130B;
  display: grid; place-items: center; font-weight: 800;
  box-shadow: 0 6px 18px -6px rgba(255,180,34,.6);
}

/* ---- Form fields ----------------------------------------- */
.field-label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--pubg-muted); margin-bottom: .4rem;
  letter-spacing: .02em;
}
.input-field {
  width: 100%;
  background: var(--pubg-surface);
  border: 1px solid var(--pubg-border);
  color: var(--pubg-text);
  border-radius: .625rem;
  padding: .7rem .9rem .7rem 2.5rem;
  font-size: 16px;   /* >=16px stops iOS Safari from auto-zooming on focus */
  min-height: 44px;  /* comfortable tap target */
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input-field::placeholder { color: #7A7466; }
.input-field:focus {
  outline: none;
  border-color: var(--pubg-primary);
  box-shadow: 0 0 0 3px rgba(255,180,34,.18);
  background: #241F15;
}
.input-wrap { position: relative; }
.input-wrap > .input-icon {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: #7A7466; pointer-events: none; font-size: .95rem;
}
.input-wrap > .input-toggle {
  position: absolute; right: .8rem; top: 50%; transform: translateY(-50%);
  color: #7A7466; cursor: pointer; background: none; border: none; padding: .25rem;
}
.input-wrap > .input-toggle:hover { color: var(--pubg-primary); }
.field-error { color: var(--pubg-danger); font-size: .8rem; margin-top: .35rem; }

/* ---- Badges ---------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: .25rem .6rem; border-radius: 999px;
}
.badge-success { background: rgba(52,211,153,.14); color: #4ade80; border: 1px solid rgba(52,211,153,.4); }
.badge-danger  { background: rgba(226,54,54,.14);  color: #f87171; border: 1px solid rgba(226,54,54,.45); }
.badge-warning { background: rgba(255,180,34,.13); color: #FFD25E; border: 1px solid rgba(255,180,34,.4); }
.badge-muted   { background: rgba(176,169,154,.10); color: var(--pubg-muted); border: 1px solid var(--pubg-border); }

/* ---- Flash toasts ---------------------------------------- */
.toast-wrap {
  position: fixed; top: 1rem; right: 1rem; z-index: 60;
  display: flex; flex-direction: column; gap: .6rem; max-width: 360px; width: calc(100% - 2rem);
}
.toast {
  display: flex; align-items: start; gap: .65rem;
  background: var(--pubg-card); border: 1px solid var(--pubg-border);
  border-left-width: 4px; border-radius: .7rem; padding: .8rem 1rem;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.7);
}
.toast-success { border-left-color: var(--pubg-success); }
.toast-error   { border-left-color: var(--pubg-danger); }
.toast-info    { border-left-color: var(--pubg-primary); }

/* ---- Scrollbar ------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--pubg-dark); }
::-webkit-scrollbar-thumb { background: var(--pubg-border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--pubg-primary-dk); }

/* ---- Misc ------------------------------------------------ */
.divider-text {
  display: flex; align-items: center; gap: .9rem;
  color: var(--pubg-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
}
.divider-text::before, .divider-text::after {
  content: ''; flex: 1; height: 1px; background: var(--pubg-border);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .btn-gold::after { display: none; }
  .live-dot::before { animation: none; }
}

/* ---- Mobile touch optimisation ---- */
@media (max-width: 640px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
  }
  select, textarea { min-height: 44px; }
}

/* ---- Safety-net responsive utilities (independent of Tailwind) ---- */
.hidden { display: none; }

@media (max-width: 1023px) {
  aside.lg\:block { display: none !important; }
}
@media (min-width: 1024px) {
  aside.lg\:block { display: block !important; }
  .lg\:hidden { display: none !important; }
  main.lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* ---- Auth pages: mobile card + lava background ---- */
@media (max-width: 1023px) {
  .auth-form-col {
    background:
      radial-gradient(1100px 700px at 50% 0%, rgba(255,180,34,.15), rgba(255,180,34,.04) 38%, transparent 70%),
      radial-gradient(800px 500px at 50% 108%, rgba(226,54,54,.06), transparent 60%),
      linear-gradient(180deg, #16130D 0%, #0E0D0A 60%, #0B0A08 100%);
    background-attachment: fixed;
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    padding-top: 2.5rem;
    justify-content: flex-start;
  }
  .brand-mark-auth {
    width: 3.25rem; height: 3.25rem;
    border-radius: .8rem;
    font-size: 1.4rem;
  }
  .auth-form-col > div { width: 100%; }
  .auth-card {
    width: 100%;
    background: rgba(33, 29, 22, .5);
    border: 1px solid var(--pubg-border);
    border-radius: 1.1rem;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 20px 50px -20px rgba(0,0,0,.8);
    backdrop-filter: blur(6px);
  }
}
@media (min-width: 1024px) {
  .auth-card { background: transparent; border: 0; padding: 0; box-shadow: none; }
}

/* ---- Responsive tables -> stacked cards ---- */
@media (max-width: 640px) {
  table.responsive-table,
  table.responsive-table tbody,
  table.responsive-table tr,
  table.responsive-table td {
    display: block;
    width: 100%;
  }
  table.responsive-table thead { display: none; }
  table.responsive-table tr {
    border: 1px solid var(--pubg-border);
    border-radius: .7rem;
    background: var(--pubg-surface);
    padding: .35rem .25rem;
    margin-bottom: .75rem;
  }
  table.responsive-table tr:last-child { margin-bottom: 0; }
  table.responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    text-align: right;
    padding: .5rem .85rem !important;
    border: 0 !important;
  }
  table.responsive-table td::before {
    content: attr(data-label);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--pubg-muted);
    text-align: left;
    flex: 0 0 auto;
  }
  table.responsive-table td:not([data-label])::before { content: ""; }
}

/* ---- Responsive visibility fix (Tailwind build orders base
   .hidden after the responsive blocks; re-assert show rules) ---- */
@media (min-width: 768px) {
  .hidden.md\:flex  { display: flex !important; }
  .hidden.md\:block { display: block !important; }
  .hidden.md\:inline-flex { display: inline-flex !important; }
  .md\:hidden { display: none !important; }
}
@media (min-width: 640px) {
  .hidden.sm\:flex  { display: flex !important; }
  .hidden.sm\:block { display: block !important; }
  .hidden.sm\:inline-flex { display: inline-flex !important; }
}

/* ---- Legal pages (terms / privacy / anti-cheat) ---- */
.legal-h { color: #fff; font-weight: 700; font-size: 1.05rem; margin-bottom: .4rem; }
.legal-list { list-style: disc; padding-left: 1.25rem; margin-top: .4rem; }
.legal-list li { margin-bottom: .35rem; }
.legal a { word-break: break-word; }

/* ---- Mobile / app safety net ---- */
html, body { max-width: 100%; }
body { overflow-x: hidden; }
*, *::before, *::after { overflow-wrap: break-word; }
img, video, svg, canvas { max-width: 100%; height: auto; }
.overflow-x-auto { -webkit-overflow-scrolling: touch; }
input, select, textarea { max-width: 100%; }

/* ---- App-style match cards ---- */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.map-thumb {
  background: linear-gradient(135deg, #2A2620, #161410);
}
.map-thumb > i {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 1.9rem; color: rgba(255,255,255,.32);
}
