@font-face {
  font-family: "NameplateCjk";
  src: url("assets/fonts/AdobeFanHeitiStd-Bold.otf") format("opentype");
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #24301f;
  --muted: #68735f;
  --leaf: #4e7443;
  --leaf-2: #dbecc8;
  --cream: #fff9ec;
  --shell: #fff3dd;
  --paper: #fffdfa;
  --pink: #f07ba6;
  --orange: #df7a28;
  --mint: #78d6ba;
  --line: #06c755;
  --border: rgba(71, 91, 54, 0.18);
  --shadow: 0 24px 60px rgba(51, 47, 31, 0.12);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --bottom-nav-height: 76px;
  font-family: "Gill Sans", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: #243323;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 0%, rgba(240, 123, 166, 0.22), transparent 34rem),
    radial-gradient(circle at 88% 16%, rgba(120, 214, 186, 0.24), transparent 28rem),
    #243323;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.8), transparent 11rem),
    radial-gradient(circle at 90% 30%, rgba(158, 220, 183, 0.38), transparent 12rem),
    linear-gradient(180deg, #fff7df 0%, #f7f5dd 52%, #eef5df 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.screen {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) 18px
    calc(var(--bottom-nav-height) + 26px + env(safe-area-inset-bottom));
  animation: screen-in 360ms ease both;
}

.screen.auth-screen,
.screen.success-screen {
  display: grid;
  place-items: center;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar,
.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--pink), #f5b4ce);
  color: #fff;
  box-shadow: 0 14px 26px rgba(240, 123, 166, 0.28);
}

.brand-mark img,
.brand-mark .dino-emoji {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.brand-name {
  margin: 0;
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: 0.08em;
  font-weight: 900;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.icon-button,
.back-button,
.ghost-button,
.chip,
.template-card,
.filament-card,
.size-card,
.bottom-nav a {
  cursor: pointer;
}

.icon-button,
.back-button {
  border: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  min-width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--border);
}

.cart-badge {
  position: relative;
}

.cart-badge[data-count]:not([data-count="0"])::after {
  content: attr(data-count);
  position: absolute;
  right: -4px;
  top: -5px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #d9345f;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 6px 12px rgba(217, 52, 95, 0.28);
}

.hero {
  position: relative;
  margin-top: 16px;
  padding: 22px 18px 18px;
  border-radius: 36px;
  background:
    radial-gradient(circle at 14% 24%, rgba(255, 255, 255, 0.78), transparent 8rem),
    linear-gradient(135deg, rgba(255, 224, 170, 0.8), rgba(255, 192, 214, 0.86) 54%, rgba(198, 239, 213, 0.78));
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -72px;
  top: -42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hero-title {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: 260px;
  font-size: clamp(34px, 12vw, 58px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  font-weight: 950;
}

.hero-copy {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  max-width: 260px;
  color: #5e5f4f;
  line-height: 1.55;
  font-size: 15px;
  font-weight: 700;
}

.hero-stage {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 132px;
  align-items: end;
  gap: 12px;
}

.hero .preview-stage {
  min-height: 150px;
}

.current-choice {
  align-self: stretch;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(14px);
}

.choice-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.choice-name {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.primary-button,
.secondary-button,
.line-button,
.danger-button {
  border: 0;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), #e95385);
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 16px 28px rgba(226, 78, 132, 0.24);
}

.primary-button:disabled,
.secondary-button:disabled,
.line-button:disabled {
  opacity: 0.52;
  cursor: progress;
}

.secondary-button {
  color: var(--ink);
  background: #f5ffef;
  box-shadow: inset 0 0 0 1px var(--border);
}

.line-button {
  background: var(--line);
  box-shadow: 0 16px 28px rgba(6, 199, 85, 0.2);
}

.danger-button {
  background: #c94a4a;
  box-shadow: none;
}

.ghost-button {
  border: 0;
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--leaf);
  background: rgba(255, 255, 255, 0.62);
  font-weight: 900;
}

.section {
  margin-top: 24px;
}

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

.section-heading h2 {
  margin: 0;
  font-size: 23px;
  line-height: 1.1;
  font-weight: 950;
}

.section-note {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
  font-weight: 700;
}

.chip-row,
.filament-category-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar,
.filament-category-row::-webkit-scrollbar,
.filament-strip::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  border: 0;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--leaf);
  background: rgba(255, 255, 255, 0.56);
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(76, 105, 61, 0.1);
}

.chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, #e97ba7, #d77aff);
  box-shadow: 0 12px 20px rgba(218, 105, 170, 0.18);
}

.filament-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scroll-snap-type: x mandatory;
}

.filament-card {
  flex: 0 0 126px;
  border: 0;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  scroll-snap-align: start;
  box-shadow: inset 0 0 0 1px rgba(72, 85, 52, 0.12);
}

.filament-card.is-active {
  box-shadow: inset 0 0 0 2px var(--orange), 0 14px 26px rgba(223, 122, 40, 0.14);
}

.filament-card img,
.filament-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  display: block;
  background: #f4f0df;
}

.filament-name {
  margin: 8px 0 2px;
  font-size: 13px;
  font-weight: 950;
}

.filament-meta {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.template-card {
  border: 0;
  padding: 12px;
  border-radius: 28px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(72, 85, 52, 0.1), 0 16px 30px rgba(63, 57, 35, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.template-card:active {
  transform: scale(0.98);
}

.template-card h3 {
  margin: 10px 0 2px;
  min-height: 38px;
  font-size: 15px;
  line-height: 1.22;
  font-weight: 950;
}

.template-card p {
  margin: 0;
  color: var(--leaf);
  font-size: 12px;
  font-weight: 900;
}

.template-thumb {
  height: 116px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #fffdfa, #f7f5ed);
  overflow: hidden;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 168px;
  border-radius: 28px;
  background:
    radial-gradient(ellipse at 50% 82%, rgba(56, 70, 45, 0.12), transparent 54%),
    rgba(255, 255, 255, 0.42);
}

.preview-stage--hero {
  min-height: 132px;
}

.preview-stage--card {
  min-height: 86px;
  border-radius: 20px;
}

.preview-stage--customize {
  min-height: 144px;
}

.preview-stage--cart {
  min-height: 132px;
}

.preview-stage--modal {
  min-height: 152px;
}

.dino-art {
  width: var(--art-width, 180px);
  height: var(--art-height, 108px);
  max-width: 100%;
  min-height: 64px;
  display: grid;
  justify-self: center;
  align-self: center;
  place-items: center;
  background-color: transparent;
  background-image: var(--dino-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 12px 12px rgba(52, 45, 24, 0.14));
}

.nameplate-preview {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  min-width: 108px;
  max-width: 78%;
  padding: 7px 16px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(59, 71, 44, 0.12);
  font-family: "NameplateCjk", "PingFang TC", sans-serif;
  font-size: 18px;
  line-height: 1.12;
  text-align: center;
  white-space: pre-line;
  box-shadow: 0 10px 18px rgba(59, 54, 32, 0.1);
}

.detail-card,
.summary-box,
.notice-box,
.empty-state,
.auth-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(72, 85, 52, 0.12);
}

.detail-card {
  padding: 16px;
}

.custom-preview {
  padding: 14px;
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 238, 218, 0.68));
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  outline: none;
  font-size: 16px;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(223, 122, 40, 0.65);
  box-shadow: 0 0 0 4px rgba(223, 122, 40, 0.12);
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.size-card {
  border: 0;
  padding: 14px;
  border-radius: 22px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--border);
}

.size-card.is-active {
  color: #fff;
  background: linear-gradient(135deg, #4e7443, #79ad62);
  box-shadow: 0 14px 24px rgba(78, 116, 67, 0.2);
}

.size-card strong,
.size-card span {
  display: block;
}

.size-card strong {
  font-size: 18px;
  font-weight: 950;
}

.size-card span {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.82;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-row.single {
  grid-template-columns: 1fr;
}

.cart-list {
  display: grid;
  gap: 14px;
}

.cart-item {
  padding: 14px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(72, 85, 52, 0.12);
}

.cart-item-head,
.line-item,
.price-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cart-item h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 950;
}

.line-item {
  align-items: center;
  padding-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.line-item strong {
  color: var(--ink);
}

.color-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-inline img,
.color-swatch {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--swatch, #ccc);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.summary-box {
  padding: 16px;
}

.price-line {
  padding: 6px 0;
  color: var(--muted);
  font-weight: 900;
}

.price-line strong,
.price-line.total {
  color: var(--ink);
}

.price-line.total {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 21px;
}

.notice-box {
  padding: 14px;
  color: #536a3b;
  background: rgba(241, 250, 228, 0.78);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.empty-state {
  padding: 36px 24px;
  text-align: center;
}

.empty-state h2 {
  margin: 12px 0 8px;
}

.auth-card {
  width: min(100%, 430px);
  padding: 28px 22px;
  text-align: center;
  background: rgba(255, 255, 255, 0.84);
}

.auth-card .brand-mark {
  margin: 0 auto 18px;
  background: var(--line);
  box-shadow: 0 16px 30px rgba(6, 199, 85, 0.18);
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 16px;
  border: 3px solid rgba(78, 116, 67, 0.18);
  border-top-color: var(--leaf);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  width: min(100%, 520px);
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 -10px 30px rgba(55, 50, 32, 0.09);
  backdrop-filter: blur(18px);
}

.bottom-nav a {
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.bottom-nav a.is-active {
  color: var(--leaf);
  background: rgba(219, 236, 200, 0.64);
}

.bottom-nav .nav-icon {
  font-size: 20px;
  line-height: 1;
}

.modal-root {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(33, 42, 29, 0.48);
  animation: fade-in 180ms ease both;
}

.modal-root[hidden] {
  display: none;
}

.modal-card {
  width: min(100%, 500px);
  max-height: min(86svh, 760px);
  overflow: auto;
  border-radius: 34px;
  padding: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
  animation: modal-in 230ms ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    transform: translateY(22px) scale(0.98);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 22px;
}

.toast-root {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + 18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 470px);
  pointer-events: none;
}

.toast {
  margin-top: 8px;
  padding: 13px 16px;
  border-radius: 18px;
  color: #fff;
  background: rgba(35, 48, 31, 0.94);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
  font-weight: 800;
  animation: toast-in 220ms ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.turnstile-root {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 120px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.admin-redirect {
  text-align: center;
}

@media (min-width: 760px) {
  .app-shell {
    margin-top: 18px;
    margin-bottom: 18px;
    min-height: calc(100svh - 36px);
    border-radius: 34px;
  }

  .screen {
    min-height: calc(100svh - 36px);
  }

  .bottom-nav {
    border-radius: 28px 28px 0 0;
  }
}

@media (max-width: 390px) {
  .screen {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-stage {
    grid-template-columns: 1fr;
  }

  .template-thumb {
    height: 104px;
  }

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

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