:root {
  --lightGreen: #d8d8a3;
  --lightPeach: #ffe1c5;
  --paleCream: #ffedcc;
  --mutedBrown: #8a6f60;
  --bgLight: #faf8f5;
  --cardWhite: #ffffff;
  --textDark: #3a2e28;
  --textLight: #6b5a50;
  --borderRadiusCard: 16px;
  --borderRadiusPill: 999px;
}

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

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  background-color: #e0e0e0;
  color: var(--textDark);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.app-container {
  width: min(100%, 480px);
  min-width: 375px;
  min-height: 100vh;
  background-color: var(--paleCream);
  border-radius: 36px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.upload-header {
  padding: 24px 20px 12px;
  background: linear-gradient(to bottom right, var(--lightPeach), var(--paleCream));
}

.header-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  color: var(--mutedBrown);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(178, 149, 134, 0.1);
}

.header-copy h1 {
  font-size: 2rem;
  line-height: 1;
  color: var(--mutedBrown);
  margin-bottom: 8px;
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--textLight);
  margin-bottom: 10px;
}

.subtitle {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--textLight);
  max-width: 24ch;
}

.quota-badge {
  align-self: start;
  padding: 10px 12px;
  border-radius: 18px;
  background-color: var(--lightGreen);
  color: var(--textDark);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.hero-card,
.editor-card,
.tags-card,
.tips-card {
  margin: 0 16px 16px;
  background: var(--cardWhite);
  border-radius: var(--borderRadiusCard);
  box-shadow: 0 10px 30px rgba(178, 149, 134, 0.08);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid transparent;
}

.section-kicker {
  display: inline-block;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: var(--borderRadiusPill);
  background-color: var(--lightGreen);
  color: var(--textDark);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-card h2 {
  font-size: 1.18rem;
  color: var(--mutedBrown);
  margin-bottom: 6px;
}

.hero-card p {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--textLight);
}

.secondary-btn,
.ghost-btn,
.submit-btn,
.tag-chip {
  border: none;
  cursor: pointer;
  font: inherit;
}

.secondary-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 18px;
  background-color: var(--lightPeach);
  color: var(--mutedBrown);
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.editor-card,
.tags-card,
.tips-card {
  padding: 18px;
}

.editor-top,
.panel-head,
.action-bar,
.action-group {
  display: flex;
  align-items: center;
}

.editor-top,
.panel-head {
  justify-content: space-between;
  gap: 12px;
}

.editor-top {
  margin-bottom: 18px;
}

.pet-chip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pet-avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(to bottom right, var(--lightPeach), var(--paleCream));
  color: var(--mutedBrown);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border: 2px solid var(--lightGreen);
  box-shadow: 0 4px 10px rgba(178, 149, 134, 0.2);
}

.pet-label,
.panel-note,
.tips-list,
.draft-status {
  color: var(--textLight);
}

.pet-label,
.field-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pet-name {
  margin-top: 3px;
  font-size: 0.95rem;
  color: var(--mutedBrown);
  font-weight: 600;
}

.char-counter,
.status-pill {
  padding: 8px 10px;
  border-radius: 14px;
  background-color: var(--lightPeach);
  color: var(--mutedBrown);
  font-size: 0.82rem;
  font-weight: 700;
}

.field-label {
  display: block;
  color: var(--mutedBrown);
  margin-bottom: 10px;
}

.story-input {
  width: 100%;
  min-height: 148px;
  border: 1px solid var(--lightPeach);
  border-radius: 22px;
  background: var(--bgLight);
  padding: 18px;
  resize: vertical;
  color: var(--textDark);
  font: inherit;
  line-height: 1.6;
  outline: none;
}

.story-input::placeholder {
  color: var(--textLight);
}

.story-input:focus,
.upload-dropzone:focus-within {
  border-color: var(--mutedBrown);
  box-shadow: 0 0 0 4px rgba(255, 225, 197, 0.35);
}

.media-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  background: var(--bgLight);
  border: 1px dashed var(--lightPeach);
}

.panel-note {
  font-size: 0.84rem;
  line-height: 1.4;
}

.upload-dropzone {
  position: relative;
  margin-top: 14px;
  min-height: 150px;
  border-radius: 22px;
  border: 1.5px dashed var(--mutedBrown);
  background-color: var(--cardWhite);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: var(--textLight);
  padding: 20px;
  cursor: pointer;
}

.upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  background: linear-gradient(to bottom right, var(--lightPeach), var(--paleCream));
  color: var(--mutedBrown);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(178, 149, 134, 0.12);
}

.upload-dropzone strong {
  color: var(--mutedBrown);
  font-size: 1rem;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-chip {
  padding: 10px 14px;
  border-radius: var(--borderRadiusPill);
  background: var(--bgLight);
  color: var(--mutedBrown);
  border: 1px solid var(--lightPeach);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tag-chip.active {
  background: var(--lightPeach);
  color: var(--mutedBrown);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.tag-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(178, 149, 134, 0.15);
}

.tag-chip:active {
  transform: translateY(0);
}

.tips-card {
  display: flex;
  gap: 14px;
  margin-bottom: 100px;
}

.tips-icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  flex-shrink: 0;
  background: var(--lightGreen);
  color: var(--cardWhite);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(178, 149, 134, 0.12);
}

.tips-copy {
  min-width: 0;
}

.tips-list {
  margin-left: 18px;
  margin-top: 10px;
  line-height: 1.6;
  font-size: 0.9rem;
}

.action-bar {
  position: sticky;
  bottom: 0;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 22px;
  background: linear-gradient(180deg, rgba(255, 237, 204, 0.35), rgba(255, 237, 204, 0.96) 35%);
  backdrop-filter: blur(8px);
}

.draft-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lightGreen);
  box-shadow: 0 0 0 6px rgba(216, 216, 163, 0.22);
}

.action-group {
  gap: 10px;
  margin-left: auto;
}

.ghost-btn {
  padding: 11px 16px;
  border-radius: 18px;
  background: var(--cardWhite);
  color: var(--mutedBrown);
  border: 1px solid rgba(178, 149, 134, 0.16);
}

.submit-btn {
  padding: 12px 18px;
  border-radius: 18px;
  background: linear-gradient(to bottom right, var(--mutedBrown), #c5aa9f);
  color: var(--cardWhite);
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(178, 149, 134, 0.24);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(178, 149, 134, 0.32);
}

.submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 12px rgba(178, 149, 134, 0.2);
}

.ghost-btn {
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ghost-btn:hover {
  background: var(--bgLight);
  border-color: var(--mutedBrown);
}

.icon-btn {
  transition: background 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.8);
  transform: scale(1.05);
}

.secondary-btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.secondary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* --- Drag-over state --- */
.upload-dropzone.drag-over {
  border-color: var(--mutedBrown);
  background-color: var(--lightPeach);
  box-shadow: 0 0 0 4px rgba(255, 225, 197, 0.4);
}

.upload-dropzone:hover {
  border-color: var(--mutedBrown);
  background-color: rgba(255, 237, 204, 0.3);
}

/* --- Image preview --- */
.image-preview {
  position: relative;
  margin-top: 14px;
  border-radius: 22px;
  overflow: hidden;
  border: 1.5px solid var(--lightPeach);
}

.image-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  display: block;
  border-radius: 20px;
}

.remove-img-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(90, 75, 67, 0.7);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

.remove-img-btn:hover {
  background: rgba(90, 75, 67, 0.9);
}

/* --- Status pill with image --- */
.status-pill.has-image {
  background-color: var(--lightGreen);
}

/* --- Character counter states --- */
.char-counter.near-limit {
  background-color: #f5deb3;
  color: #a07030;
}

.char-counter.over-limit {
  background-color: #f5c6c6;
  color: #a03030;
}

/* --- Toast notification --- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 24px;
  border-radius: 14px;
  background: var(--textDark);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 100;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #a03030;
}

/* --- Landmark picker (IG-style) --- */
.landmark-picker {
  margin: 0 16px 16px;
  background: var(--cardWhite);
  border-radius: var(--borderRadiusCard);
  box-shadow: 0 10px 30px rgba(178, 149, 134, 0.08);
  padding: 18px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.picker-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--bgLight);
  color: var(--textLight);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.picker-close:hover {
  background: var(--lightPeach);
  color: var(--mutedBrown);
}

.landmark-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.landmark-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  background: var(--bgLight);
  cursor: pointer;
  transition: all 0.15s ease;
}

.landmark-item:hover {
  background: var(--lightPeach);
  border-color: var(--mutedBrown);
}

.landmark-item.selected {
  background: var(--lightPeach);
  border-color: var(--mutedBrown);
  box-shadow: 0 2px 8px rgba(178, 149, 134, 0.15);
}

.landmark-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(to bottom right, var(--lightPeach), var(--paleCream));
  color: var(--mutedBrown);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.landmark-item.selected .landmark-icon {
  background: var(--mutedBrown);
  color: var(--cardWhite);
}

.landmark-info {
  flex: 1;
  min-width: 0;
}

.landmark-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--textDark);
}

.landmark-dist {
  font-size: 0.78rem;
  color: var(--textLight);
  margin-top: 2px;
}

.landmark-check {
  color: var(--mutedBrown);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.landmark-item.selected .landmark-check {
  opacity: 1;
}

@media (max-width: 520px) {
  body {
    padding: 0;
  }

  .app-container {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
  }
}

@media (max-width: 420px) {
  .header-row,
  .hero-card,
  .editor-top,
  .panel-head,
  .action-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .quota-badge,
  .char-counter,
  .status-pill {
    align-self: flex-start;
  }

  .action-group {
    width: 100%;
    margin-left: 0;
  }

  .ghost-btn,
  .submit-btn {
    flex: 1;
  }

  .hero-card {
    align-items: flex-start;
  }
}
