@font-face {
  font-family: 'Nunito';
  src: url('font/Nunito-Regular.ttf') format('truetype');
  font-weight: 400;
}

@font-face {
  font-family: 'Nunito';
  src: url('font/Nunito-Bold.ttf') format('truetype');
  font-weight: 700;
}

:root {
  color-scheme: dark;
  --bg: #020309;
  --bg-accent: #050a16;
  --card: rgba(8, 11, 22, 0.9);
  --card-border: rgba(255, 255, 255, 0.04);
  --text: #f5f7ff;
  --text-muted: #c1c9f0;
  --accent: #7c5dff;
  --accent-strong: #5b35f2;
  --accent-soft: rgba(124, 93, 255, 0.2);
  --error: #f87171;
  font-size: 16px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(124, 93, 255, 0.3), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(0, 140, 255, 0.25), transparent 50%),
    linear-gradient(180deg, #050712 0%, #010204 100%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.65;
  z-index: 0;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  width: 40vw;
  height: 40vw;
  max-width: 620px;
  max-height: 620px;
  background: radial-gradient(circle, rgba(124, 93, 255, 0.35), transparent 60%);
  filter: blur(40px);
  top: -10%;
  right: -5%;
  z-index: 0;
  pointer-events: none;
}

.page {
  width: 100%;
  max-width: 1280px;
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  align-items: stretch;
  position: relative;
  z-index: 1;
}

.card {
  background: linear-gradient(180deg, rgba(12, 17, 34, 0.95) 0%, rgba(6, 10, 20, 0.92) 100%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(4, 7, 14, 0.35);
  backdrop-filter: blur(12px);
}

.card__body {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card--intro {
  grid-column: span 2;
}

.card--preview {
  grid-column: span 1;
  align-self: start;
}

@media (max-width: 1100px) {
  .card--intro {
    grid-column: span 1;
  }
}

.card--full {
  grid-column: 1 / -1;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2rem, 2.1rem + 0.8vw, 2.8rem);
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.125rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-muted);
}

.intro-copy {
  max-width: 460px;
}

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

.form__label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.form__secondary-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: flex-start;
}

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

.form__turnstile {
  border: 1px solid rgba(148, 163, 209, 0.35);
  border-radius: 14px;
  padding: 0.95rem;
  margin-top: 0.35rem;
  background: rgba(8, 13, 24, 0.6);
}

.turnstile-container {
  min-height: 70px;
}

.turnstile-status {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: var(--text-muted);
}

.turnstile-status[data-tone="success"] {
  color: #22c55e;
}

.turnstile-status[data-tone="warning"] {
  color: #fbbf24;
}

.turnstile-status[data-tone="error"] {
  color: #f87171;
}

.support-banner {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(11, 16, 30, 0.8);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.support-banner__text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}

.support-banner__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}

input[type="text"],
input[type="url"],
input[type="password"] {
  flex: 1 1 220px;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 209, 0.35);
  background: rgba(4, 8, 18, 0.7);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 209, 0.35);
  background: rgba(4, 8, 18, 0.7);
  color: var(--text);
  font-size: 0.95rem;
}

.service-select {
  position: relative;
  width: 100%;
}

.service-fields {
  padding: 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 209, 0.35);
  background: rgba(5, 9, 18, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.service-fields__description {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
}

.service-fields__hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.service-select__toggle {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 209, 0.35);
  background: rgba(4, 8, 18, 0.7);
  color: var(--text);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.service-select__toggle:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.service-select__current {
  font-weight: 600;
}

.service-select__chevron {
  transition: transform 0.2s ease;
}

.service-select.is-open .service-select__chevron {
  transform: rotate(180deg);
}

.service-select__menu {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  background: rgba(6, 9, 18, 0.96);
  border: 1px solid rgba(148, 163, 209, 0.25);
  border-radius: 12px;
  padding: 0.35rem;
  list-style: none;
  margin: 0;
  box-shadow: 0 25px 45px rgba(5, 8, 16, 0.45);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}

.service-select.is-open .service-select__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.service-select__option {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.service-select__option:hover,
.service-select__option.is-active {
  background: rgba(99, 102, 241, 0.18);
}

.service-select__option--disabled {
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
}

.service-select__tooltip {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translate(110%, -50%);
  background: rgba(7, 11, 20, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--text);
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.service-select__option--disabled:hover .service-select__tooltip {
  opacity: 1;
}

.artwork-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.artwork-source {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 209, 0.18);
  background: rgba(4, 8, 16, 0.6);
}

.artwork-source__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.artwork-source__option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--text);
}

.artwork-source__option.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.artwork-source__option.is-disabled input {
  pointer-events: none;
}

.artwork-source__option input[type="radio"] {
  accent-color: var(--accent);
}

.artwork-controls__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.artwork-controls__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.artwork-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  border: 1px dashed rgba(148, 163, 209, 0.35);
  border-radius: 14px;
  padding: 0.85rem;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.artwork-editor__control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.artwork-editor__control input[type="range"] {
  accent-color: var(--accent);
}

.artwork-editor[aria-disabled="true"] {
  opacity: 0.5;
  border-color: rgba(148, 163, 209, 0.18);
  pointer-events: none;
}

.card--repo .card__body {
  gap: 1rem;
}

.card--purpose .card__body,
.card--about .card__body,
.card--counter .card__body {
  gap: 1rem;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  width: fit-content;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.link-button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.counter__value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
}

.counter__hint,
.counter__since {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.card--purpose .card__body,
.card--about .card__body,
.card--counter .card__body {
  gap: 1rem;
}

.counter__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #f8fafc;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.35);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(67, 56, 202, 0.45);
}

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

.btn--secondary {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.btn--ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 209, 0.35);
  color: var(--text);
  box-shadow: none;
}

.btn--ghost:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.form__secondary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

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

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

.status-message {
  font-size: 0.95rem;
  color: var(--text-muted);
}

canvas {
  width: min(420px, 100%);
  height: auto;
  border-radius: 24px;
  background: rgba(4, 9, 18, 0.65);
  border: 1px solid rgba(124, 93, 255, 0.18);
  box-shadow: 0 16px 32px rgba(5, 7, 14, 0.4);
  display: block;
  margin: 0 auto;
}

.results {
  gap: 1.75rem;
}

.results__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.results__grid > div {
  flex: 1 1 220px;
  min-width: 200px;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 209, 0.2);
  border-radius: 14px;
  background: rgba(5, 9, 18, 0.6);
}

.results__grid p {
  font-size: 1.05rem;
  color: var(--text);
  white-space: pre-line;
  font-variant-numeric: tabular-nums;
}

.body--not-found {
  align-items: center;
}

.page--not-found {
  width: min(860px, 100%);
}

.not-found__body {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  align-items: center;
}

.not-found__content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.not-found__code {
  font-size: clamp(4rem, 8vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  background: linear-gradient(135deg, var(--accent) 0%, #38bdf8 80%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.not-found__lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 28rem;
}

.error-message {
  font-size: 1.05rem;
  color: var(--text);
}

.not-found__action {
  align-self: flex-start;
}

.not-found__art {
  display: flex;
  justify-content: center;
}

.vinyl {
  width: clamp(200px, 35vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(48% 48% at 50% 50%, rgba(15, 23, 42, 0.75) 0%, rgba(10, 14, 24, 0.95) 45%, #020617 90%);
  border: 1px solid rgba(148, 163, 209, 0.25);
  box-shadow: 0 25px 55px rgba(4, 7, 14, 0.45);
  overflow: hidden;
}

.vinyl::before {
  content: '';
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 209, 0.18);
  opacity: 0.8;
}

.vinyl::after {
  content: '';
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

@media (max-width: 900px) {
  .not-found__body {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .not-found__content {
    align-items: center;
  }

  .not-found__action {
    align-self: center;
  }

  .not-found__lead {
    max-width: 32rem;
  }
}

@media (max-width: 768px) {
  body {
    padding: 2rem 1rem 3rem;
  }

  .page {
    grid-template-columns: 1fr;
  }

  .card__body {
    padding: 1.75rem;
  }

  .card--intro,
  .card--purpose,
  .card--about,
  .card--repo,
  .card--counter {
    grid-column: 1 / -1;
  }

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

  select {
    width: 100%;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .artwork-editor {
    grid-template-columns: 1fr;
  }

  canvas {
    width: 100%;
  }
}
