@import url('https://fonts.googleapis.com/css2?family=Bitter:wght@400;600&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #1c2b3a;
  color: #f2ece0;
  font-family: 'Bitter', serif;
  font-style: normal;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
}

#app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header {
  text-align: center;
  padding-top: 8px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Photo button */
#photo-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 20px;
  background: rgba(255,255,255,0.06);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 0;
  color: #f2ece0;
  font-family: 'Bitter', serif;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

#photo-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.35);
}

#photo-input {
  display: none;
}

/* Photo grid */
#photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  border: 1px solid rgba(255,255,255,0.1);
}

.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.65);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  color: #f2ece0;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Description */
#description {
  width: 100%;
  padding: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0;
  color: #f2ece0;
  font-family: 'Bitter', serif;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 72px;
}

#description::placeholder {
  color: rgba(242,236,224,0.4);
}

#description:focus {
  outline: none;
  border-color: rgba(255,255,255,0.3);
}

/* Submit */
#submit-btn {
  width: 100%;
  padding: 18px;
  background: #8c2a1e;
  border: none;
  border-radius: 0;
  color: #f2ece0;
  font-family: 'Bitter', serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#submit-btn:hover:not(:disabled) {
  background: #a33220;
}

#submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading */
#loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 24px 0;
}

#loading.visible {
  display: flex;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: #f2ece0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#loading p {
  font-size: 0.95rem;
  color: rgba(242,236,224,0.7);
}

/* Result */
#result-wrap {
  display: none;
}

#result-wrap.visible {
  display: block;
}

#result-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: 3px solid rgba(255,255,255,0.15);
  padding: 20px;
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.65;
}

#disclaimer {
  margin-top: 10px;
  font-size: 0.78rem;
  color: rgba(242,236,224,0.4);
  text-align: center;
}

/* Reset button */
#reset-btn {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 0;
  color: rgba(242,236,224,0.7);
  font-family: 'Bitter', serif;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

#reset-btn:hover {
  border-color: rgba(255,255,255,0.4);
  color: #f2ece0;
}

/* History */
#history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#history-heading {
  font-size: 0.78rem;
  color: rgba(242,236,224,0.35);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
}

.history-entry {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.history-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.history-summary::-webkit-details-marker { display: none; }

.history-item {
  font-size: 0.88rem;
  color: rgba(242,236,224,0.75);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-price {
  font-size: 0.85rem;
  color: rgba(242,236,224,0.5);
  white-space: nowrap;
  flex-shrink: 0;
}

.history-body {
  padding: 0 14px 14px;
  white-space: pre-wrap;
  font-size: 0.88rem;
  line-height: 1.6;
  color: rgba(242,236,224,0.8);
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 12px;
}

/* Error */
#error-msg {
  display: none;
  padding: 14px;
  background: rgba(140,42,30,0.25);
  border: 1px solid rgba(140,42,30,0.5);
  font-size: 0.9rem;
  text-align: center;
}

#error-msg.visible {
  display: block;
}
