/* Lumen — skincare ritual PWA */
:root {
  --ink: #081412;
  --ink-2: #0d1c19;
  --panel: rgba(14, 32, 28, 0.72);
  --panel-border: rgba(126, 201, 176, 0.16);
  --mist: #eef6f2;
  --mist-dim: rgba(238, 246, 242, 0.62);
  --mist-faint: rgba(238, 246, 242, 0.16);
  --mint: #7ec9b0;
  --mint-soft: rgba(126, 201, 176, 0.28);
  --moon: #9bb4d4;
  --sun: #e2c58a;
  --warn: #d4896a;
  --ok: #7ec9b0;
  --partial: #c9b07a;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ring: 314.16; /* 2 * pi * 50 */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--mist);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(100% 70% at 50% -10%, #14302a 0%, var(--ink) 55%),
    linear-gradient(180deg, #071210 0%, #0a1613 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: drift 20s var(--ease) infinite alternate;
  will-change: transform;
}

.orb-a {
  width: 58vw;
  height: 58vw;
  top: -12%;
  left: -18%;
  background: #2f6f5f;
  opacity: 0.34;
}

.orb-b {
  width: 48vw;
  height: 48vw;
  bottom: 8%;
  right: -14%;
  background: #3a5478;
  opacity: 0.28;
  animation-duration: 26s;
  animation-delay: -5s;
}

.orb-c {
  width: 32vw;
  height: 32vw;
  top: 42%;
  left: 38%;
  background: var(--mint);
  opacity: 0.12;
  animation-duration: 22s;
  animation-delay: -9s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4%, -3%, 0) scale(1.08); }
}

.app {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding:
    calc(12px + var(--safe-top)) 16px
    calc(88px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 35% 30%, #c8efe0 0%, transparent 42%),
    linear-gradient(145deg, #6fb89f, #1f4a3f);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-top-color: transparent;
  border-left-color: transparent;
  transform: rotate(-20deg);
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
}

.brand-tag {
  margin: 4px 0 0;
  color: var(--mist-dim);
  font-size: 0.82rem;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--mist);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--mist-faint);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.icon-btn:active {
  transform: scale(0.96);
  background: rgba(126, 201, 176, 0.12);
}

.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.past-banner,
.rest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
}

.past-banner {
  background: rgba(196, 64, 64, 0.18);
  border: 1px solid rgba(220, 80, 80, 0.45);
}

.rest-banner {
  background: rgba(212, 137, 106, 0.14);
  border: 1px solid rgba(212, 137, 106, 0.35);
}

.past-banner strong {
  display: block;
  color: #ff9b9b;
  font-size: 0.92rem;
}

.rest-banner strong {
  display: block;
  color: #f0c2ad;
  font-size: 0.92rem;
}

.past-banner p,
.rest-banner p {
  margin: 4px 0 0;
  color: var(--mist-dim);
  font-size: 0.82rem;
  line-height: 1.4;
}

.past-banner p {
  color: #ffd0d0;
  font-weight: 600;
}

.views {
  flex: 1;
}

.view {
  display: none;
  animation: rise 0.35s var(--ease);
}

.view.is-active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.hero-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
}

.ring-wrap {
  position: relative;
  width: 96px;
  height: 96px;
}

.progress-ring {
  width: 96px;
  height: 96px;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.ring-progress {
  fill: none;
  stroke: var(--mint);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: var(--ring);
  stroke-dashoffset: var(--ring);
  transition: stroke-dashoffset 0.55s var(--ease), stroke 0.3s ease;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.ring-center span {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
}

.ring-center small {
  color: var(--mist-dim);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mint);
  font-weight: 700;
}

.eyebrow.sun { color: var(--sun); }
.eyebrow.moon { color: var(--moon); }

.hero-copy h2,
.routine-block h3,
.guide-card h2,
.guide-card h3,
.cal-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.hero-copy h2 {
  font-size: 1.55rem;
  line-height: 1.15;
}

.muted {
  color: var(--mist-dim);
  line-height: 1.5;
}

.hero-copy .muted {
  margin: 6px 0 0;
  font-size: 0.9rem;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--mist-faint);
  color: var(--mist-dim);
}

.chip.ok {
  color: var(--mint);
  border-color: rgba(126, 201, 176, 0.35);
  background: rgba(126, 201, 176, 0.1);
}

.chip.warn {
  color: #f0c2ad;
  border-color: rgba(212, 137, 106, 0.35);
  background: rgba(212, 137, 106, 0.1);
}

.routine-block {
  padding: 4px 2px 2px;
}

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

.block-head h3 {
  font-size: 1.35rem;
}

.block-note {
  margin: -2px 0 12px;
  color: var(--mist-dim);
  font-size: 0.88rem;
  line-height: 1.45;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 600;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn.sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8rem;
  border-radius: 11px;
}

.btn.primary {
  background: linear-gradient(135deg, #7ec9b0, #4f9f88);
  color: #06201a;
}

.btn.secondary {
  background: rgba(126, 201, 176, 0.12);
  border: 1px solid rgba(126, 201, 176, 0.28);
  color: var(--mist);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--mist-faint);
  color: var(--mist-dim);
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.18s var(--ease);
}

.step:active {
  transform: scale(0.99);
}

.step.is-done {
  background: rgba(126, 201, 176, 0.1);
  border-color: rgba(126, 201, 176, 0.28);
}

.step-check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(238, 246, 242, 0.28);
  display: grid;
  place-items: center;
  margin-top: 1px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.step.is-done .step-check {
  background: var(--mint);
  border-color: var(--mint);
  color: #06201a;
}

.step-check svg {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.step.is-done .step-check svg {
  opacity: 1;
  transform: scale(1);
}

.step-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.98rem;
}

.step-desc {
  margin: 4px 0 0;
  color: var(--mist-dim);
  font-size: 0.82rem;
  line-height: 1.4;
}

.step.is-done .step-title {
  text-decoration: line-through;
  text-decoration-color: rgba(126, 201, 176, 0.45);
}

.note-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
}

.note-field span,
.field span {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist-dim);
  font-weight: 600;
}

.note-field textarea,
.field input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  padding: 0;
  line-height: 1.45;
}

.note-field textarea::placeholder,
.field input::placeholder {
  color: rgba(238, 246, 242, 0.28);
}

/* Calendar */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px;
}

.cal-header h2 {
  font-size: 1.4rem;
}

.cal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--mist-faint);
  text-align: center;
}

.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
}

.stat span {
  color: var(--mist-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.cal-dow {
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mist-dim);
  padding: 4px 0 8px;
  font-weight: 600;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--mist-dim);
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}

.cal-day:disabled {
  opacity: 0.25;
}

.cal-day:not(:disabled):active {
  transform: scale(0.96);
}

.cal-day .num {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--mist);
}

.cal-day .mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}

.cal-day.full {
  background: rgba(126, 201, 176, 0.16);
  border-color: rgba(126, 201, 176, 0.3);
}

.cal-day.full .mark { background: var(--ok); }

.cal-day.partial {
  background: rgba(201, 176, 122, 0.14);
  border-color: rgba(201, 176, 122, 0.28);
}

.cal-day.partial .mark { background: var(--partial); }

.cal-day.rest-day {
  background: rgba(212, 137, 106, 0.12);
  border-color: rgba(212, 137, 106, 0.28);
}

.cal-day.rest-day .mark { background: var(--warn); }

.cal-day.is-today {
  box-shadow: inset 0 0 0 1.5px rgba(126, 201, 176, 0.55);
}

.cal-day.is-selected {
  border-color: var(--mint);
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  color: var(--mist-dim);
  font-size: 0.78rem;
}

.cal-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.full { background: var(--ok); }
.dot.partial { background: var(--partial); }
.dot.empty { background: rgba(255, 255, 255, 0.2); }
.dot.rest { background: var(--warn); }

.cal-day-detail {
  padding: 16px;
}

.cal-day-detail h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.cal-day-detail p {
  margin: 0;
  color: var(--mist-dim);
  font-size: 0.9rem;
  line-height: 1.45;
}

.cal-day-detail .detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* Guide */
.guide-card {
  padding: 18px;
}

.guide-card h2,
.guide-card h3 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.guide-card p {
  margin: 0;
  color: var(--mist-dim);
  line-height: 1.55;
}

.guide-steps {
  margin: 10px 0 0;
  padding-left: 1.15rem;
  color: var(--mist);
  line-height: 1.55;
}

.guide-steps li + li {
  margin-top: 6px;
}

.guide-card .tip {
  margin-top: 12px;
  font-size: 0.88rem;
}

.guide-card.warn {
  border-color: rgba(212, 137, 106, 0.35);
  background: rgba(212, 137, 106, 0.08);
}

.guide-card.warn .eyebrow {
  color: #f0c2ad;
}

/* Tabs */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: rgba(8, 20, 18, 0.88);
  border-top: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 20;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 14px;
  color: var(--mist-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tab.is-active {
  color: var(--mint);
  background: rgba(126, 201, 176, 0.1);
}

/* Sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  animation: fade 0.2s ease;
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  max-height: min(88dvh, 760px);
  overflow: auto;
  z-index: 50;
  background: #0e1f1b;
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(22px + var(--safe-bottom));
  animation: sheet-up 0.28s var(--ease);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 4px auto 14px;
}

.sheet h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 1.7rem;
}

.settings-block {
  margin-bottom: 22px;
}

.settings-block h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.settings-block > .muted {
  margin: 0 0 12px;
  font-size: 0.88rem;
}

.night-a-info {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(155, 180, 212, 0.1);
  border: 1px solid rgba(155, 180, 212, 0.28);
  font-size: 0.88rem;
  line-height: 1.45;
}

.night-a-info strong {
  color: var(--moon);
  font-weight: 600;
}

.day-toggles {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-toggle {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--mist-faint);
  background: rgba(255, 255, 255, 0.04);
  color: var(--mist-dim);
  font-size: 0.72rem;
  font-weight: 700;
}

.day-toggle.is-on {
  background: rgba(155, 180, 212, 0.18);
  border-color: rgba(155, 180, 212, 0.45);
  color: var(--moon);
}

.rest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--mist-faint);
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 60;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(18, 40, 34, 0.95);
  border: 1px solid rgba(126, 201, 176, 0.3);
  color: var(--mist);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  animation: rise 0.25s var(--ease);
  max-width: min(420px, calc(100% - 32px));
  text-align: center;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheet-up {
  from { transform: translate(-50%, 24px); opacity: 0.6; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

html.is-standalone .app {
  padding-top: calc(8px + var(--safe-top));
}

@media (min-width: 640px) {
  .hero-progress {
    padding: 22px;
  }

  .hero-copy h2 {
    font-size: 1.75rem;
  }
}
