:root {
  color-scheme: dark;
  --bg: #050915;
  --panel: rgba(16, 22, 41, 0.85);
  --text: #f4f4f6;
  --muted: #a1a5b5;
  --accent: #39c6ff;
  --accent-strong: #ff8d6b;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 25px 60px rgba(5, 8, 15, 0.45);
  font-size: clamp(14px, 1.2vw, 16px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, #172c61, #050915 55%);
  color: var(--text);
  min-height: 100vh;
}

main.app-shell {
  padding: clamp(1.5rem, 3vw, 3.5rem);
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  text-align: left;
  max-width: 820px;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.brand-strip {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.brand-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.lede {
  color: var(--muted);
  line-height: 1.6;
}

.panel.layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  padding: clamp(1.25rem, 2vw, 2rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

h1,
h2 {
  margin-top: 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
}

input[type='number'],
input[type='text'] {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: inherit;
}

input[type='range'] {
  accent-color: var(--accent);
  width: 100%;
}

.field-with-indicator {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.field-with-indicator input[type='range'] {
  flex: 1;
}

.field-with-indicator input[type='number'] {
  width: 90px;
  text-align: right;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
}

.metric__label {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric__value {
  font-size: 1.4rem;
  font-weight: 600;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), #7f8dff);
  box-shadow: 0 15px 25px rgba(57, 198, 255, 0.3);
}

button.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

button:not(:disabled):hover {
  transform: translateY(-2px);
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.session {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.timer {
  font-size: clamp(2.5rem, 7vw, 3.8rem);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.status {
  color: var(--muted);
  min-height: 1.5rem;
}

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

.countdown-hint {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  min-height: 1.2rem;
}

.progress-wrapper {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 0.2s ease;
}

.session-data {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.session-data p {
  margin: 0;
}

.session-data .label {
  color: var(--muted);
  font-size: 0.85rem;
}

.info ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.5;
}

.legal-page {
  gap: 1.5rem;
}

.legal-content {
  color: var(--muted);
  line-height: 1.6;
}

.legal-content h2,
.legal-content h3 {
  color: var(--text);
  margin-top: 1.5rem;
}

.legal-content h2:first-child {
  margin-top: 0;
}

.legal-content p {
  margin: 0 0 0.75rem;
}

.legal-content ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.legal-content li {
  margin-bottom: 0.4rem;
}

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

.legal-content a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .field-with-indicator {
    flex-direction: column;
    align-items: flex-start;
  }

  .cta-group {
    flex-direction: column;
  }
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.5rem 1rem 2rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

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

.site-footer a:hover {
  text-decoration: underline;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-btn.active {
  background: var(--accent);
  color: #041628;
}

.lang-switch--compact {
  padding: 0.25rem;
}

.lang-switch--compact .lang-btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.7rem;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 20, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 999;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
  overflow-y: auto;
}

.auth-overlay[aria-hidden='true'] {
  pointer-events: none;
  opacity: 0;
}

.auth-modal-shell {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-overlay-bar {
  width: 100%;
  align-self: stretch;
}

.auth-overlay-bar .brand-logo {
  width: 48px;
  height: 48px;
}

.auth-card {
  max-width: 520px;
  width: 100%;
  background: rgba(12, 18, 33, 0.95);
  border-radius: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45);
}

.auth-header {
  text-align: left;
  margin-bottom: 1.25rem;
}

.auth-lede {
  color: var(--muted);
  line-height: 1.5;
  margin: 0.35rem 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
}

.form-grid input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-size: 0.95rem;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.auth-disclaimer {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
}

.auth-message {
  min-height: 1.2rem;
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  color: var(--text);
}

.auth-message.error {
  color: #ff8d6b;
}

.auth-message.success {
  color: var(--accent);
}

.auth-stage.hidden {
  display: none;
}

.auth-actions.space-between {
  justify-content: space-between;
  gap: 0.75rem;
}

#login-form label span {
  font-weight: 500;
}

#login-form input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.7rem 0.9rem;
  color: var(--text);
  margin-top: 0.35rem;
}


.required-indicator {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: 0.25rem;
}

@media (max-height: 650px) {
  main.app-shell {
    padding: 1rem;
    gap: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .hero {
    gap: 0.75rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-overlay {
    padding: 1rem;
    align-items: flex-start;
  }

  .auth-modal-shell {
    gap: 0.75rem;
  }

  .auth-card {
    padding: 1.25rem;
  }

  .auth-overlay-bar.top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 820px) and (orientation: landscape) {
  main.app-shell {
    padding: 1.25rem;
  }

  .panel.layout {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .cta-group {
    flex-direction: row;
    gap: 0.5rem;
  }

  .auth-card {
    padding: 1.25rem;
  }
}
