:root {
  --page-bg: #f4efe5;
  --page-bg-accent: #ffe5bf;
  --surface: rgba(255, 253, 249, 0.92);
  --surface-strong: #ffffff;
  --surface-secondary: rgba(255, 248, 238, 0.88);
  --ink: #132033;
  --muted: #5f6b7f;
  --line: rgba(223, 212, 189, 0.95);
  --accent: #1e88e5;
  --accent-strong: #1668bb;
  --mint: #0f766e;
  --gold: #f2b51f;
  --gold-strong: #cf9311;
  --shadow: 0 20px 44px rgba(15, 25, 42, 0.12);
  --shadow-soft: 0 12px 24px rgba(15, 25, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: 'Sora', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 680px at 96% -8%, var(--page-bg-accent), transparent 55%),
    linear-gradient(180deg, #fffdf7 0%, var(--page-bg) 100%);
  position: relative;
  min-height: 100vh;
}

body[data-theme='noir'] {
  --page-bg: #0f1725;
  --page-bg-accent: rgba(124, 217, 207, 0.14);
  --surface: rgba(16, 23, 37, 0.92);
  --surface-strong: #111a2b;
  --surface-secondary: rgba(15, 23, 42, 0.88);
  --ink: #e8edf8;
  --muted: #9aa8c2;
  --line: rgba(64, 84, 116, 0.72);
  --accent: #7cd9cf;
  --accent-strong: #5ebcb2;
  --mint: #7cd9cf;
  --gold: #ff9e63;
  --gold-strong: #ff8d42;
  --shadow: 0 22px 48px rgba(4, 8, 16, 0.38);
  --shadow-soft: 0 14px 26px rgba(4, 8, 16, 0.28);
  background:
    radial-gradient(900px 540px at 12% 0%, rgba(124, 217, 207, 0.14), transparent 55%),
    linear-gradient(180deg, #111a2b 0%, #0f1725 100%);
}

body[data-theme='poster'] {
  --page-bg: #f5f1fb;
  --page-bg-accent: rgba(224, 171, 255, 0.22);
  --surface: rgba(255, 253, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-secondary: rgba(248, 243, 255, 0.9);
  --ink: #211638;
  --muted: #6c5d8a;
  --line: rgba(208, 191, 230, 0.95);
  --accent: #7b4bd9;
  --accent-strong: #5c2fb0;
  --mint: #0f766e;
  --gold: #c06b00;
  --gold-strong: #9a5100;
  --shadow: 0 22px 44px rgba(56, 28, 94, 0.14);
  --shadow-soft: 0 12px 24px rgba(56, 28, 94, 0.1);
  background:
    radial-gradient(1100px 700px at 92% -8%, rgba(224, 171, 255, 0.24), transparent 55%),
    linear-gradient(180deg, #fffdfb 0%, #f5f1fb 100%);
}

h1,
h2,
h3,
.eyebrow,
.goal-card-title,
.goal-card-status,
.goal-card-commitment,
.brand-text {
  font-family: 'Syne', 'Sora', system-ui, sans-serif;
}

.bg-glow {
  position: fixed;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.12);
  filter: blur(56px);
  right: -120px;
  top: -120px;
  pointer-events: none;
}

body[data-theme='noir'] .bg-glow {
  background: rgba(124, 217, 207, 0.12);
}

body[data-theme='poster'] .bg-glow {
  background: rgba(123, 75, 217, 0.12);
}

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 18px 56px;
}

.site-header {
  width: min(1120px, calc(100vw - 3rem));
  margin: 1rem auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0.6rem;
  z-index: 20;
  min-height: 74px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.34rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-icon {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  clip-path: inset(0 0 8% 8% round 10px);
}

.brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-goal {
  color: var(--ink);
}

body[data-theme='noir'] .brand-goal {
  color: #dbe5f9;
}

.brand-junkie {
  background: linear-gradient(90deg, #ffd978 0%, #f3bb3b 46%, #d48b00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--ink);
}

.pill-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  border: 1px solid rgba(30, 136, 229, 0.35);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  transition: all 120ms ease;
  min-width: 148px;
  text-align: center;
  white-space: nowrap;
}

body[data-theme='noir'] .pill-link {
  color: #8fb9ff;
  border-color: rgba(143, 185, 255, 0.4);
}

body[data-theme='poster'] .pill-link {
  color: #7b4bd9;
  border-color: rgba(123, 75, 217, 0.34);
}

.pill-link:hover {
  background: rgba(30, 136, 229, 0.08);
}

body[data-theme='noir'] .pill-link:hover {
  background: rgba(124, 217, 207, 0.08);
}

body[data-theme='poster'] .pill-link:hover {
  background: rgba(123, 75, 217, 0.08);
}

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

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--mint);
  font-weight: 800;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 0.95;
  margin: 0 0 0.8rem;
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  margin: 0;
}

h3 {
  margin: 0;
}

.muted,
.description,
.goal-card-description,
.goal-card-target,
.goal-card-footer,
.goal-list-lifecycle,
.target-block span,
.target-block strong,
.lifecycle-note {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

#status-card.is-active {
  border-color: rgba(30, 136, 229, 0.42);
  box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.14), var(--shadow);
}

body[data-theme='noir'] #status-card.is-active {
  border-color: rgba(124, 217, 207, 0.5);
  box-shadow: 0 0 0 2px rgba(124, 217, 207, 0.18), var(--shadow);
}

.viewing-pill {
  margin: 0 0 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  border: 1px solid rgba(30, 136, 229, 0.26);
  border-radius: 999px;
  padding: 0.34rem 0.7rem;
  background: rgba(30, 136, 229, 0.1);
}

body[data-theme='noir'] .viewing-pill {
  color: #8ce5db;
  border-color: rgba(124, 217, 207, 0.34);
  background: rgba(124, 217, 207, 0.14);
}

.goal-owner-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.9rem;
}

.goal-owner-row .muted {
  margin: 0;
}

.goal-owner-avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  overflow: hidden;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(30, 136, 229, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.goal-owner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.goal-owner-avatar-fallback {
  color: var(--ink);
  background: linear-gradient(135deg, rgba(30, 136, 229, 0.18), rgba(242, 181, 31, 0.18));
}

body[data-theme='noir'] .goal-owner-avatar {
  border-color: rgba(124, 217, 207, 0.3);
}

.card + .card {
  margin-top: 20px;
}

.card.secondary {
  background: var(--surface-secondary);
}

.description {
  margin: 0 0 1rem;
  font-size: 1.02rem;
  line-height: 1.6;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.1rem 0 1rem;
}

.meta-grid > div,
.target-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  padding: 0.85rem 0.95rem;
}

body[data-theme='noir'] .meta-grid > div,
body[data-theme='noir'] .target-block {
  background: rgba(13, 20, 33, 0.65);
}

.meta-grid span,
.target-block span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-grid strong,
.target-block strong {
  display: block;
  font-size: 1.02rem;
}

.target-block {
  display: grid;
  gap: 0.3rem;
  margin: 0 0 1rem;
}

.lifecycle-note {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

body[data-theme='noir'] .lifecycle-note {
  background: rgba(13, 20, 33, 0.68);
}

.lifecycle-note-grace {
  color: #7a4f00;
  border-color: rgba(242, 181, 31, 0.35);
}

body[data-theme='noir'] .lifecycle-note-grace {
  color: #ffd08d;
}

.lifecycle-note-expired {
  color: #9d2e2e;
  border-color: rgba(194, 59, 59, 0.32);
}

body[data-theme='noir'] .lifecycle-note-expired {
  color: #ff9f9f;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.78rem 1.1rem;
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.goal-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.goal-list-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  min-height: 260px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(255, 244, 223, 0.9), transparent 45%),
    linear-gradient(180deg, var(--surface-strong) 0%, rgba(247, 244, 236, 0.98) 100%);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

body[data-theme='noir'] .goal-list-item {
  border-color: rgba(124, 217, 207, 0.18);
  background:
    radial-gradient(circle at top left, rgba(47, 63, 84, 0.72), transparent 45%),
    linear-gradient(180deg, #111a2b 0%, #0f1725 100%);
}

body[data-theme='poster'] .goal-list-item {
  border-color: rgba(123, 75, 217, 0.18);
  background:
    radial-gradient(circle at top left, rgba(248, 233, 255, 0.94), transparent 45%),
    linear-gradient(180deg, #ffffff 0%, #f8f2ff 100%);
}

.goal-list-item:hover {
  transform: translateY(-2px) rotate(-0.25deg);
  box-shadow: 0 18px 34px rgba(11, 19, 43, 0.12);
}

.goal-list-item.is-selected {
  border-color: rgba(30, 136, 229, 0.56);
  box-shadow: 0 0 0 2px rgba(30, 136, 229, 0.16), 0 20px 36px rgba(13, 35, 72, 0.2);
  transform: translateY(-2px) scale(1.01);
}

body[data-theme='noir'] .goal-list-item.is-selected {
  border-color: rgba(124, 217, 207, 0.56);
  box-shadow: 0 0 0 2px rgba(124, 217, 207, 0.18), 0 20px 36px rgba(3, 8, 16, 0.34);
}

.goal-list-item.is-selected::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  background: linear-gradient(145deg, rgba(30, 136, 229, 0.08), transparent 50%);
}

body[data-theme='noir'] .goal-list-item.is-selected::before {
  background: linear-gradient(145deg, rgba(124, 217, 207, 0.12), transparent 50%);
}

.goal-card-selected-tag {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(30, 136, 229, 0.34);
  color: var(--accent-strong);
  background: rgba(30, 136, 229, 0.12);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  margin-top: -4px;
}

body[data-theme='noir'] .goal-card-selected-tag {
  border-color: rgba(124, 217, 207, 0.4);
  color: #8ce5db;
  background: rgba(124, 217, 207, 0.16);
}

.goal-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.goal-card-owner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.goal-card-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(30, 136, 229, 0.18), rgba(242, 181, 31, 0.18));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.goal-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.goal-card-avatar-fallback {
  font-size: 0.86rem;
}

.goal-card-kicker {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.goal-card-commitment {
  display: block;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.3;
}

.goal-card-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 28px;
  padding: 0.12rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 136, 229, 0.18);
  color: var(--accent-strong);
  background: rgba(30, 136, 229, 0.08);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-theme='noir'] .goal-card-status {
  border-color: rgba(124, 217, 207, 0.18);
  color: #7cd9cf;
  background: rgba(124, 217, 207, 0.08);
}

body[data-theme='poster'] .goal-card-status {
  border-color: rgba(123, 75, 217, 0.18);
  color: #7b4bd9;
  background: rgba(123, 75, 217, 0.08);
}

.goal-card-title {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.goal-card-target {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.5;
}

.goal-card-description {
  margin: 0;
  line-height: 1.55;
  flex: 1;
}

.goal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(223, 212, 189, 0.55);
  font-size: 0.82rem;
}

body[data-theme='noir'] .goal-card-footer {
  border-top-color: rgba(124, 217, 207, 0.14);
}

.goal-list-lifecycle {
  display: block;
  font-size: 0.76rem;
  line-height: 1.35;
  margin-top: -2px;
}

.goal-list-lifecycle-grace {
  color: #7a4f00;
}

.goal-list-lifecycle-expired {
  color: #9d2e2e;
}

.empty-state {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
}

.section-heading-row .muted {
  margin: 0;
}

#status-message {
  min-height: 1.25rem;
}

@media (max-width: 860px) {
  .site-header {
    flex-wrap: wrap;
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 0.1rem;
  }

  .pill-link {
    min-width: auto;
  }

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

  .section-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .shell {
    padding-inline: 14px;
  }

  .site-header {
    width: calc(100vw - 1rem);
    padding-inline: 0.85rem;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }

  .goal-list {
    grid-template-columns: 1fr;
  }

  .goal-list-item {
    min-height: 0;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
