/* =========================================================================
   AlphaPet Design System — Capture the Vibe
   ========================================================================= */

:root {
  /* ---- Primary palette ---- */
  --primary-blue: #60C5E6;
  --primary-dark: #162F47;
  --gradient-start: #162F47;
  --gradient-mid: #346C8798;
  --gradient-end: #60C5E600;

  /* ---- Utility / system colors ---- */
  --white: #ffffff;
  --gray-100: #f3f4f6;
  --gray-300: #d1d5db;
  --red-500: #ef4444;

  /* Legacy alias retained from prior revision (rose link accent) */
  --link-a36: #a36;

  /* ---- Typography ---- */
  --font-family: 'Open Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-light: 300;
  --font-normal: 400;
  --font-bold: 700;
  --font-normal-style: normal;
  --font-italic-style: italic;

  /* ---- Spacing / layout ---- */
  --gap-base: 3rem;        /* gap-12 */
  --gap-large: 5rem;       /* lg:gap-20 */
  --padding-xs: 0.5rem;    /* py-2 */
  --padding-md: 3rem;      /* pr-12 */
  --padding-lg: 5rem;      /* pr-20 */
  --padding-item: 1.5rem;  /* mb-6 */

  /* ---- Transitions ---- */
  --transition-fast: 300ms;
  --transition-medium: 500ms;
  --transition-easing: ease-out;

  /* ---- Transform scales ---- */
  --scale-active-x: 1.25;
  --scale-active-y: 2.5;

  /* ---- Shadows & effects ---- */
  --text-shadow-accent: 0.09rem 0 0 #60C5E6;
  --hero-gradient: linear-gradient(90deg,
    #162F47 0%,
    #346C8798 68%,
    #4690AD5B 92%,
    #54ACCB2B 96%,
    #60C5E600 100%);

  /* ---- Layout / heights ---- */
  --header-height: 6.25rem;
  --min-viewport-height: 50vh;
  --max-width-mobile: 90%;
  --max-width-md: 70%;
  --max-width-lg: 60%;
  --max-width-xl: 50%;

  /* ---- Z-index ---- */
  --z-base: 0;
  --z-overlay: 1;
  --z-header: 10;

  /* ---- Borders / outlines ---- */
  --border-base: 1px;
  --border-thick: 2px;
  --border-outline: 2px;
  --border-radius: 14px;
  --border-radius-full: 9999px;
  --outline-offset: 10px;

  /* ---- List markers ---- */
  --list-marker-svg: url('data:image/svg+xml,<svg viewBox="0 0 13 12" width="10" height="14" xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="6" r="6" fill="%2360C5E6"/></svg>');

  /* ---- Table ---- */
  --table-cell-padding: 0.5rem 0.25rem;

  /* ---- Misc helpers ---- */
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);
  --line-on-dark: rgba(96, 197, 230, 0.22);
  --fill-on-dark: rgba(255, 255, 255, 0.08);
  --text-muted: rgba(255, 255, 255, 0.68);
  --text-dim: rgba(255, 255, 255, 0.45);
}

/* =========================================================================
   Base
   ========================================================================= */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  font-weight: var(--font-normal);
  font-style: var(--font-normal-style);
  font-size: 16px;
  line-height: 1.5;
  color: var(--white);
  background: var(--primary-dark);
  min-height: 100%;
}

body {
  background:
    var(--hero-gradient) no-repeat,
    var(--primary-dark);
  background-size: 140% 70%, auto;
  background-position: -20% 0, 0 0;
}

h1, h2, h3 { margin: 0; font-weight: var(--font-bold); }
h1 { font-size: 28px; }
h2 { font-size: 26px; }
h3 { font-size: 16px; }

.font-bold { font-weight: var(--font-bold); }
.font-light { font-weight: var(--font-light); }
.italic { font-style: var(--font-italic-style); }

a {
  color: var(--link-a36);
  text-decoration-color: var(--link-a36);
  text-underline-offset: 3px;
  transition: filter var(--transition-fast) var(--transition-easing);
}
a:hover { filter: brightness(1.2); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: var(--border-outline) solid var(--primary-blue);
  outline-offset: var(--outline-offset);
}

/* Custom list bullets for any prose <ul> */
ul.prose,
.prose ul {
  list-style: none;
  padding-left: 1.5rem;
}
ul.prose li,
.prose ul li {
  position: relative;
}
ul.prose li::before,
.prose ul li::before {
  content: '';
  position: absolute;
  left: -1.25rem;
  top: 0.55em;
  width: 10px;
  height: 10px;
  background: var(--list-marker-svg) no-repeat center / contain;
}

/* =========================================================================
   Comment board
   ========================================================================= */

.board {
  max-width: 680px;
  margin: 48px auto;
  padding: 0 20px 80px;
}
.board__header {
  margin-bottom: var(--padding-item);
}
.board__header h1 {
  font-size: 28px;
  font-weight: var(--font-bold);
  margin: 0 0 6px;
  color: var(--primary-blue);
  text-shadow: var(--text-shadow-accent);
}
.board__tag {
  margin: 0 0 var(--padding-item);
  color: var(--text-muted);
  font-size: 16px;
}

.comment-form {
  background: rgba(22, 47, 71, 0.85);
  border: var(--border-base) solid var(--line-on-dark);
  border-radius: var(--border-radius);
  padding: 18px;
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 10px;
}
.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--primary-dark);
  border: var(--border-base) solid var(--line-on-dark);
  border-radius: 10px;
  color: var(--white);
  font: inherit;
  font-size: 16px;
  font-weight: var(--font-normal);
  resize: vertical;
  transition: border-color var(--transition-fast) var(--transition-easing);
}
.comment-form input::placeholder,
.comment-form textarea::placeholder { color: var(--text-dim); }
.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--primary-blue);
  outline: var(--border-outline) solid var(--primary-blue);
  outline-offset: 2px;
}
.comment-form__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.comment-form button {
  padding: 10px 18px;
  background: var(--primary-blue);
  color: var(--primary-dark);
  border: 0;
  border-radius: var(--border-radius-full);
  font-weight: var(--font-bold);
  font-size: 16px;
  cursor: pointer;
  transition:
    filter var(--transition-fast) var(--transition-easing),
    transform var(--transition-fast) var(--transition-easing);
  box-shadow: 0 4px 14px rgba(96, 197, 230, 0.35);
}
.comment-form button:hover { filter: brightness(1.08); }
.comment-form button:active { filter: brightness(0.95); }
.form-status { color: var(--text-muted); font-size: 16px; }
.form-status.is-error { color: var(--red-500); font-weight: var(--font-bold); }

.feed { margin-top: 28px; }
.feed__title {
  font-size: 16px;
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary-blue);
  margin: 0 0 10px;
}
.feed__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.feed__item {
  background: rgba(22, 47, 71, 0.85);
  border: var(--border-base) solid var(--line-on-dark);
  border-radius: var(--border-radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-medium) var(--transition-easing);
}
.feed__meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.feed__name {
  font-weight: var(--font-bold);
  font-size: 16px;
  color: var(--primary-blue);
}
.feed__time { color: var(--text-muted); font-size: 16px; }
.feed__body { white-space: pre-wrap; line-height: 1.45; font-size: 16px; }
.feed__empty {
  color: var(--text-muted);
  font-size: 16px;
  font-style: var(--font-italic-style);
  padding: 18px;
  text-align: center;
  border: var(--border-base) dashed var(--line-on-dark);
  border-radius: var(--border-radius);
}

/* =========================================================================
   Leaderboard
   ========================================================================= */

.lb-body { background: var(--primary-dark); }
.lb {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 24px 80px;
}
.lb__header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
  padding: var(--padding-xs) var(--padding-xs);
  background: var(--hero-gradient);
  border-radius: var(--border-radius);
  min-height: 5rem;
  padding-left: 1.5rem;
  padding-right: 1rem;
}
.lb__header h1 {
  font-size: 28px;
  font-weight: var(--font-bold);
  margin: 0;
  color: var(--white);
  text-shadow: var(--text-shadow-accent);
}
.lb__sub {
  color: var(--gray-300);
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: var(--font-light);
}
.lb__timer {
  text-align: right;
  background: rgba(22, 47, 71, 0.65);
  padding: 10px 18px;
  border-radius: var(--border-radius);
  border: var(--border-base) solid var(--line-on-dark);
}
.lb__timer-label {
  font-size: 16px;
  font-weight: var(--font-normal);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gray-300);
}
.lb__timer-value {
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: var(--font-bold);
  color: var(--primary-blue);
  text-shadow: var(--text-shadow-accent);
}
.lb__actions button {
  background: transparent;
  color: var(--white);
  border: var(--border-thick) solid var(--primary-blue);
  padding: 10px 20px;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  font-weight: var(--font-bold);
  font-size: 16px;
  transition:
    background-color var(--transition-fast) var(--transition-easing),
    color var(--transition-fast) var(--transition-easing);
}
.lb__actions button:hover {
  background: var(--primary-blue);
  color: var(--primary-dark);
}

.hints { display: grid; gap: 8px; margin-bottom: 16px; }
.hint {
  background: rgba(22, 47, 71, 0.85);
  border-left: var(--border-thick) solid var(--primary-blue);
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--white);
  font-size: 16px;
  font-weight: var(--font-normal);
}
.hint strong { font-weight: var(--font-bold); color: var(--primary-blue); }
.hint--medium { border-left-color: var(--primary-blue); }
.hint--hard { border-left-color: var(--link-a36); }
.hint--hard strong { color: var(--link-a36); }

.lb__table-wrap {
  background: rgba(22, 47, 71, 0.85);
  border: var(--border-base) solid var(--line-on-dark);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.lb__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
.lb__table thead th {
  background: rgba(96, 197, 230, 0.08);
  text-align: left;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: var(--font-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-blue);
  border-bottom: var(--border-base) solid var(--line-on-dark);
}
.lb__table tbody td {
  padding: 14px 18px;
  border-bottom: var(--border-base) solid var(--line-on-dark);
  font-size: 16px;
  font-weight: var(--font-normal);
}
.lb__table tbody tr:last-child td { border-bottom: 0; }
.col-rank {
  width: 70px;
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  font-weight: var(--font-bold);
  color: var(--primary-blue);
}
.col-name {
  font-weight: var(--font-bold);
  font-size: 16px;
  color: var(--white);
}
.col-points {
  font-weight: var(--font-bold);
  font-variant-numeric: tabular-nums;
  width: 100px;
  font-size: 26px;
  color: var(--primary-blue);
  text-shadow: var(--text-shadow-accent);
}
.col-time {
  width: 90px;
  color: var(--gray-300);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
}
.col-tiers { width: 150px; }
.row--demo { opacity: 0.55; font-style: var(--font-italic-style); }
.demo-tag {
  color: var(--gray-300);
  font-size: 16px;
  font-weight: var(--font-light);
  font-style: var(--font-italic-style);
}
.lb__empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 16px;
  font-style: var(--font-italic-style);
}
.row {
  animation: pop var(--transition-medium) var(--transition-easing);
  transition: background-color var(--transition-medium) var(--transition-easing);
}
@keyframes pop {
  from { background-color: rgba(96, 197, 230, 0.22); }
  to   { background-color: transparent; }
}

.tier {
  display: inline-block;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  line-height: 28px;
  text-align: center;
  font-weight: var(--font-bold);
  font-size: 16px;
  margin-right: 4px;
  border: var(--border-base) solid var(--line-on-dark);
  transition: transform var(--transition-fast) var(--transition-easing);
}
.tier--off { background: transparent; color: var(--text-dim); }
.tier--on { color: var(--primary-dark); }
.tier--easy.tier--on {
  background: var(--white);
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
}
.tier--medium.tier--on {
  background: var(--primary-blue);
  color: var(--primary-dark);
  box-shadow: 0 0 14px rgba(96, 197, 230, 0.5);
}
.tier--hard.tier--on {
  background: var(--link-a36);
  color: var(--white);
  box-shadow: 0 0 14px rgba(170, 51, 102, 0.5);
}

/* =========================================================================
   Activity log
   ========================================================================= */

.activity {
  margin-top: 28px;
  background: rgba(22, 47, 71, 0.85);
  border: var(--border-base) solid var(--line-on-dark);
  border-radius: var(--border-radius);
  padding: 18px 20px;
}
.activity h2 {
  font-size: 26px;
  font-weight: var(--font-bold);
  color: var(--primary-blue);
  margin: 0 0 12px;
  text-shadow: var(--text-shadow-accent);
}
.activity__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: var(--font-normal);
}
.activity__item {
  padding: var(--table-cell-padding);
  border-bottom: var(--border-base) dashed var(--line-on-dark);
  display: grid;
  grid-template-columns: 90px 60px auto 1fr;
  gap: 10px;
  align-items: baseline;
}
.activity__time { color: var(--gray-300); }
.activity__method {
  font-weight: var(--font-bold);
  color: var(--primary-blue);
}
.activity__path { color: var(--white); word-break: break-all; }
.activity__name {
  color: var(--link-a36);
  font-weight: var(--font-bold);
}
.activity__outcome {
  color: var(--text-muted);
  grid-column: 1 / -1;
  padding-left: 90px;
  font-size: 16px;
}
.activity__empty {
  color: var(--text-muted);
  font-size: 16px;
  font-style: var(--font-italic-style);
  padding: 10px;
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 768px) {
  .lb__header { grid-template-columns: 1fr; }
  .lb__table { font-size: 16px; }
  .col-rank, .col-points { font-size: 26px; }
  .activity__item { grid-template-columns: 1fr; }
  .activity__outcome { padding-left: 0; }
  .board { margin: 24px auto; }
}

/* =========================================================================
   Print
   ========================================================================= */

@media print {
  body {
    background: none;
    color: black;
  }
  .lb__actions,
  .hints,
  .activity,
  .comment-form,
  #admin-btn { display: none !important; }
  .lb__header,
  .lb__table-wrap,
  .feed__item {
    background: none;
    box-shadow: none;
    border: 1px solid black;
  }
  .lb__header h1,
  .col-rank,
  .col-points,
  .lb__timer-value,
  .activity h2,
  .board__header h1 {
    color: black;
    text-shadow: none;
  }
  .lb { margin-top: 0; padding-top: 2rem; min-height: 12rem; }
}
