@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Luckiest+Guy&display=swap");

:root {
  --ink: #111;
  --paper: #fff;
  --soft: #f4f4f4;
  --line: #d8d8d8;
  --muted: #666;
  --success: #177245;
  --danger: #9f1d1d;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12px 12px, #202020 3px, transparent 4px) 0 0 / 32px 32px,
    #000;
  color: var(--paper);
  font-family: "Fredoka", Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(360px, 1.18fr);
  min-height: 100vh;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
  background: var(--ink);
  color: var(--paper);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stud-logo {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 3px solid var(--paper);
  border-radius: 8px;
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.18);
  font-weight: 800;
  font-size: 26px;
}

.stud-logo.has-image {
  overflow: hidden;
  background: var(--paper);
}

.stud-logo img,
.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 6px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: "Luckiest Guy", "Fredoka", Arial, sans-serif;
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 400;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 30px;
}

h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.preview-stage {
  display: grid;
  place-items: center;
  gap: 10px;
}

.preview-instruction {
  margin: 0;
  color: var(--paper);
  font-weight: 800;
  text-align: center;
}

.preview-card {
  position: relative;
  width: min(78vw, 360px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 4px solid var(--paper);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    #f8f8f8;
  background-size: 28px 28px;
  box-shadow: var(--shadow);
}

.section-preview {
  display: grid;
  grid-template-rows: 1fr 1fr 1.45fr;
  gap: 8px;
  padding: 12px;
}

.preview-slot {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.preview-slot span {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 2;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 3px 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.preview-layer {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: none;
  width: calc(100% - 16px);
  height: calc(100% - 38px);
  object-fit: contain;
}

.preview-layer.visible {
  display: block;
}

.torso-layer {
  width: calc(100% - 16px);
  height: calc(100% - 38px);
  cursor: zoom-in;
  z-index: 1;
}

.head-layer {
  width: calc(100% - 16px);
  z-index: 2;
}

.hair-layer {
  width: calc(100% - 16px);
  z-index: 3;
}

.empty-preview {
  position: absolute;
  inset: 22px;
  z-index: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--ink);
  text-align: center;
}

.lego-face {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 8px;
  font-size: 38px;
  font-weight: 800;
}

.selected-strip {
  display: grid;
  gap: 8px;
  color: #e8e8e8;
  font-size: 14px;
}

.form-panel {
  padding: 34px;
  background: #000;
  color: var(--paper);
}

.progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 26px;
}

.step-pill {
  min-height: 44px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: #0f0f0f;
  color: var(--paper);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.step-pill.active {
  background: var(--paper);
  color: var(--ink);
}

.form-step {
  display: none;
}

.form-step.active {
  display: block;
}

.section-heading {
  margin-bottom: 22px;
}

.part-section {
  padding: 20px 0;
  border-top: 2px solid var(--line);
}

.lead-copy {
  margin-top: 8px;
  color: #d8d8d8;
  font-weight: 800;
}

.choice-note {
  display: inline-block;
  margin: 10px 0 0;
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 8px 10px;
  background: #0f0f0f;
  color: var(--paper);
  font-size: 14px;
  font-weight: 800;
}

.gender-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.gender-tab {
  min-height: 40px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: #0f0f0f;
  color: var(--paper);
  cursor: pointer;
  font-weight: 800;
}

.gender-tab.active {
  background: var(--paper);
  color: var(--ink);
}

.info-grid,
.payment-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

.info-box,
.payment-box,
.total-box {
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 16px;
  background: #0f0f0f;
  color: var(--paper);
}

.info-box p,
.payment-box p {
  margin-bottom: 8px;
}

.delivery-list {
  margin: 0;
  padding-left: 20px;
}

.delivery-list li + li {
  margin-top: 8px;
}

.order-type-toggle {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.type-button {
  min-height: 48px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: #0f0f0f;
  color: var(--paper);
  cursor: pointer;
  font-weight: 800;
}

.type-button.active {
  background: var(--paper);
  color: var(--ink);
}

.part-dropdown,
.admin-dropdown {
  margin-bottom: 14px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: #0f0f0f;
  color: var(--paper);
}

.part-dropdown summary,
.admin-dropdown summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
}

.part-dropdown .option-grid,
.admin-dropdown > *:not(summary) {
  margin: 0 16px 16px;
}

.payment-qr-box {
  display: grid;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: var(--soft);
  cursor: pointer;
  font-size: 42px;
  font-weight: 800;
}

.payment-qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.payment-box {
  display: grid;
  gap: 12px;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.78);
}

.image-modal img {
  max-width: min(92vw, 720px);
  max-height: 82vh;
  border: 4px solid var(--paper);
  border-radius: 8px;
  background: var(--paper);
  object-fit: contain;
}

.modal-close {
  position: fixed;
  top: 18px;
  right: 18px;
  min-height: 42px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font-weight: 800;
}

.total-box {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  font-size: 20px;
}

.part-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.part-heading p {
  max-width: 280px;
  margin-bottom: 4px;
  color: #d8d8d8;
  font-size: 14px;
  text-align: right;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.option-card {
  position: relative;
  min-height: 196px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: #0f0f0f;
  color: var(--paper);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}

.option-card[disabled] {
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.58;
}

.sold-out-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  border: 2px solid #ff4b4b;
  border-radius: 8px;
  padding: 5px 8px;
  background: #9f1d1d;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.option-card.selected {
  outline: 4px solid var(--paper);
  outline-offset: -8px;
}

.option-card img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: contain;
  background: var(--soft);
  border-bottom: 2px solid var(--paper);
}

.option-copy {
  padding: 12px;
}

.option-name {
  display: block;
  margin-bottom: 6px;
  font-weight: 800;
}

.option-stock {
  color: #d8d8d8;
  font-size: 13px;
}

.sold-out {
  color: #ff4b4b;
  font-weight: 800;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 50px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 0 14px;
  background: #0f0f0f;
  color: var(--paper);
}

.actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}

.split-actions {
  justify-content: space-between;
}

.primary-action,
.secondary-action {
  min-width: 130px;
  min-height: 48px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-action {
  background: var(--paper);
  color: var(--ink);
}

.secondary-action {
  background: #0f0f0f;
  color: var(--paper);
  border-color: var(--paper);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.65;
}

.review-box {
  display: grid;
  gap: 10px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 18px;
  background: #0f0f0f;
  color: var(--paper);
}

.review-line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.review-line:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.confirmation-note {
  margin: 18px 0 0;
  padding: 14px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: #0f0f0f;
  color: var(--paper);
}

.form-message {
  min-height: 24px;
  margin-top: 16px;
  font-weight: 800;
}

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

.form-message.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.admin-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px;
  color: var(--paper);
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 28px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}

.admin-top h1 {
  margin-bottom: 0;
}

.admin-link-button {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--paper);
  font-weight: 800;
  text-decoration: none;
}

.admin-panel,
.admin-category,
.admin-item {
  border: 2px solid var(--paper);
  border-radius: 8px;
  background: #0f0f0f;
  color: var(--paper);
}

.admin-panel {
  padding: 24px;
}

.admin-panel + .admin-panel,
.admin-category + .admin-category {
  margin-top: 18px;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-actions {
  display: flex;
  gap: 10px;
}

.admin-section-header h2,
.admin-section-header h3 {
  margin-bottom: 0;
}

.logo-admin-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.logo-preview {
  display: grid;
  width: 98px;
  height: 98px;
  place-items: center;
  border: 3px solid var(--paper);
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
  font-size: 44px;
  font-weight: 800;
}

.admin-parts {
  display: grid;
  gap: 18px;
}

.admin-category {
  padding: 18px;
}

.admin-item-list {
  display: grid;
  gap: 12px;
}

.admin-item {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 16px;
  padding: 14px;
}

.admin-thumb {
  width: 120px;
  height: 120px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--soft);
  object-fit: contain;
}

.admin-fields {
  display: grid;
  gap: 6px;
}

.content-fields {
  display: grid;
  gap: 12px;
}

.admin-text-field {
  margin: 0;
}

textarea {
  width: 100%;
  margin-top: 8px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 12px;
  background: #0f0f0f;
  color: var(--paper);
  resize: vertical;
}

select {
  width: 100%;
  min-height: 44px;
  border: 2px solid var(--paper);
  border-radius: 8px;
  padding: 0 12px;
  background: #0f0f0f;
  color: var(--paper);
  font: inherit;
}

.admin-fields .field-label {
  margin: 4px 0 0;
}

.small-action {
  min-width: 92px;
  min-height: 38px;
  align-self: start;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .brand-panel,
  .form-panel {
    padding: 22px;
  }

  .brand-panel {
    min-height: auto;
  }

  .preview-card {
    width: min(88vw, 320px);
  }

  .part-heading {
    display: block;
  }

  .part-heading p {
    max-width: none;
    text-align: left;
  }

  .info-grid,
  .payment-grid,
  .order-type-toggle {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .progress {
    grid-template-columns: 1fr;
  }

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

  .review-line {
    display: block;
  }

  .primary-action,
  .secondary-action {
    min-width: 112px;
  }

  .admin-shell {
    padding: 18px;
  }

  .admin-top,
  .admin-section-header,
  .admin-item {
    display: block;
  }

  .admin-actions {
    display: grid;
  }

  .admin-link-button,
  .admin-section-header button,
  .admin-item button {
    margin-top: 12px;
  }

  .logo-admin-row {
    grid-template-columns: 1fr;
  }

  .admin-thumb {
    width: 100%;
  }
}
