﻿:root {
  --bg-a: #091428;
  --bg-b: #2b4f81;
  --panel: rgba(255, 255, 255, 0.93);
  --ink: #1f1b28;
  --brand: #ff6b35;
  --brand-dark: #ce4a1b;
  --accent: #00a6a6;
  --danger: #c92828;
  --muted: #675d73;
  --ring: rgba(255, 107, 53, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 650px at 10% -10%, #ffc06f 0%, transparent 55%),
    radial-gradient(1200px 650px at 95% 0%, #42b3ff 0%, transparent 48%),
    linear-gradient(160deg, var(--bg-a), var(--bg-b));
  padding: calc(1rem + env(safe-area-inset-top)) 0.9rem calc(1.2rem + env(safe-area-inset-bottom));
}

.app-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.hero {
  color: #ffffff;
  padding: 0.2rem 0.2rem 0.7rem;
  animation: float-in 0.5s ease;
}

.badge {
  display: inline-block;
  margin: 0 0 0.35rem;
  padding: 0.2rem 0.56rem;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw + 1rem, 2.2rem);
  line-height: 1.18;
}

.subtitle {
  margin: 0.48rem 0 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
}

.panel {
  background: var(--panel);
  border-radius: 1.1rem;
  padding: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
  animation: rise 0.4s ease;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.08rem;
}

.summary-panel {
  padding-bottom: 0.78rem;
}

.section-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.section-tag {
  padding: 0.35rem 0.62rem;
  border-radius: 999px;
  background: #eef6ff;
  color: #0d3f72;
  border: 1px solid #d0e3fb;
  font-size: 0.84rem;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.78rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

label {
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0.72rem 0.74rem;
  border-radius: 0.72rem;
  border: 1px solid #d1c8db;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--ring);
}

small {
  color: var(--muted);
  font-size: 0.79rem;
}

.cx-section {
  background: #fff5f1;
  border: 1px solid #f8c3b0;
  border-radius: 0.85rem;
  padding: 0.75rem;
  margin: 0.35rem 0 0.78rem;
}

.cx-section h2 {
  margin-bottom: 0.6rem;
  color: var(--brand-dark);
}

.actions {
  display: flex;
  gap: 0.56rem;
}

.actions.split {
  margin-top: 0.65rem;
}

button {
  border: none;
  border-radius: 0.72rem;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(135deg, var(--brand), #ff8f00);
  color: #fff;
  box-shadow: 0 7px 16px rgba(255, 107, 53, 0.35);
}

.secondary {
  background: #eef6ff;
  color: #0f3d73;
}

.ghost {
  background: transparent;
  color: #4d5560;
  border: 1px dashed #bbc2cb;
}

.ghost.small {
  padding: 0.35rem 0.6rem;
  font-size: 0.84rem;
}

.result {
  border: 1px dashed #d8cfdf;
  border-radius: 0.85rem;
  padding: 0.75rem;
  background: #faf8fc;
  min-height: 68px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.result.empty {
  color: #7d7488;
}

.preview-grid {
  margin-top: 0.62rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.52rem;
}

.preview-card {
  border: 1px solid #d6dce4;
  border-radius: 0.65rem;
  overflow: hidden;
  background: #fff;
}

.preview-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f2f5f8;
}

.preview-card p {
  margin: 0;
  padding: 0.34rem 0.44rem 0.42rem;
  font-size: 0.78rem;
  line-height: 1.32;
}

.preview-empty {
  border: 1px dashed #cbd3dd;
  color: #697585;
  border-radius: 0.65rem;
  padding: 0.65rem;
  font-size: 0.85rem;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  margin-bottom: 0.52rem;
}

.saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.56rem;
}

.saved-item {
  display: grid;
  gap: 0.24rem;
  border-radius: 0.75rem;
  padding: 0.62rem;
  background: #f7fbff;
  border: 1px solid #d8e8f8;
}

.saved-item header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: #3c4a5a;
}

.saved-item p {
  margin: 0;
  font-size: 0.92rem;
}

.saved-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 0.38rem;
  margin-top: 0.1rem;
}

.saved-thumb {
  margin: 0;
  border-radius: 0.5rem;
  border: 1px solid #d7e0eb;
  overflow: hidden;
  background: #ffffff;
}

.saved-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #f2f5f8;
}

.saved-thumb figcaption {
  font-size: 0.66rem;
  padding: 0.14rem 0.24rem 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #3f4e5d;
}

.delete-item {
  border: none;
  background: #ffe8e8;
  color: var(--danger);
  border-radius: 0.56rem;
  padding: 0.23rem 0.5rem;
  font-size: 0.8rem;
}

@media (max-width: 480px) {
  .row {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-wrap: wrap;
  }

  button {
    flex: 1;
  }
}

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

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