:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #192235;
  background: #eef2f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: clamp(18px, 4vw, 48px);
  background:
    radial-gradient(ellipse at 12% 0%, rgb(209 224 255 / 75%), transparent 38%),
    #eef2f8;
}

.editor-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
}

.home-shell {
  width: min(720px, 100%);
  margin: clamp(24px, 8vh, 90px) auto 0;
  position: relative;
  z-index: 1;
}

body:has(.home-shell) {
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background: #020906;
  color: #c8ffd5;
}

body:has(.home-shell)::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 35%, rgb(0 40 18 / 25%), transparent 58%),
    repeating-linear-gradient(180deg, transparent 0 3px, rgb(47 255 119 / 3%) 4px 5px),
    #020906;
  content: "";
  pointer-events: none;
}

#matrix-rain {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.78;
  pointer-events: none;
}

.home-shell .page-header {
  margin-bottom: 28px;
}

.home-intro {
  margin: 14px 0 0;
  color: #c8ffd5;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  text-shadow: 0 1px 8px #020906, 0 0 12px rgb(39 255 101 / 24%);
}

.home-shell h1 {
  color: #65ff8b;
  text-shadow: 0 0 18px rgb(39 255 101 / 45%);
}

.home-options {
  display: grid;
  gap: 12px;
}

.home-option {
  display: flex;
  min-height: 82px;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid #14542b;
  border-radius: 6px;
  background: rgb(3 18 9 / 72%);
  color: #d8ffe0;
  text-decoration: none;
  box-shadow: 0 10px 28px rgb(31 48 82 / 5%);
}

a.home-option {
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

a.home-option:hover {
  transform: translateY(-2px);
  border-color: #35fa70;
  box-shadow: 0 0 24px rgb(36 255 93 / 20%);
}

a.home-option:focus-visible {
  outline: 3px solid #9aafff;
  outline-offset: 3px;
}

.option-number {
  color: #43fa76;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.option-copy {
  display: grid;
  flex: 1;
  gap: 4px;
}

.option-copy strong {
  font-size: 1rem;
}

.option-copy small {
  color: #82b893;
  font-size: 0.82rem;
}

.option-arrow {
  color: #43fa76;
  font-size: 1.4rem;
}

.option-unavailable {
  color: #73917b;
  background: rgb(3 13 7 / 72%);
  border-color: #193c24;
}

.option-unavailable .option-number {
  color: #55745d;
}

.option-status {
  padding: 5px 9px;
  border-radius: 999px;
  background: #102619;
  color: #82b893;
  font-size: 0.72rem;
  font-weight: 700;
}

.page-header {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #5269a8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
  align-items: start;
  gap: 24px;
}

.canvas-panel,
.controls-panel {
  border: 1px solid #e0e6f0;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 44px rgb(31 48 82 / 8%);
}

.canvas-panel {
  min-width: 0;
  padding: clamp(20px, 2.6vw, 30px);
}

.drawing-help,
.section-help {
  margin: 0;
  color: #6a7589;
  font-size: 0.88rem;
  line-height: 1.5;
}

.drawing-help {
  margin-bottom: 16px;
}

.skin-labels {
  display: flex;
  width: 100%;
  margin: 0 auto 8px;
  color: #7a8495;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}

.skin-labels span {
  width: 50%;
}

#drawing-board {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 34 / 32;
  border: 1px solid #d8deea;
  border-radius: 8px;
  background: #fff;
  cursor: crosshair;
  touch-action: none;
}

.controls-panel {
  display: grid;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.control-section {
  padding: 22px;
  border: 1px solid #e0e6f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgb(31 48 82 / 6%);
}

.control-section h2 {
  margin: 0 0 5px;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.section-help {
  margin-bottom: 13px;
  font-size: 0.82rem;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.color-swatch {
  width: 31px;
  height: 31px;
  margin: 2px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: 0 0 0 1px #cbd4e3;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.color-swatch[data-color="#202a44"] { --swatch-color: #202a44; }
.color-swatch[data-color="#e45858"] { --swatch-color: #e45858; }
.color-swatch[data-color="#f2ad45"] { --swatch-color: #f2ad45; }
.color-swatch[data-color="#44a879"] { --swatch-color: #44a879; }
.color-swatch[data-color="#526fd1"] { --swatch-color: #526fd1; }
.color-swatch[data-color="#a866c5"] { --swatch-color: #a866c5; }

.color-swatch:hover {
  transform: scale(1.08);
}

.color-swatch.selected {
  box-shadow: 0 0 0 2px #405fca;
}

.color-swatch:focus-visible,
.custom-color:focus-within,
.jersey-number:focus-visible,
.action-button:focus-visible {
  outline: 3px solid #9aafff;
  outline-offset: 3px;
}

.custom-color {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 2px;
  color: #566176;
  font-size: 0.82rem;
  cursor: pointer;
}

.custom-color input {
  width: 34px;
  height: 34px;
  padding: 3px;
  border: 1px solid #d3dbe8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.jersey-number-label {
  display: block;
  margin: 12px 0 7px;
  color: #566176;
  font-size: 0.84rem;
  font-weight: 650;
}

.jersey-number-label span,
.number-hint {
  color: #8490a2;
  font-size: 0.76rem;
  font-weight: 400;
}

.jersey-number {
  display: block;
  width: 100%;
  max-width: 120px;
  padding: 10px 12px;
  border: 1px solid #ccd5e3;
  border-radius: 9px;
  background: #fbfcfe;
  color: #192235;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.number-hint {
  display: block;
  margin-top: 7px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.jersey-field {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid #edf0f5;
}

.jersey-field h3 {
  margin: 0;
  font-size: 0.9rem;
}

.action-button {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 750;
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
}

.action-button:hover {
  filter: brightness(0.94);
  transform: translateY(-1px);
}

.inter-button {
  background: linear-gradient(110deg, #111318 0 48%, #2468b5 48% 100%);
}

.milan-button {
  background: linear-gradient(110deg, #c8102e 0 48%, #111318 48% 100%);
}

.juve-button {
  background: linear-gradient(110deg, #111318 0 42%, #f3f3f0 42% 58%, #111318 58% 100%);
  text-shadow: 0 1px 2px #111;
}

.lazio-button {
  background: linear-gradient(110deg, #81c9e8 0 48%, #fff 48% 100%);
  color: #173a61;
}

.roma-button {
  background: linear-gradient(110deg, #8e1b3a 0 78%, #d8ac42 78% 100%);
}

.napoli-button {
  background: linear-gradient(110deg, #1684ce 0 78%, #fff 78% 100%);
}

.fiorentina-button {
  background: linear-gradient(110deg, #56318c 0 78%, #fff 78% 100%);
}

.como-button {
  background: linear-gradient(110deg, #075ca8 0 78%, #fff 78% 100%);
}

.save-button {
  display: block;
  width: min(280px, 100%);
  min-height: 48px;
  margin: 20px 0 0 auto;
  background: #2563eb;
  box-shadow: 0 5px 12px rgb(37 99 235 / 22%);
}

.save-button:hover {
  background: #1d4ed8;
  filter: none;
}

@media (max-width: 760px) {
  body {
    padding: 18px 14px 28px;
  }

  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .page-header {
    margin-bottom: 16px;
  }

  .controls-panel {
    gap: 14px;
  }

  .save-button {
    width: 100%;
    margin-top: 16px;
  }
}

@media (max-width: 420px) {
  .canvas-panel {
    padding: 14px;
  }

  .control-section {
    padding: 18px;
  }

  .controls-panel {
    gap: 10px;
  }

  .team-grid {
    gap: 7px;
  }

  .action-button {
    padding-inline: 8px;
  }
}
