:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --muted: #86868b;
  --line: #e5e5e7;
  --brand: #082746;
  --gold: #b98033;
  --green: #607765;
  --paper: #f5f5f7;
  --panel: #ffffff;
  --danger: #b3261e;
  --shadow: 0 12px 32px rgba(8, 39, 70, 0.12);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --glass-line: rgba(255, 255, 255, 0.7);
  --shadow-soft: 0 18px 44px rgba(8, 39, 70, 0.1);
  --ease-apple: cubic-bezier(0.2, 0.78, 0.22, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-body {
  min-height: 100vh;
  background: linear-gradient(145deg, #f7f4ee 0%, #edf2ee 48%, #f4eadc 100%);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 32px 22px;
}

.login-logo {
  width: 142px;
  height: auto;
}

.login-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(231, 225, 216, 0.92);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.login-panel h1 {
  margin: 0 0 24px;
  color: var(--brand);
  font-size: 30px;
  letter-spacing: 0;
}

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

.login-form label {
  color: var(--muted);
  font-size: 14px;
}

.login-form input,
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.login-form input {
  height: 48px;
  padding: 0 14px;
}

.login-form button,
.primary-button,
.secondary-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
}

.login-form button,
.primary-button {
  background: var(--brand);
  color: #fff;
}

.secondary-button {
  background: #eee8df;
  color: var(--brand);
}

.form-message,
.copy-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: calc(64px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: rgba(245, 245, 247, 0.76);
  border-bottom: 1px solid rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(20px) saturate(150%);
}

.top-logo {
  position: absolute;
  left: 50%;
  height: 18px;
  max-width: 128px;
  transform: translateX(-50%);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  color: var(--brand);
  font-size: 0;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(8, 39, 70, 0.08);
  backdrop-filter: blur(12px);
  transition: transform 180ms var(--ease-apple), background 180ms ease, box-shadow 180ms ease;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.top-bar .icon-button.hidden {
  display: grid !important;
  visibility: hidden;
  pointer-events: none;
}

.icon-button:active,
.clear-search:active,
.tab-button:active,
.color-option:active,
.product-card button:active,
.pattern-card button:active {
  transform: scale(0.96);
}

.screen {
  padding: 14px 0 24px;
}

.screen.screen-enter {
  animation: screen-in 420ms var(--ease-apple) both;
}

.search-wrap {
  position: sticky;
  top: calc(58px + env(safe-area-inset-top));
  z-index: 8;
  padding: 16px 18px 22px;
  background: rgba(245, 245, 247, 0.76);
  backdrop-filter: blur(18px) saturate(140%);
}

.search-input {
  height: 56px;
  padding: 0 48px 0 22px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(29, 29, 31, 0.04);
  font-size: 16px;
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.search-input:focus {
  box-shadow: 0 0 0 4px rgba(8, 39, 70, 0.08), 0 8px 20px rgba(29, 29, 31, 0.06);
}

.clear-search {
  position: absolute;
  top: 29px;
  right: 28px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #eee8df;
  color: var(--muted);
}

.section {
  margin: 0 0 38px;
}

.section-title {
  margin: 0 18px 18px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
}

.section-subtitle {
  margin: -4px 18px 14px;
  color: #b0b0b5;
  font-size: 15px;
}

.scroll-rail {
  position: relative;
  margin-bottom: 6px;
}

.rail-viewport {
  position: relative;
}

.rail-viewport::before,
.rail-viewport::after {
  position: absolute;
  top: 0;
  bottom: 10px;
  z-index: 2;
  width: 42px;
  opacity: 0;
  pointer-events: none;
  content: '';
  transition: opacity 180ms ease;
}

.rail-viewport::before {
  left: 0;
  background: linear-gradient(90deg, rgba(245, 245, 247, 0.98), rgba(245, 245, 247, 0));
}

.rail-viewport::after {
  right: 0;
  background: linear-gradient(270deg, rgba(245, 245, 247, 0.98), rgba(245, 245, 247, 0));
}

.scroll-rail[data-overflow='true'][data-start='false'] .rail-viewport::before,
.scroll-rail[data-overflow='true'][data-end='false'] .rail-viewport::after {
  opacity: 1;
}

.horizontal-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 0 18px 10px;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 18px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar {
  display: none;
}

.scroll-rail--flush .horizontal-scroll {
  padding-left: 0;
  padding-right: 0;
  scroll-padding-inline: 0;
}

.rail-control {
  position: absolute;
  top: 45%;
  z-index: 4;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 5px 16px rgba(8, 39, 70, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: var(--brand);
  backdrop-filter: blur(12px);
  transform: translateY(-50%) scale(1);
  transition: opacity 180ms ease, transform 180ms var(--ease-apple), box-shadow 180ms ease;
}

.rail-control-left {
  left: 8px;
}

.rail-control-right {
  right: 8px;
}

.scroll-rail--flush .rail-control-left {
  left: 4px;
}

.scroll-rail--flush .rail-control-right {
  right: 4px;
}

.rail-control svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.rail-control:disabled {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.86);
}

.rail-control:active {
  box-shadow: 0 3px 10px rgba(8, 39, 70, 0.12);
  transform: translateY(-50%) scale(0.9);
}

.rail-progress {
  width: calc(100% - 36px);
  height: 3px;
  margin: 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(8, 39, 70, 0.08);
  opacity: 0;
  transition: opacity 180ms ease;
}

.scroll-rail--flush .rail-progress {
  width: 100%;
  margin-inline: 0;
}

.scroll-rail[data-overflow='true'] .rail-progress {
  opacity: 1;
}

.rail-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: rgba(8, 39, 70, 0.48);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 120ms linear;
}

.product-card,
.pattern-card {
  overflow: hidden;
  border: 1px solid rgba(231, 225, 216, 0.9);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 10px 24px rgba(29, 29, 31, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  scroll-snap-align: start;
  animation: card-in 540ms var(--ease-apple) both;
  animation-delay: calc(var(--stagger, 0) * 42ms);
  transition: transform 220ms var(--ease-apple), box-shadow 220ms ease;
}

.product-card {
  flex: 0 0 clamp(204px, 54vw, 238px);
}

.pattern-card {
  flex: 0 0 clamp(158px, 42vw, 184px);
}

.product-card:hover,
.pattern-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(29, 29, 31, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.product-card button,
.pattern-card button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.thumb,
.hero-media,
.process-image-wrap {
  position: relative;
  overflow: hidden;
  background: #d7c1a0;
}

.thumb {
  aspect-ratio: 1 / 0.87;
}

.pattern-card .thumb {
  aspect-ratio: 1 / 0.74;
}

.thumb img,
.hero-media img,
.process-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.placeholder-code {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 800;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.22);
}

.card-info {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 132px;
  padding: 18px 16px 16px;
}

.pattern-card .card-info {
  min-height: 70px;
  padding: 13px 12px;
}

.card-name {
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.card-meta {
  color: var(--muted);
  font-size: 12px;
}

.card-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ink);
}

.card-price b {
  font-size: 23px;
  line-height: 1;
}

.card-price small {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.badge {
  width: fit-content;
  color: #bd9654;
  font-size: 16px;
  font-weight: 600;
}

.empty {
  margin: 48px 18px;
  padding: 28px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.detail-page {
  padding-bottom: 20px;
}

.hero-media {
  min-height: 0;
  aspect-ratio: 1.56 / 1;
  margin-top: -14px;
  box-shadow: none;
}

.hero-media img {
  min-height: 0;
  animation: hero-reveal 640ms var(--ease-apple) both;
}

.hero-text {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.38);
}

.hero-text h1 {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 17px;
  letter-spacing: 0;
}

.hero-text p {
  margin: 0;
  font-size: clamp(27px, 8vw, 34px);
  font-weight: 700;
}

.detail-content {
  padding: 30px 18px;
}

.detail-title-row {
  margin-bottom: 34px;
}

.detail-title-row h2 {
  margin: 0;
  color: var(--ink);
  font-size: 34px;
  letter-spacing: 0;
}

.detail-title-row p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.scroll-rail--colors {
  margin-bottom: 24px;
}

.scroll-rail--colors .horizontal-scroll {
  gap: 10px;
  padding-top: 4px;
  padding-bottom: 16px;
}

.scroll-rail--colors .rail-control {
  top: 39%;
  width: 30px;
  height: 30px;
}

.scroll-rail--colors .rail-viewport::before,
.scroll-rail--colors .rail-viewport::after {
  bottom: 8px;
}

.color-option {
  flex: 0 0 82px;
  display: grid;
  justify-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 10px 6px;
  color: var(--muted);
  transition: transform 180ms var(--ease-apple), border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.color-option.active {
  border-color: rgba(196, 143, 59, 0.78);
  background: rgba(255, 255, 255, 0.78);
  color: #c18b37;
  box-shadow: 0 7px 16px rgba(29, 29, 31, 0.08);
}

.swatch {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(8, 39, 70, 0.18);
  border-radius: 50%;
}

.color-option span {
  max-width: 56px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-panel,
.pricing-notes {
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.info-panel h3 {
  margin: 0;
  padding: 21px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 22px;
}

.pricing-notes h3 {
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 18px;
}

.price-row,
.info-row,
.note-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #efeff1;
}

.price-row {
  padding: 22px 20px;
  font-size: 21px;
}

.info-row {
  padding: 18px 20px;
  font-size: 17px;
}

.note-line {
  padding: 14px 20px;
  font-size: 14px;
}

.price-row:last-child,
.info-row:last-child,
.note-line:last-child {
  border-bottom: 0;
}

.row-label {
  color: var(--muted);
}

.row-value {
  color: var(--ink);
  font-weight: 700;
  text-align: right;
}

.price-row .row-value strong {
  font-size: 26px;
  line-height: 1;
}

.price-unit {
  margin-left: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.print-price {
  color: var(--gold);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.process-page {
  padding: 18px;
}

.process-image-wrap {
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.process-image-wrap img {
  height: auto;
}

.tab-bar {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(360px, calc(100% - 32px));
  min-height: 62px;
  padding: 6px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 14px 34px rgba(8, 39, 70, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(20px) saturate(155%);
  transform: translateX(-50%);
}

.tab-bar::before {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc(50% - 6px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 5px 14px rgba(8, 39, 70, 0.1), inset 0 1px 0 #fff;
  content: '';
  transform: translateX(0);
  transition: transform 320ms var(--ease-apple);
}

.tab-bar[data-active='process']::before {
  transform: translateX(100%);
}

.tab-button {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: color 220ms ease, transform 180ms var(--ease-apple);
}

.tab-button.active {
  color: var(--brand);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  line-height: 1;
}

.tab-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.88);
  padding: 28px;
}

.image-viewer:not(.hidden) {
  animation: overlay-in 220ms ease both;
}

.image-viewer:not(.hidden) img {
  animation: viewer-image-in 340ms var(--ease-apple) both;
}

.image-viewer img {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
}

.viewer-close {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 30px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.38);
}

.sheet-panel {
  width: 100%;
  max-height: 78vh;
  overflow: auto;
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, 0.96);
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
}

.sheet:not(.hidden) {
  animation: overlay-in 200ms ease both;
}

.sheet:not(.hidden) .sheet-panel {
  animation: sheet-up 460ms cubic-bezier(0.2, 0.94, 0.3, 1.08) both;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: #d8d0c5;
}

.sheet-panel h2 {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 20px;
}

.sheet-panel pre {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #f7f4ee;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

@media (min-width: 720px) {
  .app-shell {
    max-width: 520px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(231, 225, 216, 0.9);
  }

  .tab-bar {
    width: 360px;
  }
}

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

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hero-reveal {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes viewer-image-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes sheet-up {
  from { opacity: 0; transform: translateY(104%); }
  to { opacity: 1; transform: translateY(0); }
}

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