/* ===========================
   Beast Challenge System
   style.css (FULL)
   ADHD-friendly: clear, spacious, big buttons, low clutter, mobile-first
   =========================== */

/* --------- Reset / Base --------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0b0f14;
  --panel: #101826;
  --card: #121c2c;
  --card-2: #0f1726;
  --text: #eaf0ff;
  --muted: rgba(234, 240, 255, 0.7);
  --muted-2: rgba(234, 240, 255, 0.55);
  --border: rgba(255, 255, 255, 0.08);

  --accent: #7c5cff;
  --accent-2: #27e0a3;
  --danger: #ff4d6d;
  --warn: #ffb020;

  --shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.25);

  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;

  --pad-xl: 22px;
  --pad-lg: 18px;
  --pad-md: 14px;
  --pad-sm: 12px;

  --btn-h: 54px;
  --focus: 0 0 0 4px rgba(124, 92, 255, 0.35);

  --maxw: 1080px;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% 10%, rgba(124, 92, 255, 0.15), transparent 55%),
    radial-gradient(900px 700px at 90% 20%, rgba(39, 224, 163, 0.10), transparent 50%),
    linear-gradient(180deg, #070a0f 0%, #0b0f14 45%, #0b0f14 100%);
  line-height: 1.35;
}

/* Text defaults */
h1, h2, h3, h4 {
  margin: 0 0 10px 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 10px 0;
  color: var(--muted);
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --------- Helpers --------- */
.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 14px;
}

/* --------- Auth Screen --------- */
#auth-screen {
  position: relative;
}
/* --------- Boot Screen --------- */
#boot-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 14px;
}

#boot-screen > div {
  width: min(560px, 100%);
  background: linear-gradient(180deg, rgba(16, 24, 38, 0.9), rgba(16, 24, 38, 0.65));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 26px 20px;
  text-align: center;
}

#boot-screen h2 {
  margin: 0 0 10px 0;
  font-size: clamp(22px, 3.5vw, 30px);
}

#boot-screen p {
  margin: 0;
  color: var(--muted);
}


.auth-box {
  width: min(560px, 100%);
  background: linear-gradient(180deg, rgba(16, 24, 38, 0.9), rgba(16, 24, 38, 0.65));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 26px 20px;
  text-align: center;
}

.auth-box h1 {
  font-size: clamp(26px, 4vw, 36px);
  margin-bottom: 10px;
}

.auth-box p {
  font-size: 15px;
  margin-bottom: 18px;
}

#google-login-btn {
  width: 100%;
  height: var(--btn-h);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.95), rgba(124, 92, 255, 0.7));
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

#google-login-btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

#google-login-btn:active {
  transform: translateY(0px) scale(0.99);
}

#google-login-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-soft), var(--focus);
}

/* --------- App Screen Layout --------- */
#app-screen {
  align-items: stretch;
  justify-content: flex-start;
  padding: 18px 14px 22px;
}

.app-header,
.game-panel,
.app-footer {
  width: min(var(--maxw), 100%);
  margin-inline: auto;
}

.app-header {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(16, 24, 38, 0.85), rgba(16, 24, 38, 0.6));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  margin-bottom: 14px;
}

/* Header - profile */
.profile-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  object-fit: cover;
}

#user-name {
  font-size: 18px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

#user-level {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* Header - XP */
.xp-box {
  width: min(340px, 45%);
  text-align: right;
}

.xp-box p {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--muted);
}

.xp-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

#xp-progress {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

/* --------- Main Panel --------- */
.game-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding-bottom: 14px;
}

/* --------- Generator Section --------- */
.generator-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.85), rgba(18, 28, 44, 0.55));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

#generate-btn,
#reroll-btn {
  height: var(--btn-h);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.2px;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
  box-shadow: var(--shadow-soft);
}

#generate-btn {
  background: linear-gradient(180deg, rgba(39, 224, 163, 0.95), rgba(39, 224, 163, 0.65));
}

#reroll-btn {
  background: linear-gradient(180deg, rgba(124, 92, 255, 0.95), rgba(124, 92, 255, 0.65));
}

#generate-btn:hover,
#reroll-btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

#generate-btn:active,
#reroll-btn:active {
  transform: translateY(0px) scale(0.99);
}

#generate-btn:focus-visible,
#reroll-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-soft), var(--focus);
}

/* --------- Challenge Card --------- */
.challenge-card {
  padding: 16px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.9), rgba(15, 23, 38, 0.7));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* subtle glow */
.challenge-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  background:
    radial-gradient(600px 280px at 20% 10%, rgba(124, 92, 255, 0.18), transparent 55%),
    radial-gradient(600px 280px at 85% 20%, rgba(39, 224, 163, 0.12), transparent 60%);
  pointer-events: none;
}

.challenge-card > * {
  position: relative;
}

.challenge-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

#challenge-category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  font-size: 13px;
  color: rgba(234, 240, 255, 0.92);
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#challenge-level {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 800;
  font-size: 13px;
}

#challenge-title {
  font-size: clamp(22px, 3.6vw, 30px);
  margin-bottom: 10px;
}

.challenge-time {
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--muted);
}

.challenge-time span {
  color: rgba(234, 240, 255, 0.95);
  font-weight: 800;
}

/* --------- Steps --------- */
.steps-box {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  padding: 14px;
  margin-bottom: 14px;
}

.steps-box h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

#steps-list {
  display: grid;
  gap: 10px;
}

/* Checkbox row */
#steps-list li {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

#steps-list li:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

/* label styling */
#steps-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  color: rgba(234, 240, 255, 0.92);
  font-weight: 650;
}

/* checkbox styling (simple but big) */
#steps-list input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent-2);
}

/* When checked, we’ll rely on JS to add a class, but also support :has if available */
@supports selector(li:has(input:checked)) {
  #steps-list li:has(input:checked) {
    background: rgba(39, 224, 163, 0.10);
    border-color: rgba(39, 224, 163, 0.22);
  }
  #steps-list li:has(input:checked) label {
    color: rgba(234, 240, 255, 0.96);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(39, 224, 163, 0.55);
  }
}

/* --------- Complete Button --------- */
.complete-box {
  display: grid;
  gap: 10px;
}

#complete-btn {
  height: var(--btn-h);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.95), rgba(255, 176, 32, 0.6));
  color: #0b0f14;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

#complete-btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

#complete-btn:active {
  transform: translateY(0px) scale(0.99);
}

#complete-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-soft), var(--focus);
}

/* --------- Stats Section --------- */
.stats-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.85), rgba(18, 28, 44, 0.55));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 14px;
}

.stat-card h3 {
  font-size: 14px;
  color: rgba(234, 240, 255, 0.9);
  margin-bottom: 6px;
}

.stat-card p {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: rgba(234, 240, 255, 0.96);
}

/* --------- Badges Section --------- */
.badges-section {
  padding: 14px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.85), rgba(18, 28, 44, 0.55));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.badges-section h3 {
  margin-bottom: 10px;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* Badge card (JS will inject) */
.badges-grid .badge {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  min-height: 84px;
  display: grid;
  gap: 6px;
  align-content: start;
}

.badges-grid .badge .badge-title {
  font-weight: 900;
  color: rgba(234, 240, 255, 0.96);
}

.badges-grid .badge .badge-desc {
  font-size: 12px;
  color: var(--muted);
}

/* Locked vs unlocked */
.badges-grid .badge.locked {
  opacity: 0.6;
  filter: grayscale(0.35);
}

.badges-grid .badge.unlocked {
  border-color: rgba(39, 224, 163, 0.22);
  background: rgba(39, 224, 163, 0.08);
}

/* --------- History Section --------- */
.history-section {
  padding: 14px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(18, 28, 44, 0.85), rgba(18, 28, 44, 0.55));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.history-section h3 {
  margin-bottom: 10px;
}

#history-list {
  display: grid;
  gap: 10px;
}

/* History item (JS injected) */
#history-list li {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  display: grid;
  gap: 6px;
}

#history-list .hist-top {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

#history-list .hist-title {
  font-weight: 900;
  color: rgba(234, 240, 255, 0.96);
}

#history-list .hist-meta {
  font-size: 12px;
  color: var(--muted);
}

/* --------- Footer --------- */
.app-footer {
  margin-top: 10px;
  padding: 0 2px;
}

#logout-btn {
  width: min(420px, 100%);
  margin-inline: auto;
  display: block;
  height: 50px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(234, 240, 255, 0.92);
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

#logout-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

#logout-btn:active {
  transform: translateY(0px) scale(0.99);
}

#logout-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-soft), var(--focus);
}

/* --------- Responsive Enhancements --------- */
@media (min-width: 740px) {
  .generator-section {
    grid-template-columns: 1fr 1fr;
  }

  .stats-section {
    grid-template-columns: repeat(3, 1fr);
  }

  .badges-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .app-header {
    padding: 16px 18px;
  }

  #user-avatar {
    width: 52px;
    height: 52px;
    border-radius: 18px;
  }
}

@media (min-width: 980px) {
  .badges-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .challenge-card {
    padding: 18px;
  }
}

/* --------- Reduced Motion (ADHD-friendly option) --------- */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
