:root {
  --dodo-bg: #fff8f3;
  --dodo-bg-accent: #ffe8d6;
  --dodo-surface: #ffffff;
  --dodo-ink: #3d2c29;
  --dodo-muted: #8a6f68;
  --dodo-primary: #e07a5f;
  --dodo-primary-dark: #c45d44;
  --dodo-soft: #81b29a;
  --dodo-warn: #f2cc8f;
  --dodo-danger: #c44536;
  --dodo-radius: 1.1rem;
  --dodo-shadow: 0 8px 24px rgba(61, 44, 41, 0.08);
  --nav-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  color: var(--dodo-ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #ffd8c2 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #d8f0e4 0%, transparent 50%),
    var(--dodo-bg);
}

a { color: var(--dodo-primary-dark); text-decoration: none; }
a:hover { color: var(--dodo-primary); }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 248, 243, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(61, 44, 41, 0.06);
}

.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-cn { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.02em; }
.brand-en { font-size: 0.75rem; color: var(--dodo-muted); letter-spacing: 0.18em; }

.top-nav { display: flex; gap: 1rem; }
.top-nav a {
  color: var(--dodo-muted);
  font-weight: 600;
  padding: 0.35rem 0.2rem;
  border-bottom: 2px solid transparent;
}
.top-nav a.active {
  color: var(--dodo-primary-dark);
  border-bottom-color: var(--dodo-primary);
}

.app-main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}
.app-main.has-nav {
  padding-bottom: calc(var(--nav-h) + 1.5rem);
}

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(61, 44, 41, 0.08);
  backdrop-filter: blur(12px);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--dodo-muted);
  font-size: 0.7rem;
  font-weight: 600;
}
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--dodo-primary-dark); }

.hero-home {
  padding: 1.4rem 0.4rem 0.6rem;
  animation: rise 0.45s ease-out;
}
.hero-brand {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--dodo-muted);
  text-transform: uppercase;
}
.hero-name {
  margin: 0.35rem 0 0.2rem;
  font-size: clamp(2rem, 8vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.hero-meta {
  color: var(--dodo-muted);
  font-size: 0.95rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}
.stat-card {
  background: var(--dodo-surface);
  border-radius: var(--dodo-radius);
  box-shadow: var(--dodo-shadow);
  padding: 1rem;
  animation: rise 0.5s ease-out;
}
.stat-card .label {
  display: block;
  color: var(--dodo-muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}
.stat-card .value {
  font-size: 1.35rem;
  font-weight: 700;
}
.stat-card.warn { outline: 2px solid var(--dodo-warn); }
.stat-card.alert { outline: 2px solid rgba(196, 69, 54, 0.35); }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 1.2rem 0;
}
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 5.2rem;
  border-radius: 1rem;
  background: linear-gradient(160deg, #fff, #ffe9dc);
  color: var(--dodo-ink);
  font-weight: 700;
  box-shadow: var(--dodo-shadow);
  border: none;
  transition: transform 0.15s ease;
}
.quick-btn i { font-size: 1.4rem; color: var(--dodo-primary); }
.quick-btn:active { transform: scale(0.97); }

.section-title {
  margin: 1.4rem 0 0.7rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.timeline {
  position: relative;
  padding-left: 1.2rem;
  margin: 0;
  list-style: none;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.2rem;
  bottom: 0.2rem;
  width: 2px;
  background: linear-gradient(var(--dodo-primary), transparent);
}
.timeline-item {
  position: relative;
  margin-bottom: 0.85rem;
  padding: 0.9rem 1rem;
  background: var(--dodo-surface);
  border-radius: 1rem;
  box-shadow: var(--dodo-shadow);
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.05rem;
  top: 1.15rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--dodo-primary);
  box-shadow: 0 0 0 3px #ffd8c2;
}
.timeline-item .time {
  color: var(--dodo-muted);
  font-size: 0.8rem;
}
.timeline-item .title {
  font-weight: 700;
  margin-top: 0.15rem;
}

.page-card, .list-card, .form-card {
  background: var(--dodo-surface);
  border-radius: var(--dodo-radius);
  box-shadow: var(--dodo-shadow);
  padding: 1.1rem;
  margin-bottom: 0.85rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.page-header h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 800;
}

.btn-primary {
  --bs-btn-bg: var(--dodo-primary);
  --bs-btn-border-color: var(--dodo-primary);
  --bs-btn-hover-bg: var(--dodo-primary-dark);
  --bs-btn-hover-border-color: var(--dodo-primary-dark);
  --bs-btn-active-bg: var(--dodo-primary-dark);
  --bs-btn-active-border-color: var(--dodo-primary-dark);
}

.btn-lg, .form-control, .form-select {
  min-height: 3rem;
  font-size: 1rem;
}
.form-label { font-weight: 600; color: var(--dodo-ink); }

.badge-soft {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #ffe8d6;
  color: var(--dodo-primary-dark);
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-danger-soft {
  background: #fde2e0;
  color: var(--dodo-danger);
}
.badge-ok-soft {
  background: #e4f4ec;
  color: #2f6b52;
}

.photo-grid,
.photo-grid-v2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}
.photo-grid a,
.photo-grid-v2 .photo-cell {
  display: block;
  border-radius: 0.75rem;
  overflow: hidden;
  aspect-ratio: 1;
  background: #f3e7e0;
  box-shadow: var(--dodo-shadow);
}
.photo-grid img,
.photo-grid-v2 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-month {
  margin-bottom: 1.25rem;
}
.photo-month-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.75rem 0.15rem 0.55rem;
  color: var(--dodo-ink);
}

.photo-tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}
.photo-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #eadfd6;
  color: var(--dodo-ink);
  font-size: 0.85rem;
}
.photo-tag.is-active {
  background: var(--dodo-primary);
  border-color: var(--dodo-primary);
  color: #fff;
}

.photo-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
  flex-wrap: wrap;
}
.photo-pager-info {
  color: var(--dodo-muted);
  font-size: 0.9rem;
}

.photo-empty {
  text-align: center;
  padding: 2rem 1.2rem;
}

.photo-pick-actions {
  display: block;
}
.photo-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0;
  cursor: pointer;
}
.photo-queue-meta {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--dodo-muted);
}
.photo-queue-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-top: 0.65rem;
}
.photo-queue-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0.7rem;
  overflow: hidden;
  background: #f3e7e0;
}
.photo-queue-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-queue-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
}
.photo-edit-preview {
  max-width: 160px;
  aspect-ratio: 1;
  border-radius: 0.8rem;
  overflow: hidden;
  background: #f3e7e0;
}
.photo-edit-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

html.photo-viewer-lock,
body.photo-viewer-lock {
  overflow: hidden;
  height: 100%;
}
.photo-viewer-page .app-main {
  padding: 0;
  max-width: none;
}
.photo-viewer-page .app-topbar,
.photo-viewer-page .bottom-nav {
  display: none !important;
}
.photo-viewer {
  min-height: 100vh;
  min-height: 100dvh;
  background: #111;
  color: #fff;
  display: flex;
  flex-direction: column;
}
.photo-viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
}
.photo-viewer-close {
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  text-decoration: none;
  padding: 0.2rem 0.5rem;
}
.photo-viewer-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  touch-action: pan-y;
  user-select: none;
}
.photo-viewer-img {
  max-width: 100%;
  max-height: 72vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
}
.photo-viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 1.6rem;
  z-index: 1;
}
.photo-viewer-nav.prev { left: 0.5rem; }
.photo-viewer-nav.next { right: 0.5rem; }
.photo-viewer-meta {
  padding: 0.85rem 1rem 0.4rem;
}
.photo-viewer-date {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}
.photo-viewer-title {
  font-weight: 700;
  margin-top: 0.2rem;
}
.photo-viewer-tags,
.photo-viewer-desc {
  margin-top: 0.25rem;
  color: rgba(255,255,255,0.82);
  font-size: 0.92rem;
}
.photo-viewer-delete {
  padding: 0.75rem 1rem 1.25rem;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255,255,255,0.95);
  border-radius: 1.4rem;
  padding: 2rem 1.4rem;
  box-shadow: var(--dodo-shadow);
  animation: rise 0.5s ease-out;
}
.login-card .brand-hero {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-card .brand-hero h1 {
  margin: 0.3rem 0 0;
  font-size: 1.8rem;
  font-weight: 800;
}
.login-card .brand-hero .en {
  letter-spacing: 0.25em;
  color: var(--dodo-muted);
  font-size: 0.85rem;
}

.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.hub-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem 1rem;
  border-radius: 1.1rem;
  background: var(--dodo-surface);
  box-shadow: var(--dodo-shadow);
  color: var(--dodo-ink);
  font-weight: 700;
}
.hub-link i {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 0.8rem;
  background: #ffe8d6;
  color: var(--dodo-primary);
  font-size: 1.2rem;
}

.detail-img {
  width: 100%;
  border-radius: 1rem;
  margin: 0.75rem 0;
}

.severity-mild { color: #2f6b52; }
.severity-moderate { color: #b7791f; }
.severity-severe { color: var(--dodo-danger); font-weight: 700; }

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

@media (min-width: 768px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .photo-grid,
  .photo-grid-v2 { grid-template-columns: repeat(4, 1fr); }
  .photo-queue-preview { grid-template-columns: repeat(4, 1fr); }
  .app-main.has-nav { padding-bottom: 2rem; }
  .photo-viewer-page .bottom-nav { display: none !important; }
}

@media (min-width: 1100px) {
  .photo-grid,
  .photo-grid-v2 { grid-template-columns: repeat(5, 1fr); }
}
