/* ========== Theme (Light, Futuristic) ========== */
:root{
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0b1220;
  --muted: #6b7280;
  --line: #e5e7eb;

  --accent: #0ea5e9;      /* neon cyan */
  --accent-2: #7c3aed;    /* violet */
  --good: #10b981;
  --bad: #ef4444;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --radius: 14px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(2, 6, 23, 0.06);
  --shadow-2: 0 8px 30px rgba(2, 6, 23, 0.1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  background: radial-gradient(900px 500px at 10% -10%, rgba(14,165,233,0.15), transparent 50%),
              radial-gradient(1000px 700px at 110% -10%, rgba(124,58,237,0.12), transparent 55%),
              var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== App Shell ========== */
.app{
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.app-header{
  /* display: flex; */
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.title{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.title .logo{
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 900; font-family: var(--mono);
  box-shadow: 0 8px 18px rgba(14,165,233,0.35);
}
.title h1{
  margin: 0; font-size: clamp(22px, 3.4vw, 34px);
  font-weight: 900; letter-spacing: 0.2px; color: var(--ink);
}
.pill{
  justify-self: end;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}

.controls{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.metrics{
  display: flex; gap: 8px; flex-wrap: wrap;
}
.metric{
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  color: var(--ink);
  font-feature-settings: "tnum";
}

/* Buttons */
.btn{
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .04s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: var(--shadow-1);
}
.btn:hover{ border-color: #cbd5e1; box-shadow: var(--shadow-2); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 28px rgba(14,165,233,0.35);
}
.btn.good{
  background: linear-gradient(135deg, var(--good), #22c55e);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 28px rgba(16,185,129,0.35);
}
.btn.ghost{
  background: #fff;
  border: 1px dashed #cbd5e1;
}

/* Stage & Panels */
.stage{ display: grid; gap: 16px; }

.panel{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-1);
}
.panel-head h2{
  margin: 0 0 6px; font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 900; letter-spacing:.2px;
}
.panel-head .muted{ color: var(--muted); margin: 0; }

.panel-actions{
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px;
}
.panel-actions .left{ display: flex; gap: 8px; align-items: center; }
.panel-actions .right{ display: flex; gap: 8px; align-items: center; }
.panel-actions .hint{ color: var(--muted); font-size: 14px; }

.panel-foot{
  margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.score-line{ font-weight: 800; }
.good{ color: var(--good); }
.bad{ color: var(--bad); }

.hidden{ display: none !important; }

/* Form */
.form-grid{
  margin-top: 8px;
  display: grid; gap: 12px;
  grid-template-columns: repeat(2, minmax(200px,1fr));
}
@media (max-width: 720px){ .form-grid{ grid-template-columns: 1fr; } }
.field{ display: grid; gap: 6px; }
.field > span{ font-weight: 700; font-size: 14px; }
select, input[type="text"]{
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-weight: 600;
}

/* Grid (Cards) */
.grid{
  margin-top: 12px;
  display: grid; gap: 14px;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 780px){ .grid{ grid-template-columns: repeat(3, 1fr); } }
.card{
  position: relative; aspect-ratio: 1 / 1;
  border-radius: 14px; perspective: 1000px; overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #fafafa);
  box-shadow: var(--shadow-1);
}
.card button{ all: unset; width: 100%; height: 100%; display: block; cursor: pointer; }

.face{
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(26px, 5.4vw, 42px);
  border-radius: 12px; backface-visibility: hidden; transform-style: preserve-3d;
  transition: transform .5s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.front{
  background: linear-gradient(180deg, #fff, #f5f7fb);
  border: 1px solid var(--line);
}
.back{
  background: radial-gradient(120px 80px at 30% 20%, rgba(14,165,233,0.15), transparent 40%),
              radial-gradient(120px 80px at 70% 80%, rgba(124,58,237,0.12), transparent 45%),
              #ffffff;
  border: 1px dashed #cbd5e1;
  transform: rotateY(180deg);
  color: var(--accent-2);
  font-family: var(--mono);
}

.card:hover .front{
  border-color: #cbd5e1; box-shadow: var(--shadow-2);
}
.flipped .front{ transform: rotateY(180deg); }
.flipped .back{ transform: rotateY(0deg); }

.matched .front, .matched .back{
  background: linear-gradient(135deg, rgba(16,185,129,.12), rgba(16,185,129,.04));
  border-color: rgba(16,185,129,.4); color: var(--good);
}

/* Results */
.results-grid{
  margin-top: 10px;
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, minmax(160px,1fr));
}
@media (max-width: 760px){ .results-grid{ grid-template-columns: repeat(2, 1fr); } }
.result-card{
  background: #fff; border:1px solid var(--line);
  padding: 14px; border-radius: 12px; box-shadow: var(--shadow-1);
  font-weight: 700;
}
.result-card.total{
  border-color: rgba(14,165,233,.4);
  background: linear-gradient(135deg, rgba(14,165,233,.08), rgba(124,58,237,.06));
}

/* Overlay (Countdown) */
.overlay{
  position: fixed; inset: 0; background: rgba(2, 6, 23, .55);
  display: grid; place-items: center; z-index: 50;
}
.overlay-text{
  font-size: clamp(40px, 10vw, 120px);
  font-weight: 900; color: #fff; text-shadow: 0 10px 30px rgba(0,0,0,.4);
  font-family: var(--mono);
  animation: pop .45s ease;
}
@keyframes pop{ from{ transform: scale(.7); opacity:.2 } to{ transform: scale(1); opacity:1 } }

/* Toast */
.toast{
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 22px; background: #0f172a; color: #fff;
  border: 1px solid #1f2a44; padding: 10px 14px; border-radius: 10px;
  font-weight: 700; display: none; z-index: 60;
}

/* Modal (Leaderboard) */
.modal{
  position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2, 6, 23, .4); z-index: 60;
}
.modal-card{
  width: min(980px, 94vw); max-height: 86vh; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-2);
}
.modal-head{
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.modal-head h3{ margin: 0; font-size: 18px; font-weight: 900; }
.icon-btn{ border: 1px solid var(--line); background:#fff; border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.modal-body{ padding: 14px 16px; overflow: auto; }
.modal-foot{ padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

.lb-grid{ display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 840px){ .lb-grid{ grid-template-columns: 1fr; } }

.table-wrap{ overflow:auto; border:1px solid var(--line); border-radius: 12px; background:#fff; }
table{ width: 100%; border-collapse: collapse; }
th, td{ text-align: left; padding: 10px 10px; border-bottom: 1px dashed #e5e7eb; }
th{ font-weight: 800; color: var(--ink); }
td{ color: #111827; }

/* Utilities */
.row-gap{ gap: 10px; }
#gamePill{ color: var(--muted); }

/* Center the whole block vertically & horizontally */
.brand-wrapper {
  /* min-height: 100vh; */ /* full viewport height */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc; /* optional background */
  text-align: center;
}

/* Stack the logos vertically */
.brand-logo-small a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px; /* space between images */
  text-decoration: none;
}

/* Make both logos responsive and centered */
.brand-logo-small img {
  display: block;
  margin: 0 auto;
  max-width: 220px;   /* adjust as needed */
  height: auto;
}

.brand-logo-small .main-logo {
  max-width: 140px; /* top logo slightly smaller */
}

.brand-logo-small .sub-logo {
  max-width: 160px; /* text logo slightly wider */
}

/* Tagline text styling */
.brand-tagline h6 {
  margin-top: 20px;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b; /* dark gray */
  line-height: 1.4;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Optional responsive tweaks */
@media (max-width: 600px) {
  .brand-logo-small img {
    max-width: 160px;
  }
  .brand-tagline h6 {
    font-size: 0.95rem;
    padding: 0 20px;
  }
}

.header-2 {
    font-size: 2em;
    font-weight: 400;
    font-family: "Poppins", sans-serif !important;
    background: linear-gradient(to right, black 0%, black 20%, green 40%, red 80%, #c4a747 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.text-center{
	text-align: center;
}

.panel-head{
	margin-top:20px;
	margin-bottom:30px;
}