@font-face {
  font-family: "Outfit";
  src: url("fonts/outfit.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #070809;
  --bg-elev: #101316;
  --bg-card: rgba(16, 19, 22, 0.72);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f6f7;
  --text-dim: #9aa3ad;
  --text-mute: #6b737c;
  --work: #16a34a;
  --work-deep: #0f7a36;
  --work-glow: rgba(22, 163, 74, 0.45);
  --off: #dc2626;
  --off-deep: #9f1a1a;
  --off-glow: rgba(220, 38, 38, 0.4);
  --gold: #e8b84a;
  --gold-ring: #e89a12;
  --danger: #fb7185;
  --radius: 22px;
  --radius-sm: 14px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --font-display: "Outfit", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-ui: "Inter", "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100%;
  min-height: 100dvh;
}

body {
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(22, 163, 74, 0.16), transparent 55%),
    radial-gradient(900px 600px at 110% 10%, rgba(220, 38, 38, 0.1), transparent 50%),
    var(--bg);
}

#ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  filter: blur(48px) saturate(1.15);
  transform: scale(1.12);
  opacity: 0.18;
  transition: background-image 400ms var(--ease), opacity 400ms var(--ease);
}

#app {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: calc(var(--sat) + 14px) 16px calc(var(--sab) + 36px);
  min-height: 100dvh;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand-kicker {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 2px;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.todo-badge {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
}

.todo-badge[data-count="0"] {
  color: var(--text-dim);
}

.todo-badge .count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold-ring);
  color: #1a1406;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.todo-badge[data-count="0"] .count {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 16px 16px 14px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
  margin-bottom: 14px;
}

.status-orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.04);
}

.status-card[data-state="work"] .status-orb {
  background: var(--work);
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.14), 0 0 18px var(--work-glow);
}

.status-card[data-state="off"] .status-orb,
.status-card[data-state="holiday"] .status-orb {
  background: var(--off);
  box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.14), 0 0 18px var(--off-glow);
}

.status-copy { min-width: 0; flex: 1; }

.status-kicker {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-bottom: 3px;
}

.status-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.status-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.segmented {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  border-radius: 999px;
  height: 38px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 6px 16px rgba(0, 0, 0, 0.25);
}

.hero {
  position: relative;
  height: min(42vw, 250px);
  min-height: 200px;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  touch-action: pan-y;
  user-select: none;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
  transform: scale(1.02);
  transition: opacity 280ms var(--ease);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 20%, rgba(0, 0, 0, 0.72) 100%);
  pointer-events: none;
}

.hero-meta {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 2;
}

.hero-meta h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.hero-meta p {
  margin: 3px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
}

.nav-btn {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(8, 9, 11, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.nav-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.nav-btn.prev { left: 10px; }
.nav-btn.next { right: 10px; }

.nav-btn svg {
  width: 18px;
  height: 18px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 12px;
  margin: 0 -2px 4px;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  border-color: var(--line-strong);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 2px 0 10px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 550;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.swatch.work { background: var(--work); }
.swatch.off { background: var(--off); }
.swatch.today {
  background: transparent;
  box-shadow: 0 0 0 2px var(--gold-ring);
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 22px;
}

.dow {
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding-bottom: 2px;
}

.day {
  appearance: none;
  border: 0;
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 13px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 140ms var(--ease);
}

.day:empty, .day.blank {
  background: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.day.work {
  background: linear-gradient(180deg, #22c55e 0%, var(--work) 55%, var(--work-deep) 100%);
}

.day.off {
  background: linear-gradient(180deg, #f04444 0%, var(--off) 55%, var(--off-deep) 100%);
}

.day:active { transform: scale(0.96); }

.day.today {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 0 2px var(--bg),
    0 0 0 4px var(--gold-ring),
    0 0 16px rgba(232, 154, 18, 0.35);
  z-index: 1;
}

.day.selected:not(.today) {
  box-shadow:
    inset 0 0 0 2px #fff,
    0 0 0 2px var(--bg),
    0 0 0 4px rgba(255, 255, 255, 0.55);
}

.day.selected.today {
  box-shadow:
    inset 0 0 0 2px #fff,
    0 0 0 2px var(--bg),
    0 0 0 4px var(--gold-ring),
    0 0 16px rgba(232, 154, 18, 0.35);
}

.dot {
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.dot.done { background: rgba(255, 255, 255, 0.4); }

.all-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.all-tile {
  appearance: none;
  border: 1px solid var(--line);
  background: #0c0e10;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  position: relative;
}

.all-tile img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.all-tile .meta {
  padding: 9px 11px 11px;
}

.all-tile h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.all-tile p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.all-tile.current {
  box-shadow: 0 0 0 2px var(--gold-ring);
}

.tile-flag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--gold);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 10px;
}

.section-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.section-title span {
  font-size: 12px;
  color: var(--text-mute);
}

.upcoming-list, .off-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.row {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: inherit;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.row .when {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  min-width: 92px;
}

.row .body { flex: 1; min-width: 0; }

.row .body b {
  display: block;
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row .body span {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 1px;
}

.tag {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
}

.tag.work { background: var(--work); }
.tag.off, .tag.holiday { background: var(--off); }

.off-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.off-chips::-webkit-scrollbar { display: none; }

.off-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 12px 14px;
  min-width: 168px;
}

.off-chip b {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

.off-chip span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-dim);
}

.off-chip.holiday b { color: #fca5a5; }

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}

.sheet-root.open { display: block; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 280ms var(--ease);
}

.sheet-root.ready .sheet-backdrop { opacity: 1; }

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(88dvh, 760px);
  margin: 0 auto;
  width: min(100%, 480px);
  background: #121518;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(110%);
  transition: transform 380ms var(--ease);
  display: flex;
  flex-direction: column;
  padding: 0 16px calc(var(--sab) + 16px);
}

.sheet-root.ready .sheet-panel { transform: translateY(0); }

.handle {
  width: 40px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  margin: 10px auto 12px;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.sheet-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.sheet-head p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 80px;
  padding-bottom: 8px;
}

.empty {
  color: var(--text-mute);
  font-size: 14px;
  text-align: center;
  padding: 22px 8px;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.check {
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: #fff;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}

.check[aria-pressed="true"] {
  background: var(--work);
  border-color: var(--work);
}

.todo-text {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  line-height: 1.35;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: inherit;
  padding: 0;
  outline: none;
}

.todo-item.done .todo-text {
  color: var(--text-mute);
  text-decoration: line-through;
}

.ghost-btn, .text-btn, .primary-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 650;
}

.text-btn {
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  padding: 6px 4px;
}

.sheet-add {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.sheet-add input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  outline: none;
}

.sheet-add input:focus {
  border-color: rgba(232, 184, 74, 0.7);
  box-shadow: 0 0 0 3px rgba(232, 154, 18, 0.18);
}

.primary-btn {
  height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--text);
  color: #0b0d0f;
  font-size: 14px;
  flex: 0 0 auto;
}

.primary-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.sheet-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.linkish {
  appearance: none;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
}

.install-tip {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--sab) + 16px);
  z-index: 30;
  width: min(448px, calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(18, 21, 24, 0.92);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
  display: none;
  align-items: flex-start;
  gap: 10px;
}

.install-tip.show { display: flex; }

.install-tip p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
}

.install-tip p b { color: var(--gold); }

@media (min-width: 860px) {
  body { background: #050606; }

  #app {
    width: 430px;
    margin: 36px auto 48px;
    padding: 22px 18px 32px;
    min-height: calc(100dvh - 84px);
    background: rgba(8, 9, 11, 0.78);
    border: 1px solid var(--line);
    border-radius: 36px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  }

  .hero { height: 230px; }

  .sheet-panel {
    border-radius: 28px;
    bottom: 24px;
    width: 430px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
