:root {
  color-scheme: light;
  --page-bg: #f4efe6;
  --panel: rgba(255, 252, 247, 0.88);
  --panel-strong: #fffdf8;
  --ink: #1e2430;
  --muted: #5f6672;
  --line: rgba(42, 53, 71, 0.12);
  --shadow: 0 20px 40px rgba(78, 66, 38, 0.08);
  --accent: #a9552b;
  --accent-soft: rgba(169, 85, 43, 0.12);
  --info: #22577a;
  --info-soft: rgba(34, 87, 122, 0.14);
  --success: #2f6f4f;
  --success-soft: rgba(47, 111, 79, 0.14);
  --warning: #9b5d00;
  --warning-soft: rgba(155, 93, 0, 0.14);
  --paused: #6b5f57;
  --paused-soft: rgba(107, 95, 87, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --content-width: 1120px;
  --font-title: "Iowan Old Style", "Noto Serif TC", serif;
  --font-body: "PingFang TC", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 35%),
    linear-gradient(180deg, #efe6d8 0%, var(--page-bg) 44%, #efe9dc 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  filter: blur(18px);
  pointer-events: none;
  opacity: 0.55;
}

body::before {
  top: -4rem;
  right: -5rem;
  background: rgba(236, 190, 128, 0.42);
}

body::after {
  bottom: -5rem;
  left: -6rem;
  background: rgba(118, 146, 180, 0.24);
}

.page-shell {
  width: min(calc(100% - 1.5rem), var(--content-width));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.hero {
  position: relative;
  overflow: hidden;
  margin-top: 0.5rem;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 251, 245, 0.98), rgba(248, 242, 231, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent);
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -2rem;
  bottom: -2rem;
  width: 10rem;
  height: 10rem;
  border-radius: 2rem;
  background: linear-gradient(145deg, rgba(169, 85, 43, 0.2), rgba(34, 87, 122, 0.08));
  transform: rotate(18deg);
}

.hero-kicker,
.section-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 1.08;
}

.hero-copy {
  position: relative;
  z-index: 1;
  margin: 1rem 0 0;
  max-width: 44rem;
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--muted);
}

.hero-meta {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.hero-meta span,
.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.summary-card,
.notice-panel,
.board-section,
.task-card {
  backdrop-filter: blur(10px);
}

.summary-card {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-label {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.summary-value {
  display: block;
  margin-top: 0.45rem;
  font-size: clamp(1.45rem, 5vw, 2rem);
  font-weight: 700;
}

.notice-panel {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.64);
  color: var(--muted);
  line-height: 1.7;
}

.board {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.board-section {
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
}

.card-grid {
  display: grid;
  gap: 0.85rem;
}

.task-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.task-card::after {
  content: "";
  position: absolute;
  inset: auto auto 0 0;
  width: 100%;
  height: 0.35rem;
  background: var(--status-color, var(--accent));
  opacity: 0.9;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(68, 63, 50, 0.08);
}

.task-card:focus-visible,
.modal-close:focus-visible,
.detail-links a:focus-visible {
  outline: 3px solid rgba(34, 87, 122, 0.28);
  outline-offset: 3px;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--status-soft, var(--accent-soft));
  color: var(--status-color, var(--accent));
  font-size: 0.92rem;
  font-weight: 700;
}

.updated-at {
  font-size: 0.9rem;
  color: var(--muted);
}

.task-title {
  margin: 0.85rem 0 0;
  font-size: 1.28rem;
  line-height: 1.4;
}

.task-detail {
  margin: 0.75rem 0 0;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink);
}

.task-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: auto 0 0;
}

.task-meta div {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(244, 239, 230, 0.7);
}

.task-meta dt {
  margin: 0 0 0.35rem;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.task-meta dd {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
}

.task-card.status-complete {
  opacity: 0.84;
}

.task-card.status-paused {
  opacity: 0.9;
}

.empty-state {
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: rgba(244, 239, 230, 0.65);
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(26, 33, 44, 0.4);
  backdrop-filter: blur(10px);
}

.detail-modal {
  position: relative;
  width: min(100%, 42rem);
  max-height: min(88vh, 52rem);
  overflow: auto;
  padding: 1.25rem 1rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 1.8rem 1.8rem 1rem 1rem;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 32px 70px rgba(21, 31, 43, 0.2);
}

.modal-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: auto;
  border: 0;
  border-radius: 999px;
  background: rgba(34, 87, 122, 0.1);
  color: var(--info);
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.modal-head > div {
  min-width: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 4.8vw, 1.8rem);
  line-height: 1.3;
}

.modal-head .status-pill {
  flex-shrink: 0;
}

.modal-body {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.modal-section {
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: rgba(244, 239, 230, 0.56);
}

.modal-section h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.modal-section p {
  margin: 0;
  line-height: 1.85;
}

.detail-grid {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.detail-grid div {
  padding: 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
}

.detail-grid dt {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
  line-height: 1.7;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.detail-links-stack {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.75rem;
}

.image-lightbox {
  padding: 0.75rem;
  background: rgba(12, 18, 26, 0.76);
}

.lightbox-panel {
  width: min(100%, 62rem);
  height: min(90vh, 56rem);
  max-height: min(90vh, 56rem);
  overflow: auto;
  padding: 1rem;
  border-radius: 1.5rem;
  background: rgba(20, 28, 38, 0.96);
  color: #f5f7fb;
}

.lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}

.lightbox-head h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  line-height: 1.4;
  text-align: center;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-head a {
  color: #d5e8ff;
  font-weight: 700;
  text-decoration: none;
}

.lightbox-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f5f7fb;
  font-size: 1.4rem;
  cursor: pointer;
}

.lightbox-body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: min(68vh, 42rem);
  height: min(68vh, 42rem);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.06);
}

.lightbox-body img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-fallback {
  display: grid;
  justify-items: center;
  gap: 1rem;
  width: 100%;
  padding: 2rem 1rem;
  text-align: center;
}

.lightbox-fallback p {
  margin: 0;
  color: rgba(245, 247, 251, 0.82);
  line-height: 1.7;
}

.lightbox-fallback a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(213, 232, 255, 0.12);
  color: #d5e8ff;
  font-weight: 700;
  text-decoration: none;
}

.detail-links a {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 2.6rem;
  width: 100%;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(34, 87, 122, 0.1);
  color: var(--info);
  font-weight: 700;
  text-decoration: none;
}

.detail-photo-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 2.6rem;
  width: 100%;
  padding: 0.55rem 1rem;
  border: 0;
  border-radius: 999px;
  background: rgba(34, 87, 122, 0.1);
  color: var(--info);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.modal-secondary-button {
  min-height: 2.8rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 999px;
  background: rgba(34, 87, 122, 0.12);
  color: var(--info);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (min-width: 720px) {
  .page-shell {
    width: min(calc(100% - 2.5rem), var(--content-width));
    padding-top: 1.4rem;
  }

  .hero,
  .board-section {
    padding: 1.4rem;
  }

  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal-backdrop {
    align-items: center;
    padding: 1.5rem;
  }

  .detail-modal {
    padding: 1.5rem;
    border-radius: 1.8rem;
  }

  .lightbox-panel {
    padding: 1.3rem;
  }

  .lightbox-body {
    min-height: min(70vh, 44rem);
    height: min(70vh, 44rem);
  }
}
