:root {
  --bg: #050914;
  --panel: #10182d;
  --panel2: #16213d;
  --line: #34537a;
  --text: #fff8e8;
  --muted: #b8c7df;
  --gold: #ffd84d;
  --green: #48d98b;
  --red: #ff5f6d;
  --orange: #ffae42;
  --pink: #d96cff;
  --blue: #42c7ff;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: Inter, system-ui, Segoe UI, Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(to bottom, rgba(5, 9, 20, 0) 0 620px, #050914 820px),
    url("images/background.png") top center / 100% auto no-repeat,
    #050914;
}

/* HEADER */

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
  background: rgba(5, 9, 20, 0.9);
  border-bottom: 2px solid rgba(255, 216, 77, 0.18);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  min-width: 0;
}

.logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  flex-shrink: 0;
  filter:
    drop-shadow(0 0 8px rgba(255,216,77,.45))
    drop-shadow(0 4px 8px rgba(0,0,0,.4));
}

.brand:hover .logo {
  transform: rotate(-5deg) scale(1.05);
  transition: .2s ease;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-title {
  font-size: 24px;
  font-weight: 950;
  color: #fff8e8;
  letter-spacing: .5px;
  text-shadow:
    0 3px 0 #1b2450,
    0 0 12px rgba(255,216,77,.25);
}

.brand:hover .brand-title {
  color: #ffe382;
  transition: .2s ease;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffd84d;
  margin-top: 4px;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar nav a {
  color: #ffeaa0;
  text-decoration: none;
  font-weight: 900;
  font-size: 14px;
  text-shadow: 0 2px 0 #000;
  white-space: nowrap;
}

.topbar nav a:hover {
  color: #fff;
}

/* PAGE HERO SPACING */

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 470px 20px 70px;
  position: relative;
}

main::before {
  content: "Visit the Coding Kingdom";
  position: absolute;
  top: 300px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff3b0;
  font-weight: 950;
  font-size: 34px;
  letter-spacing: 2px;
  text-align: center;
  text-shadow:
    0 4px 0 #3b1b58,
    0 0 18px rgba(255, 216, 77, 0.75);
  animation: floatTitle 3s ease-in-out infinite;
  pointer-events: none;
  width: 90%;
}

@keyframes floatTitle {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-10px);
  }
}

/* PANELS */

.hero,
.panel {
  border: 2px solid rgba(255, 216, 77, 0.22);
  background:
    linear-gradient(180deg, rgba(20, 33, 61, 0.92), rgba(9, 15, 31, 0.95));
  border-radius: 22px;
  padding: 28px;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.hero {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: center;
}

.eyebrow {
  color: var(--gold);
  letter-spacing: 4px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000;
}

.title {
  font-size: 46px;
  line-height: .95;
  margin: 12px 0;
  color: #fff8e8;
  text-shadow: 0 4px 0 #1b2450;
}

.subtitle {
  color: #dcecff;
  line-height: 1.65;
}

.stats {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pill {
  border: 2px solid rgba(255, 216, 77, 0.25);
  background: linear-gradient(180deg, #263b66, #172340);
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
}

.progressbar {
  height: 13px;
  background: #273858;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
}

.progressfill {
  height: 100%;
  background: linear-gradient(90deg, #ffd84d, #48d98b, #42c7ff);
  width: 0;
}

/* CATEGORY CARDS */

.section-title {
  font-size: 36px;
  margin: 36px 0 8px;
  color: #fff8e8;
  text-shadow: 0 3px 0 #1b2450;
}

.category-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 28px;
}

.category-card {
  min-height: 220px;
  border-radius: 24px;
  padding: 24px;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(20, 33, 61, 0.96), rgba(9, 15, 31, 0.96));
  border: 2px solid rgba(255, 216, 77, 0.22);
  color: var(--text);
  box-shadow:
    0 14px 45px rgba(0,0,0,.35),
    inset 0 0 0 1px rgba(255,255,255,.06);
}

.category-card:hover {
  transform: translateY(-5px);
  filter: brightness(1.1);
}

.category-card-icon {
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}

.category-card h2 {
  margin: 0 0 10px;
  font-size: 28px;
  text-shadow: 0 3px 0 #1b2450;
}

.category-card p {
  color: #d8e7ff;
  line-height: 1.5;
  min-height: 52px;
}

/* CATEGORY PAGE */

.category {
  margin-top: 32px;
}

.category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.category h2 {
  font-size: 30px;
  margin: 0;
  color: #fff8e8;
  text-shadow: 0 3px 0 #1b2450;
}

.category p {
  color: #d8e7ff;
  margin: 8px 0 0;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-title-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 5px 6px rgba(0, 0, 0, 0.45));
}

.level-row {
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 13, 28, 0.72);
  border-radius: 18px;
  margin: 12px 0;
  padding: 14px;
  display: grid;
  grid-template-columns: 105px 1fr;
  gap: 12px;
  align-items: center;
}

.level-label {
  font-weight: 950;
  color: #ffe382;
  text-shadow: 0 2px 0 #000;
}

.quest-squares {
  display: grid;
  grid-template-columns: repeat(5, minmax(82px, 1fr));
  gap: 10px;
}

.q-square {
  position: relative;
  min-height: 74px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  text-align: left;
  padding: 10px;
  font-weight: 950;
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,.16),
    0 8px 0 rgba(0,0,0,.18);
  transition: .15s transform, .15s filter;
}

.q-square:hover {
  transform: translateY(-3px);
  filter: brightness(1.12);
}

.q-square.locked,
.q-square.completed.locked {
  opacity: .34;
  cursor: not-allowed;
  filter: grayscale(.5);
}

.q-square .small {
  display: block;
  font-size: 11px;
  opacity: .9;
  margin-top: 4px;
  font-weight: 850;
}

.q-square .mark {
  position: absolute;
  right: 9px;
  bottom: 7px;
}

.easy {
  background: linear-gradient(135deg, #138d55, #55df99);
}

.medium {
  background: linear-gradient(135deg, #c66f16, #ffbf5e);
}

.hard {
  background: linear-gradient(135deg, #ad2337, #ff6b7a);
}

.premiumGrad {
  background: linear-gradient(135deg, #5f3bd5, #d65ee6);
}

.completed {
  outline: 3px solid rgba(255,255,255,.45);
}

/* BUTTONS */

button,
.btn {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe56c, #ffb02e);
  color: #271500;
  font-weight: 950;
  padding: 11px 16px;
  text-decoration: none;
  box-shadow: 0 5px 0 #8a4d00;
}

button:hover,
.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.btn.secondary,
button.secondary {
  background: linear-gradient(180deg, #263b66, #172340);
  color: #fff;
  border: 1px solid #4f6f9d;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* QUEST */

.quest-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}

.quest-title {
  font-size: 38px;
  margin: 8px 0;
  text-shadow: 0 3px 0 #1b2450;
}

.story {
  line-height: 1.75;
  color: #e7f0ff;
  font-size: 17px;
}

.task {
  background: #07101f;
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 18px;
  line-height: 1.6;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}

.tab {
  background: #172340;
  color: #fff;
  border: 1px solid #4f6f9d;
}

.tab.active {
  background: linear-gradient(180deg, #ffe56c, #ffb02e);
  color: #271500;
}

.editor {
  width: 100%;
  min-height: 330px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #030712;
  color: #f7f0ff;
  padding: 18px;
  font-family: Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}

.result {
  border-radius: 16px;
  padding: 14px;
  margin-top: 14px;
  background: #07101f;
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.pass {
  color: #61e79e;
  font-weight: 950;
}

.fail {
  color: #ff7887;
}

.side-card {
  border: 1px solid var(--line);
  background: rgba(14, 24, 47, 0.92);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
}

.side-card h3 {
  margin-top: 0;
}

.hint {
  display: none;
  color: #f4dcff;
  line-height: 1.6;
}

.hint.show {
  display: block;
}

.muted {
  color: var(--muted);
}

.daily-card {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,216,77,.13), rgba(66,199,255,.1));
  border-radius: 24px;
  padding: 26px;
}

.warning {
  background: rgba(255,107,122,.12);
  border: 1px solid rgba(255,107,122,.35);
  padding: 14px;
  border-radius: 16px;
  color: #ffdce0;
}

.footer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* AUTH / INPUTS */

.grid2,
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 20px;
}

.input {
  width: 100%;
  display: block;
  margin: 10px 0;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #07101f;
  color: #fff;
  font-weight: 700;
}

.input::placeholder {
  color: #7d91ad;
}

.codebox {
  background: #030712;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  overflow: auto;
  color: #f7f0ff;
}

.auth-panel h2 {
  margin-bottom: 8px;
}

.paypal-box {
  margin: 18px 0;
  max-width: 460px;
}

.panel code {
  color: #ffe382;
}

.danger {
  background: linear-gradient(135deg, #ef4444, #991b1b);
  color: white;
}

/* TABLET */

@media (max-width: 1050px) {
  .category-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  main {
    padding-left: 22px;
    padding-right: 22px;
  }
}

/* MOBILE */

@media (max-width: 850px) {
  body {
    background:
      linear-gradient(to bottom, rgba(5, 9, 20, 0) 0 470px, #050914 690px),
      url("images/background.png") top center / auto 470px no-repeat,
      #050914;
  }

  .topbar {
    position: relative;
    top: auto;
    min-height: auto;
    height: auto;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .brand {
    width: 100%;
    justify-content: center;
    gap: 10px;
  }

  .logo {
    width: 42px;
    height: 42px;
  }

  .brand-title {
    font-size: 22px;
  }

  .brand-subtitle {
    font-size: 10px;
    letter-spacing: 1.5px;
  }

  .topbar nav {
    width: 100%;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
  }

  .topbar nav a {
    font-size: 14px;
  }

  main {
    padding: 360px 15px 60px;
  }

  main::before {
    top: 235px;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: 1px;
    width: 92%;
  }

  .hero,
  .panel {
    padding: 22px;
    border-radius: 20px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .title {
    font-size: 36px;
  }

  .stats {
    gap: 9px;
  }

  .pill {
    padding: 8px 11px;
    font-size: 13px;
  }

  .section-title {
    font-size: 30px;
    margin-top: 30px;
  }

  .category-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .category-card {
    min-height: 190px;
    padding: 16px;
    border-radius: 18px;
  }

  .category-card-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 10px;
  }

  .category-card h2 {
    font-size: 22px;
  }

  .category-card p {
    font-size: 12px;
    min-height: 48px;
  }

  .category-title-icon {
    width: 34px;
    height: 34px;
  }

  .category-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .grid2,
  .auth-grid,
  .quest-layout {
    grid-template-columns: 1fr;
  }

  .level-row {
    grid-template-columns: 1fr;
  }

  .quest-squares {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .q-square {
    min-height: 72px;
  }

  .quest-title {
    font-size: 32px;
  }

  .editor {
    min-height: 260px;
    font-size: 14px;
  }
}

/* SMALL PHONES */

@media (max-width: 480px) {
  body {
    background:
      linear-gradient(to bottom, rgba(5, 9, 20, 0) 0 430px, #050914 640px),
      url("images/background.png") top center / auto 430px no-repeat,
      #050914;
  }

  main {
    padding: 330px 14px 55px;
  }

  main::before {
    top: 215px;
    font-size: 28px;
  }

  .brand-title {
    font-size: 20px;
  }

  .topbar nav {
    gap: 13px;
  }

  .topbar nav a {
    font-size: 13px;
  }

  .title {
    font-size: 32px;
  }

  .category-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-card {
    min-height: 180px;
    padding: 14px;
  }

  .category-card h2 {
    font-size: 20px;
  }

  .category-card p {
    font-size: 11px;
  }

  .quest-squares {
    grid-template-columns: 1fr;
  }
}

/* VERY SMALL PHONES */

@media (max-width: 360px) {
  .category-card-grid {
    grid-template-columns: 1fr;
  }

  main::before {
    font-size: 24px;
  }

  .topbar nav a {
    font-size: 12px;
  }
}