/* Stockle — dark theme aligned to style guide + Stock Markit mockup */
:root {
  --blue: #66a3ff;
  --green: #006600;
  --lime: #1ac41a;
  --lime-hover: #15a815;
  --black: #000000;
  --white: #ffffff;
  --bg: #0a0c10;
  --bg-elevated: #12151c;
  --bg-header: #0d0f14;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f2f4f8;
  --text-muted: #a8b0c0;
  --radius: 8px;
  --radius-pill: 999px;
  --max-width: 720px;
  --header-height: 4rem;
  --font-heading: "Noto Serif", Georgia, serif;
  --font-body: "Noto Sans", "Helvetica Neue", sans-serif;
}

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 60% at 50% 20%, rgba(102, 163, 255, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 80%, rgba(26, 196, 26, 0.08), transparent 50%),
    linear-gradient(180deg, #0b1220 0%, var(--bg) 45%, #050608 100%);
  background-attachment: fixed;
  animation: bg-drift 18s ease-in-out infinite;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--lime);
  text-decoration: underline;
}

a:hover,
a:focus-visible {
  color: var(--blue);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--white);
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  margin-bottom: 0.75rem;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
  max-width: 40rem;
  color: var(--text-muted);
}

ul,
ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--lime);
  color: var(--black);
  padding: 0.5rem 1rem;
  font-weight: 700;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 15, 20, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-height);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand:hover,
.brand:focus-visible {
  color: var(--white);
  text-decoration: none;
}

.brand:hover .brand-mark-icon,
.brand:focus-visible .brand-mark-icon {
  filter: brightness(1.15);
}

.brand-mark-icon {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 0.4rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}

.site-nav {
  width: 100%;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  color: inherit;
}

.site-nav.is-open ul {
  display: flex;
}

.site-nav a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(102, 163, 255, 0.12);
  color: var(--white);
}

.site-nav a[aria-current="page"] {
  color: var(--lime);
}

.user-chip {
  font-size: 0.85rem;
  color: var(--text-muted);
  order: 3;
}

.header-actions {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.btn-login {
  background: var(--lime);
  color: var(--black) !important;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.55rem 1.15rem !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  white-space: nowrap;
}

.btn-login:hover,
.btn-login:focus-visible {
  background: var(--lime-hover);
  color: var(--black) !important;
}

@media (min-width: 860px) {
  .nav-toggle {
    display: none;
  }

  .header-inner {
    flex-wrap: nowrap;
  }

  .site-nav {
    width: auto;
    flex: 1;
    display: flex;
    justify-content: center;
  }

  .site-nav ul {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.15rem;
  }

  .site-nav .nav-login-mobile {
    display: none;
  }

  .header-actions {
    display: flex;
    margin-left: 0;
  }

  .user-chip {
    order: 0;
    margin-right: 0.35rem;
  }
}

@media (max-width: 859px) {
  .header-actions {
    display: none;
  }
}

/* Main */
.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.site-main--wide {
  max-width: 900px;
}

.site-main--home {
  max-width: none;
  padding: 0;
}

/* Hero — full-bleed, mockup-like */
.hero {
  position: relative;
  text-align: center;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem 5rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 55% at 50% 40%, rgba(20, 40, 80, 0.55), transparent 70%),
    linear-gradient(180deg, transparent 60%, var(--bg) 100%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 40rem;
  animation: hero-rise 0.85s ease-out both;
}

.hero h1 {
  font-family: var(--font-body);
  font-size: clamp(2.1rem, 7vw, 3.5rem);
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero .tagline {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: rgba(242, 244, 248, 0.88);
  margin: 0 auto 2rem;
  max-width: 32rem;
  line-height: 1.55;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.hero .btn-hero {
  font-size: 1.05rem;
  padding: 0.95rem 1.75rem;
  border-radius: var(--radius);
  min-width: min(100%, 18rem);
}

.how-band {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.how-band h2 {
  text-align: center;
  font-family: var(--font-body);
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  text-decoration: none;
}

.btn-primary {
  background: var(--lime);
  color: var(--black);
  border-color: var(--lime);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--lime-hover);
  border-color: var(--lime-hover);
  color: var(--black);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(26, 196, 26, 0.25);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--blue);
  color: var(--white);
  background: rgba(102, 163, 255, 0.12);
}

.btn-accent {
  background: var(--blue);
  color: var(--black);
  border-color: var(--blue);
}

.btn-accent:hover,
.btn-accent:focus-visible {
  background: #4d8ef0;
  color: var(--black);
}

.btn-block {
  width: 100%;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 28rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label,
.form-field legend {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="search"] {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--white);
}

.form-field input::placeholder {
  color: #6b7385;
}

.form-field input:focus {
  border-color: var(--blue);
}

.form-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.form-error {
  color: #ff6b7a;
  font-size: 0.9rem;
  margin: 0;
}

.form-success {
  color: var(--lime);
  font-size: 0.9rem;
  margin: 0;
}

fieldset.form-field {
  border: none;
  padding: 0;
  margin: 0;
}

/* Direction toggle */
.direction-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.direction-option {
  position: relative;
}

.direction-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.direction-option label {
  display: block;
  text-align: center;
  padding: 1rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.direction-option input:focus-visible + label {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.direction-option input:checked + label.up {
  border-color: var(--lime);
  background: rgba(26, 196, 26, 0.15);
  color: var(--lime);
}

.direction-option input:checked + label.down {
  border-color: #ff6b7a;
  background: rgba(255, 107, 122, 0.1);
  color: #ff8a96;
}

/* Autocomplete */
.autocomplete-wrap {
  position: relative;
}

.suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 50;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 14rem;
  overflow-y: auto;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  color: inherit;
}

.suggestions:empty,
.suggestions[hidden] {
  display: none;
}

.suggestions li button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.65rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
}

.suggestions li button:hover,
.suggestions li button:focus-visible,
.suggestions li button[aria-selected="true"] {
  background: rgba(102, 163, 255, 0.18);
}

.suggestions .ticker-sym {
  font-weight: 700;
  color: var(--lime);
  margin-right: 0.5rem;
}

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.tab-btn {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
}

.tab-btn[aria-selected="true"] {
  background: var(--lime);
  color: var(--black);
}

.tab-btn:hover:not([aria-selected="true"]) {
  background: rgba(102, 163, 255, 0.15);
  color: var(--white);
}

/* Leaderboard */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.leaderboard th,
.leaderboard td {
  text-align: left;
  padding: 0.7rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.leaderboard th {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--lime);
}

.leaderboard tr.is-you {
  background: rgba(102, 163, 255, 0.12);
  font-weight: 600;
}

.score-pos {
  color: var(--lime);
  font-weight: 700;
}

.score-neg {
  color: #ff6b7a;
  font-weight: 700;
}

.your-place {
  background: var(--bg-elevated);
  border: 1px solid rgba(102, 163, 255, 0.45);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.your-place p {
  margin-bottom: 0;
  color: var(--text);
}

.your-place strong {
  color: var(--white);
}

/* FAQ */
.faq-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.faq-list > li {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.faq-list > li:last-child {
  border-bottom: none;
}

.faq-list h2 {
  font-size: 1.2rem;
  font-family: var(--font-body);
}

.faq-list p {
  color: var(--text-muted);
}

/* Auth panels */
.auth-panels {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .auth-panels {
    grid-template-columns: 1fr 1fr;
  }
}

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.panel h2 {
  color: var(--white);
  font-family: var(--font-body);
}

.status-banner {
  background: rgba(102, 163, 255, 0.12);
  border-left: 4px solid var(--blue);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.status-banner p {
  color: var(--text);
  margin-bottom: 0.5rem;
}

.status-banner p:last-child {
  margin-bottom: 0;
}

.status-banner.warn {
  background: rgba(255, 107, 122, 0.1);
  border-left-color: #ff6b7a;
}

.status-banner.ok {
  background: rgba(26, 196, 26, 0.12);
  border-left-color: var(--lime);
}

/* Footer */
.site-footer {
  background: #050608;
  color: var(--text-muted);
  padding: 1.5rem 1.25rem;
  margin-top: auto;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.footer-inner p {
  margin: 0;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--lime);
  text-decoration: underline;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--blue);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bg-drift {
  0%,
  100% {
    background-position: 50% 20%, 80% 80%, 0 0;
  }
  50% {
    background-position: 48% 24%, 82% 76%, 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-inner,
  body,
  .btn-primary {
    animation: none !important;
  }
}

/* Scoring details */
.score-help {
  margin: 0 0 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.score-help summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--white);
  list-style: none;
}

.score-help summary::-webkit-details-marker {
  display: none;
}

.score-help summary::before {
  content: "+ ";
  color: var(--lime);
  font-weight: 700;
}

.score-help[open] summary::before {
  content: "− ";
}

.score-help .score-help-body {
  margin-top: 0.85rem;
  color: var(--text-muted);
}

.score-help .example-box {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: rgba(102, 163, 255, 0.08);
  border-left: 3px solid var(--lime);
}

.score-help .example-box p {
  margin-bottom: 0.4rem;
  max-width: none;
}

.form-stack.is-locked {
  opacity: 0.85;
}

.form-field select,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--white);
}

.form-field textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.survey-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.survey-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--white);
}

.survey-details .survey-fields {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.player-link {
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgba(26, 196, 26, 0.5);
}

.player-link:hover,
.player-link:focus-visible {
  color: var(--lime);
}

.profile-header {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--lime);
  background: var(--bg-elevated);
}

.profile-avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--lime);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.stats-strip > div {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.table-wrap {
  overflow-x: auto;
}

.avatar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

#avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.privacy-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}

.privacy-table th,
.privacy-table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.privacy-table th {
  color: var(--lime);
  font-family: var(--font-heading);
}

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.toggle-row input {
  margin-top: 0.35rem;
}

.panel + .panel {
  margin-top: 0;
}
