:root {
  --black: #1a1a1a;
  --white: #ffffff;
  --gray: #888;
  --light: #f5f5f5;
  --border: #e5e5e5;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--white);
  color: var(--black);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 100;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.brand-sub {
  display: block;
  font-size: 10px;
  color: var(--gray);
  letter-spacing: .06em;
  font-weight: 300;
  text-transform: uppercase;
}

.balance-value {
  font-size: 13px;
  font-weight: 500;
}

/* Screens */
.screen { padding-bottom: 90px; }

/* Accordion */
.accordion { }

.acc-item {
  border-bottom: 1px solid var(--border);
}

.acc-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  gap: 10px;
}

.acc-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.step-num {
  font-size: 10px;
  font-weight: 600;
  color: var(--gray);
  letter-spacing: .1em;
  min-width: 20px;
}

.step-label {
  font-size: 14px;
  font-weight: 500;
}

.optional {
  font-size: 11px;
  color: var(--gray);
  font-weight: 300;
  margin-left: 4px;
}

.acc-preview {
  width: 32px;
  height: 32px;
  overflow: hidden;
  flex-shrink: 0;
}

.acc-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.acc-arrow {
  font-size: 14px;
  color: var(--gray);
  transition: transform .2s;
  flex-shrink: 0;
}

.acc-arrow.open { transform: rotate(180deg); }

.acc-body {
  padding: 0 16px 16px;
}

/* Upload zone */
.upload-zone {
  position: relative;
  border: 1.5px dashed var(--border);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s;
}

.upload-zone:active { border-color: var(--black); }
.upload-zone.has-image { border-style: solid; min-height: unset; }

.upload-zone img {
  display: none;
  width: 100%;
  max-height: 30vh;
  object-fit: contain;
  background: var(--light);
}

.upload-zone img.visible { display: block; }

.upload-placeholder { text-align: center; padding: 20px; }

.upload-icon { font-size: 24px; color: var(--gray); margin-bottom: 6px; }
.upload-text { font-size: 14px; font-weight: 500; }
.upload-hint { font-size: 11px; color: var(--gray); margin-top: 3px; }

.remove-btn {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  background: rgba(26,26,26,.7);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.remove-btn.visible { display: flex; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.tab {
  padding: 8px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  margin-bottom: -1px;
  transition: all .2s;
}

.tab.active { color: var(--black); border-bottom-color: var(--black); }

/* URL */
.url-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.url-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.url-input {
  width: 100%;
  padding: 9px 32px 9px 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.url-input:focus { border-color: var(--black); }

.url-clear {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--gray);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.btn-find {
  padding: 9px 14px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.scrape-loading { font-size: 13px; color: var(--gray); padding: 8px 0; }

/* Gallery */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
}

.gallery-item.selected { border-color: var(--black); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

/* Comment */
.comment-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.comment-input {
  width: 100%;
  padding: 9px 32px 9px 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.comment-input:focus { border-color: var(--black); }

/* Action area */
.action-area {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
}

.btn-tryon {
  width: 100%;
  padding: 13px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: .04em;
  transition: opacity .2s;
}

.btn-tryon:disabled { opacity: .3; cursor: not-allowed; }

.price-hint {
  text-align: center;
  font-size: 11px;
  color: var(--gray);
  margin-top: 5px;
}

/* Loading */
.loading-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--black);
  border-radius: 50%;
  animation: dot-bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}

.loading-message {
  text-align: center;
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 8px;
  transition: opacity .3s;
}

/* Result */
.result-container { padding: 16px; }

.result-image {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  margin-bottom: 16px;
}

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

.btn-primary {
  flex: 1;
  padding: 12px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.btn-secondary {
  flex: 1;
  padding: 12px;
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--black);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.result-balance {
  text-align: center;
  font-size: 12px;
  color: var(--gray);
  margin-top: 10px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 32px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 18px; font-weight: 600; margin-bottom: 10px; }
.empty-state p { color: var(--gray); font-size: 14px; line-height: 1.7; margin-bottom: 24px; }

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-history {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px;
  opacity: 0.6;
}

.btn-history:active { opacity: 1; }

/* History screen */
.history-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.btn-back {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--black);
  font-family: inherit;
  padding: 0;
}

.history-title {
  font-size: 15px;
  font-weight: 500;
}

.history-list {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.history-loading, .history-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--gray);
  font-size: 14px;
  padding: 40px 0;
  line-height: 1.7;
}

.history-item {
  position: relative;
}

.history-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

.history-item-date {
  font-size: 11px;
  color: var(--gray);
  margin-top: 4px;
}

.history-download {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}
