/* ============================================================
   PUBG Arena — gold-gradient theme
   Dark tactical base + signature gold gradient.
   ============================================================ */

:root {
  --pubg-dark:        #1A1A2E;
  --pubg-surface:     #16213E;
  --pubg-card:        #2D2D44;
  --pubg-border:      #3D3D5C;
  --pubg-text:        #FFFFFF;
  --pubg-muted:       #A8A8B8;
  --pubg-primary:     #F5A623;
  --pubg-primary-dk:  #C8A400;
  --pubg-gold-hi:     #FFE08A;
  --pubg-success:     #22C55E;
  --pubg-danger:      #EF4444;
  --pubg-warning:     #F59E0B;

  --gold-gradient:        linear-gradient(135deg, #FFE08A 0%, #F5A623 46%, #C8A400 100%);
  --gold-gradient-soft:   linear-gradient(135deg, rgba(245,166,35,.18), rgba(200,164,0,.06));
  --gold-glow:            0 0 0 1px rgba(245,166,35,.35), 0 8px 30px -8px rgba(245,166,35,.45);
}

/* ---- Base ------------------------------------------------- */
* { -webkit-tap-highlight-color: transparent; }

body {
  background-color: #100F0C;
  background-image:
    radial-gradient(1200px 700px at 85% -10%, rgba(245,166,35,.10), transparent 60%),
    radial-gradient(1000px 600px at -10% 110%, rgba(245,166,35,.05), transparent 55%),
    linear-gradient(0deg, rgba(255,225,160,.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,225,160,.015) 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;
}

/* ---- Gold text ------------------------------------------- */
.text-gold-gradient {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- 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(245,166,35,.45); }

.btn-gold {
  position: relative; overflow: hidden;
  background: var(--gold-gradient);
  color: #1A1A2E;
  font-family: 'Rajdhani', sans-serif; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase;
  box-shadow: 0 6px 20px -6px rgba(245,166,35,.55);
}
.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.04); box-shadow: 0 10px 28px -6px rgba(245,166,35,.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-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(245,166,35,.6);
  box-shadow: var(--gold-glow);
}

/* gradient hairline on top of a panel */
.gold-rule {
  height: 2px; border: none;
  background: var(--gold-gradient);
  opacity: .85;
}

/* ---- 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: #6f6f86; }
.input-field:focus {
  outline: none;
  border-color: var(--pubg-primary);
  box-shadow: 0 0 0 3px rgba(245,166,35,.18);
  background: #182645;
}
.input-wrap { position: relative; }
.input-wrap > .input-icon {
  position: absolute; left: .9rem; top: 50%; transform: translateY(-50%);
  color: #6f6f86; pointer-events: none; font-size: .95rem;
}
.input-wrap > .input-toggle {
  position: absolute; right: .8rem; top: 50%; transform: translateY(-50%);
  color: #6f6f86; 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(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.4); }
.badge-danger  { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.4); }
.badge-warning { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.4); }
.badge-muted   { background: rgba(168,168,184,.12); 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 ------------------------------------------------ */
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: .6rem;
  background: var(--gold-gradient); color: #1A1A2E;
  display: grid; place-items: center; font-weight: 800;
  box-shadow: 0 6px 18px -6px rgba(245,166,35,.6);
}
.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; }
}

/* ---- Mobile touch optimisation (Phase 2) ---- */
/* Any form control on small screens renders at >=16px so iOS Safari does not
   auto-zoom the page when the field gains focus. Scoped to a phone-width
   breakpoint so desktop sizing is untouched. */
@media (max-width: 640px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
  }
  /* Keep interactive controls easy to tap. */
  select, textarea { min-height: 44px; }
}

/* ---- Safety-net responsive utilities (independent of Tailwind) ---- */
/* These guarantee the most critical layout behaviour even if the Tailwind CDN
   is slow to compile or fails to load. Hand-written so they always work.
   Mirrors Tailwind's lg: breakpoint (1024px). */

/* Base utilities the auth layout depends on. */
.hidden { display: none; }

@media (max-width: 1023px) {
  /* Desktop-only brand panel stays hidden on mobile even if Tailwind's lg:block
     hasn't loaded yet. */
  aside.lg\:block { display: none !important; }
}
@media (min-width: 1024px) {
  /* Desktop: show the brand panel, hide mobile-only bits. */
  aside.lg\:block { display: block !important; }
  .lg\:hidden { display: none !important; }
  /* Auth split-screen: two columns on desktop. */
  main.lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* ---- Auth pages: mobile card + black background (Phase: login/register polish) ---- */
/* On phones/tablets the form sits in a distinct lifted card on a near-black
   background, matching the desired look. On desktop (>=1024px) the split-screen
   layout already frames the form, so the card chrome is removed. */
@media (max-width: 1023px) {
  .auth-form-col {
    background:
      radial-gradient(1100px 700px at 50% 0%, rgba(245,166,35,.16), rgba(245,166,35,.04) 38%, transparent 70%),
      radial-gradient(900px 600px at 50% 100%, rgba(245,166,35,.05), transparent 60%),
      linear-gradient(180deg, #17150e 0%, #131319 60%, #121218 100%);
    background-attachment: fixed;
    min-height: 100vh;
    flex-direction: column;   /* stack vertically on mobile */
    align-items: center;       /* centre the form wrapper horizontally */
    padding-top: 2.5rem;       /* lift the logo toward the top */
    justify-content: flex-start;
  }
  /* Larger brand mark on the auth pages. */
  .brand-mark-auth {
    width: 3.25rem; height: 3.25rem;
    border-radius: .8rem;
    font-size: 1.4rem;
  }
  /* The form wrapper (w-full max-w-md) must truly fill the column width. */
  .auth-form-col > div { width: 100%; }
  .auth-card {
    width: 100%;
    background: rgba(22, 33, 62, .35);
    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);
  }
}
/* Desktop: keep the form flat inside the split-screen panel. */
@media (min-width: 1024px) {
  .auth-card { background: transparent; border: 0; padding: 0; box-shadow: none; }
}

/* ---- Responsive tables -> stacked cards (Phase 4) ---- */
/* Add class="responsive-table" to a <table> and data-label="Header" to each
   <td>. On phones the table collapses: the header row hides and every row
   becomes a card with "Label   value" pairs. Desktop is unchanged. */
@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; /* column headers move into each cell via data-label */
  }
  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;
  }
  /* The label, pulled from data-label, sits on the left of each pair. */
  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;
  }
  /* Cells with no label (or empty) shouldn't reserve the left gutter. */
  table.responsive-table td:not([data-label])::before { content: ""; }
}

/* ============================================================
   GLOWING-BLACK THEME OVERRIDE (site-wide recolor)
   Loads after tailwind.css, so these win over the compiled blue
   palette. Recolors the whole site to a very dark, warm,
   gold-tinted base to match the login page. Fully reversible:
   delete this whole block to return to the original blue theme.
   ============================================================ */

/* New palette values (warm very-dark + brighter gold) */
:root {
  --pubg-dark:        #100F0C;  /* near-black warm base */
  --pubg-surface:     #1A1813;  /* lifted surface */
  --pubg-card:        #221F18;  /* cards / menus */
  --pubg-border:      #3A352A;  /* warm dark border */
  --pubg-text:        #FFFFFF;
  --pubg-muted:       #B0A99A;  /* warm muted grey */
  --pubg-primary:     #FFB422;  /* brighter, warmer gold */
  --pubg-primary-dk:  #E09600;
  --pubg-gold-hi:     #FFE9A8;

  --gold-gradient:      linear-gradient(135deg, #FFE9A8 0%, #FFB422 46%, #E09600 100%);
  --gold-gradient-soft: linear-gradient(135deg, rgba(255,180,34,.20), rgba(224,150,0,.07));
  --gold-glow:          0 0 0 1px rgba(255,180,34,.38), 0 8px 30px -8px rgba(255,180,34,.5);
}

/* Override the hardcoded Tailwind colour utilities to the new palette.
   These mirror the class names used across the site. */
.bg-pubg-dark    { background-color: #100F0C !important; }
.bg-pubg-surface { background-color: #1A1813 !important; }
.bg-pubg-card    { background-color: #221F18 !important; }
.bg-pubg-border  { background-color: #3A352A !important; }

.border-pubg-border { border-color: #3A352A !important; }
.text-pubg-border   { color: #3A352A !important; }
.text-pubg-muted    { color: #B0A99A !important; }
.text-pubg-primary  { color: #FFB422 !important; }
.bg-pubg-primary    { background-color: #FFB422 !important; }
.border-pubg-primary{ border-color: #FFB422 !important; }

/* Translucent variants (e.g. bg-pubg-dark/85, bg-pubg-surface/40) used in
   sticky headers and overlays. Re-tint to the warm base. */
.bg-pubg-dark\/85   { background-color: rgba(16,15,12,.85) !important; }
.bg-pubg-dark\/80   { background-color: rgba(16,15,12,.80) !important; }
.bg-pubg-dark\/60   { background-color: rgba(16,15,12,.60) !important; }
.bg-pubg-surface\/40{ background-color: rgba(26,24,19,.40) !important; }
.bg-pubg-surface\/60{ background-color: rgba(26,24,19,.60) !important; }

/* Remaining opacity-suffixed dark/surface/border variants in use. */
.bg-pubg-dark\/95    { background-color: rgba(16,15,12,.95) !important; }
.bg-pubg-surface\/30 { background-color: rgba(26,24,19,.30) !important; }
.border-pubg-border\/50 { border-color: rgba(58,53,42,.50) !important; }
.border-pubg-border\/60 { border-color: rgba(58,53,42,.60) !important; }

/* ============================================================
   RESPONSIVE VISIBILITY FIX
   This Tailwind build orders base .hidden AFTER the responsive
   @media blocks, so `.hidden` wins over `md:flex`/`md:block` and
   desktop-only elements stay hidden. Re-assert the responsive
   show rules here (app.css loads last, so these win). 
   ============================================================ */
@media (min-width: 768px) {
  .hidden.md\:flex  { display: flex !important; }
  .hidden.md\:block { display: block !important; }
  .hidden.md\:inline-flex { display: inline-flex !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; }
}
/* And make sure md:hidden still hides on desktop (e.g. the hamburger). */
@media (min-width: 768px) {
  .md\:hidden { display: none !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 (Phase 5)
   Prevents the most common mobile bug: a single wide element
   making the whole page scroll sideways. Important for the
   future Play Store WebView app. Safe site-wide.
   ============================================================ */
html, body {
  max-width: 100%;
}
body {
  overflow-x: hidden;          /* no accidental horizontal page scroll */
}
/* Note: overflow-x is kept off <html> so position:sticky (the header)
   keeps working — putting overflow on the scroll root breaks sticky. */
*, *::before, *::after {
  /* Long unbroken strings (emails, UIDs, URLs) wrap instead of
     stretching their container past the screen edge. */
  overflow-wrap: break-word;
}
img, video, svg, canvas {
  max-width: 100%;             /* media never overflows its box */
  height: auto;
}
/* Tables that opt into horizontal scroll keep doing so smoothly
   on touch, without affecting the page itself. */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}
/* Inputs and selects never exceed their container on small screens. */
input, select, textarea {
  max-width: 100%;
}