:root {
  --bg-base: #0F0D1B;
  --bg-surface: #1F1B2C;
  --text-primary: #C3C7DB;
  --accent-primary: #A855F7;
  --accent-secondary: #7C3AED;
  --text-on-accent: #FFFFFF;
  --border-subtle: #2D2A3E;

  --font-heading: 'Press Start 2P', monospace;
  --font-body: 'Inter', sans-serif;

  --text-display: 2.5rem;
  --text-h1: 2rem;
  --text-h2: 1.5rem;
  --text-h3: 1.25rem;
  --text-body: 1rem;
  --text-small: 0.875rem;

  --leading-display: 1.2;
  --leading-heading: 1.3;
  --leading-body: 1.6;
  --leading-small: 1.5;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  --container-max: 1200px;
  --container-pad: var(--space-lg);

  --radius-button: 2px;
  --radius-card: 4px;
  --radius-panel: 0px;

  --border-pixel: 2px solid var(--border-subtle);
  --glow-accent: 0 0 12px rgba(168, 85, 247, 0.35);
  --glow-accent-strong: 0 0 18px rgba(168, 85, 247, 0.55);
  --shadow-surface: 0 2px 8px rgba(0, 0, 0, 0.35);

  --transition-fast: 0.2s ease;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  min-width: 320px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: var(--leading-heading);
  color: var(--text-primary);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

h1 {
  font-size: clamp(1.5rem, 4vw, var(--text-h1));
  margin-block-end: var(--space-lg);
}

h2 {
  font-size: clamp(1.25rem, 3vw, var(--text-h2));
  margin-block-end: var(--space-md);
}

h3 {
  font-size: clamp(1.1rem, 2.5vw, var(--text-h3));
  margin-block-end: var(--space-md);
}

h4,
h5,
h6 {
  font-size: var(--text-body);
  margin-block-end: var(--space-sm);
}

.display {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 5vw, var(--text-display));
  line-height: var(--leading-display);
  margin-block-end: var(--space-lg);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

p {
  margin-block-end: var(--space-md);
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

ul,
ol {
  margin-block-end: var(--space-md);
  padding-inline-start: var(--space-lg);
}

li {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

blockquote {
  margin-block-end: var(--space-md);
  padding-inline-start: var(--space-lg);
  border-inline-start: 2px solid var(--accent-primary);
  color: var(--text-primary);
  font-style: italic;
}

figure {
  margin-block-end: var(--space-md);
}

figcaption {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-start: var(--space-xs);
  color: var(--text-primary);
  opacity: 0.8;
}

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

a:hover {
  color: var(--accent-secondary);
}

a:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

img,
video {
  object-fit: cover;
}

hr {
  border: none;
  border-block-start: 2px solid var(--border-subtle);
  margin-block: var(--space-xl);
}

strong,
b {
  font-weight: 600;
}

em,
i {
  font-style: italic;
}

small {
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

code,
kbd,
samp,
pre {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

pre {
  background-color: var(--bg-surface);
  border: var(--border-pixel);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  overflow-x: auto;
  margin-block-end: var(--space-md);
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

mark {
  background-color: var(--accent-secondary);
  color: var(--text-on-accent);
  padding: 0 var(--space-xs);
}

sub,
sup {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

address {
  font-style: normal;
  margin-block-end: var(--space-md);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--wide {
  max-width: 1400px;
}

.surface {
  background-color: var(--bg-surface);
  border: var(--border-pixel);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-surface);
  padding: var(--space-lg);
}

.surface--panel {
  border-radius: var(--radius-panel);
}

.surface--flat {
  box-shadow: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-heading);
  font-size: var(--text-small);
  line-height: 1.4;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-button);
  background-color: var(--accent-primary);
  color: var(--text-on-accent);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 44px;
  min-height: 44px;
}

.btn:hover {
  background-color: var(--accent-secondary);
  border-color: var(--accent-secondary);
  color: var(--text-on-accent);
  box-shadow: var(--glow-accent);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.btn--secondary {
  background-color: transparent;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn--secondary:hover {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
  box-shadow: var(--glow-accent);
}

.btn--ghost {
  background-color: transparent;
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn--ghost:hover {
  background-color: var(--bg-surface);
  border-color: var(--accent-secondary);
  color: var(--accent-primary);
  box-shadow: none;
}

.btn--small {
  font-size: 0.75rem;
  padding: var(--space-xs) var(--space-sm);
  min-height: 36px;
}

.btn--large {
  font-size: var(--text-body);
  padding: var(--space-md) var(--space-lg);
  min-height: 52px;
}

input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

input,
select,
textarea {
  width: 100%;
  background-color: var(--bg-base);
  color: var(--text-primary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-button);
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--accent-secondary);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--glow-accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-primary);
  opacity: 0.5;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23C3C7DB' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-inline-end: var(--space-xl);
}

label {
  display: block;
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-end: var(--space-xs);
  color: var(--text-primary);
}

fieldset {
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-lg);
  margin-block-end: var(--space-md);
}

legend {
  font-family: var(--font-heading);
  font-size: var(--text-small);
  padding-inline: var(--space-sm);
  color: var(--text-primary);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-block-end: var(--space-md);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

th,
td {
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-subtle);
  text-align: start;
  vertical-align: top;
}

th {
  font-family: var(--font-heading);
  font-weight: 400;
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

caption {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-end: var(--space-sm);
  color: var(--text-primary);
  opacity: 0.8;
  text-align: start;
}

.flex {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  min-width: 0;
}

.flex > * {
  min-width: 0;
  flex-shrink: 1;
}

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

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

.flex--align-start {
  align-items: flex-start;
}

.flex--align-center {
  align-items: center;
}

.flex--align-end {
  align-items: flex-end;
}

.flex--justify-start {
  justify-content: flex-start;
}

.flex--justify-center {
  justify-content: center;
}

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

.flex--justify-between {
  justify-content: space-between;
}

.flex--gap-xs {
  gap: var(--space-xs);
}

.flex--gap-sm {
  gap: var(--space-sm);
}

.flex--gap-md {
  gap: var(--space-md);
}

.flex--gap-lg {
  gap: var(--space-lg);
}

.flex--gap-xl {
  gap: var(--space-xl);
}

.flex--gap-2xl {
  gap: var(--space-2xl);
}

.flex--gap-3xl {
  gap: var(--space-3xl);
}

.grid {
  display: grid;
  gap: var(--space-md);
  min-width: 0;
}

.grid > * {
  min-width: 0;
  flex-shrink: 1;
}

.grid--gap-xs {
  gap: var(--space-xs);
}

.grid--gap-sm {
  gap: var(--space-sm);
}

.grid--gap-md {
  gap: var(--space-md);
}

.grid--gap-lg {
  gap: var(--space-lg);
}

.grid--gap-xl {
  gap: var(--space-xl);
}

.grid--gap-2xl {
  gap: var(--space-2xl);
}

.grid--gap-3xl {
  gap: var(--space-3xl);
}

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

.grid--auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

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

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid--2,
.grid--3,
.grid--4 {
  width: 100%;
}

.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 10000;
  background-color: var(--accent-primary);
  color: var(--text-on-accent);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-button);
  font-family: var(--font-heading);
  font-size: var(--text-small);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

::selection {
  background-color: var(--accent-secondary);
  color: var(--text-on-accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 768px) {
  :root {
    --container-pad: var(--space-md);
  }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  .grid--auto-fit,
  .grid--auto-fill {
    grid-template-columns: 1fr;
  }

  .surface {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  :root {
    --container-pad: var(--space-sm);
  }

  .btn {
    width: 100%;
  }

  .btn--small {
    width: auto;
  }
}