:root {
  /* Softer, charcoal-ish base + same neon teal accent */
  --bg: #05070a;
  --bg-elevated: #0b0f12;
  --card: #11151a;
  --card-soft: #171b21;
  --border: rgba(148, 163, 184, 0.22);

  --accent: #22e6a8;         /* neon teal/green */
  --accent-soft: rgba(34, 230, 168, 0.16);
  --accent-strong: #2dd4bf;

  --text: #e5e7eb;
  --muted: #9ca3af;

  --danger: #f97373;
  --danger-soft: rgba(248, 113, 113, 0.12);

  --radius-lg: 14px;
  --radius-pill: 12px; /* squarer, still rounded */

  --shadow-soft: 0 20px 45px rgba(0, 0, 0, 0.6);
  --shadow-header: 0 14px 30px rgba(0, 0, 0, 0.9);

  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}


/* Reset-ish */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--sans);
  background:
    radial-gradient(circle at top, #101623, #05070a 60%) fixed,
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}


/* Layout shell */

.app-shell {
  min-height: 100vh;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */

/* Make brand clearly left + aligned */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  /* keep your existing background/border/shadow here */
}

/* Brand row */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Bigger logo, not tiny */
.brand-logo {
  width: 80px;   /* bump size up */
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(34, 230, 168, 0.55);
}

/* Optional: slightly tighter brand text */
.brand-text h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}





.logo-dot {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background:
    radial-gradient(circle at 25% 20%, #f5f5f4, #a16207 40%, var(--accent) 100%);
  box-shadow:
    0 0 0 1px rgba(250, 250, 249, 0.08),
    0 0 18px rgba(34, 230, 168, 0.7);
}



.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Main & footer */

.app-main {
  flex: 1;
  margin-top: 4px;
}

.app-footer {
  text-align: center;
  margin-top: 10px;
  color: var(--muted);
}

/* Card */

.card {
  background: linear-gradient(145deg, var(--card), #05070a);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px 16px 14px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top left, rgba(34, 230, 168, 0.06), transparent 60%);
  opacity: 0.75;
}


.card > * {
  position: relative;
  z-index: 1;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Typography */

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

.small {
  font-size: 0.94rem;
}

.tiny {
  font-size: 0.78rem;
}

.mono {
  font-family: var(--mono);
}

/* Links */

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Buttons */

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.small-btn {
  padding: 7px 14px; /* taller buttons */
  font-size: 0.8rem;
  border-radius: var(--radius-pill); /* squarer, still rounded */
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.08s ease,
    box-shadow 0.1s ease,
    color 0.12s ease,
    opacity 0.12s ease;
}

.small-btn:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.small-btn:focus-visible {
  outline: 2px solid rgba(34, 230, 168, 0.7);
  outline-offset: 2px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: rgba(34, 230, 168, 0.7);
  color: #052e1c;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.85);
}

.primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.7);
}

.ghost {
  border-color: rgba(250, 250, 249, 0.08);
  background: #141310;
}

.ghost:hover:not(:disabled) {
  background: #1f1d17;
  border-color: rgba(250, 250, 249, 0.14);
}

.ghost:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

/* Layout grid */

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr);
  gap: 24px; /* breathing room between modules */
}

.auth-and-main {
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 24px;
}

.left-column,
.right-column,
.auth-column,
.main-view {
  min-width: 0;
}

/* Extra vertical spacing between cards inside columns */
.right-column .card + .card,
.left-column .card + .card,
.auth-column .card + .card,
.profile-grid .card + .card {
  margin-top: 18px;
}

/* In the main puzzle area, space modules vertically */
.puzzle-inner > * + * {
  margin-top: 18px;
}

@media (max-width: 880px) {
  .layout-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-and-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Forms */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

label {
  font-size: 0.78rem;
  color: var(--muted);
}

input,
textarea {
  border-radius: 10px;
  border: 1px solid rgba(250, 250, 249, 0.08);
  background: #0d0c0a;
  color: var(--text);
  font-size: 0.86rem;
  padding: 7px 9px;
  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(161, 161, 170, 0.8);
}

input:focus,
textarea:focus {
  border-color: rgba(34, 230, 168, 0.85);
  box-shadow: 0 0 0 1px rgba(34, 230, 168, 0.5);
  background: #050403;
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: var(--mono);
  line-height: 1.4;
}

.form-error {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 4px;
}

/* Auth */

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.auth-form {
  margin-top: 12px;
}

.full-width {
  width: 100%;
}

.divider {
  margin: 14px 0;
  border: none;
  border-top: 1px solid rgba(250, 250, 249, 0.06);
}

/* Code editor toolbar */

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.timer-pill {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(250, 250, 249, 0.08);
  background: #0f0e0b;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
}

/* Badge */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(250, 250, 249, 0.12);
  background: #141310;
}

.badge.green {
  border-color: rgba(34, 230, 168, 0.9);
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

/* User chip */

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(250, 250, 249, 0.12);
  background: #141310;
  cursor: pointer;
  font-size: 0.8rem;
}

.user-chip:hover {
  border-color: rgba(34, 230, 168, 0.7);
}

/* Leaderboard / tables */

.leaderboard-summary-list {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  table-layout: fixed; /* keeps within card */
}

.leaderboard-summary-list th,
.leaderboard-summary-list td {
  padding: 4px 6px;
  text-align: left;
  font-size: 0.78rem;
  border-bottom: 1px solid rgba(39, 39, 42, 0.9);
  white-space: normal;       /* allow wrapping */
  word-break: break-word;    /* prevent overflow from long text */
}

.leaderboard-summary-list th {
  font-weight: 500;
  color: rgba(228, 228, 231, 0.9);
  background: #141310;
}

.leaderboard-summary-list tbody tr:nth-child(even) {
  background-color: #11100d;
}

.leaderboard-summary-list tbody tr:hover {
  background-color: #1f1d17;
}

.highlight-current {
  background: rgba(34, 230, 168, 0.12);
}

/* Overlay (paywall, code viewer, modals) */
.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(10, 14, 20, 0.96), rgba(3, 5, 8, 0.94));
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.overlay-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(145deg, #11151a, #05070a 60%, #020308);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 16px 16px 12px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.overlay-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at top left, rgba(34, 230, 168, 0.18), transparent 55%);
}

.puzzle-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  background: radial-gradient(circle at center, rgba(10, 13, 19, 0.95), rgba(3, 5, 8, 0.96));
  z-index: 10;
  text-align: center;
  padding: 24px;
}


/* Make code/solution modals larger */
#code-modal .overlay-card,
#solution-modal .overlay-card {
  max-width: 760px;
  width: min(760px, 100% - 32px);
}

/* Code modal body = large scrollable area */
.code-modal-body {
  max-height: 70vh;
  overflow: auto;
  margin-top: 8px;
  padding: 8px;
  border-radius: 10px;
  background: #050403;
  border: 1px solid rgba(250, 250, 249, 0.14);
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
}

/* Overlay button group */

.overlay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Profile */

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1.2fr);
  gap: 24px; /* separation between profile cards */
}

@media (max-width: 880px) {
  .profile-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-stat-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.profile-stat-value {
  font-size: 1.1rem;
}

/* Puzzle lock overlay */

.main-view {
  position: relative;
}

.puzzle-inner.blurred {
  filter: blur(6px);
  pointer-events: none;
}


.big-start-btn {
  padding: 18px 36px;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 600;
}

.puzzle-overlay-text {
  max-width: 380px;
  text-align: center;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
}

/* Brand row */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Bigger logo, no glow */
.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: contain;   /* keep logo proportions */
  flex-shrink: 0;
  box-shadow: none;      /* remove neon glow */
  background: transparent;
}

/* Simple brand title next to logo */
.brand-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Remove unused logo-dot style if you want, or just leave it */
.logo-dot {
  display: none;
}

/* Right side of header */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 18px;
}

/* just the logo on the left */
.brand {
  display: flex;
  align-items: center;
}

/* MUCH larger logo, no glow */
.brand-logo {
  width: 110px;
  height: 110px;
  border-radius: 24px;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: none;        /* remove green aura */
  background: transparent; /* in case */
}

/* no header brand text anymore */
.brand-text {
  display: none;
}



/* Utilities */

.hidden {
  display: none !important;
}
