/* Short, readable scene changes for the management decisions and each workday. */
.moment-layer {
  --moment-accent: #397a68;
  --moment-surface: #fffdf6;
  --moment-ink: #1d3d3b;
  --moment-muted: #58716a;
  --moment-soft: #e6f1e8;
  --moment-line: #ccddd2;
  --moment-glow: #cce8d5b3;
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  isolation: isolate;
  overflow: hidden;
  overscroll-behavior: contain;
}

.moment-layer[data-phase='work'] {
  --moment-accent: #397a68;
  --moment-glow: #cce8d5b3;
}

.moment-layer[data-phase='night'] {
  --moment-accent: #a7d2bd;
  --moment-surface: #203b43;
  --moment-ink: #f6f4e9;
  --moment-muted: #c0d4d0;
  --moment-soft: #33545b;
  --moment-line: #537078;
  --moment-glow: #32708a7a;
}

.moment-layer[data-phase='dawn'] {
  --moment-accent: #806026;
  --moment-surface: #fffaf0;
  --moment-ink: #463c2a;
  --moment-muted: #766d58;
  --moment-soft: #f6eace;
  --moment-line: #e1d0a9;
  --moment-glow: #f9df9dbd;
}

.moment-layer[data-phase='decision'] {
  --moment-accent: #775b23;
  --moment-surface: #fffaf0;
  --moment-ink: #3d3828;
  --moment-muted: #706952;
  --moment-soft: #f6eacd;
  --moment-line: #dfce9e;
  --moment-glow: #f7dc88b8;
}

.moment-layer[data-phase='warning'] {
  --moment-accent: #a44d3a;
  --moment-surface: #fffaf6;
  --moment-ink: #493931;
  --moment-muted: #73635c;
  --moment-soft: #f8e8df;
  --moment-line: #edcbbb;
  --moment-glow: #f3c9b6a1;
}

.moment-layer[data-phase='victory'] {
  --moment-accent: #3e7146;
  --moment-surface: #fffdf3;
  --moment-ink: #33432e;
  --moment-muted: #60705a;
  --moment-soft: #e7f1da;
  --moment-line: #cbdab9;
  --moment-glow: #d7e8aab8;
}

.moment-scrim {
  position: absolute;
  inset: 0;
  background: #142e35bd;
  backdrop-filter: blur(4px);
  pointer-events: none;
  animation: moment-scrim-in 260ms ease-out both;
}

.moment-layer[data-phase='night'] .moment-scrim {
  background: #0d202bcc;
}

.moment-card {
  position: relative;
  width: min(100%, 610px);
  height: min(760px, calc(
    100dvh - max(16px, env(safe-area-inset-top)) -
      max(16px, env(safe-area-inset-bottom))
  ));
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--moment-line);
  border-radius: 24px;
  background: radial-gradient(circle at 50% 26%, var(--moment-glow), transparent 55%),
    var(--moment-surface);
  box-shadow: 0 26px 75px #091e2673, 0 4px 12px #091e2633;
  color: var(--moment-ink);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  isolation: isolate;
  text-align: center;
}

.moment-card::before {
  content: '';
  position: absolute;
  inset: 0 22px auto;
  height: 4px;
  border-radius: 0 0 8px 8px;
  background: var(--moment-accent);
  opacity: 0.85;
}

.moment-card.moment-enter .moment-content {
  animation: moment-card-enter 370ms cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.moment-topline {
  display: grid;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--moment-line);
}

.moment-content {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 22px clamp(19px, 3.5vw, 31px);
  scrollbar-width: thin;
  scrollbar-color: var(--moment-accent) var(--moment-soft);
  overscroll-behavior: contain;
  display: grid;
  align-content: start;
  gap: 14px;
}

.moment-content:focus-visible {
  outline: 2px solid var(--moment-accent);
  outline-offset: -4px;
}

.moment-kicker,
.moment-eyebrow {
  color: var(--moment-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.moment-kicker {
  text-align: left;
}

.moment-skip {
  flex: none;
  min-height: 44px;
  padding: 5px 11px;
  border: 1px solid var(--moment-line);
  border-radius: 8px;
  background: var(--moment-soft);
  color: var(--moment-ink);
  font-size: 12px;
  font-weight: 700;
}

.moment-visual {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 2px auto 0;
  border: 1px solid var(--moment-line);
  border-radius: 29px;
  background: var(--moment-soft);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 32px var(--moment-glow);
}

.moment-visual::before {
  content: '';
  position: absolute;
  inset: -12px;
  border: 1px solid var(--moment-accent);
  border-radius: 39px;
  opacity: 0.36;
  pointer-events: none;
}

.moment-visual::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid var(--moment-line);
  border-radius: 20px;
  pointer-events: none;
}

.moment-glyph {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  max-width: 86px;
  max-height: 86px;
  font-size: 54px;
  line-height: 1;
  transform-origin: 50% 70%;
}

.moment-glyph img,
img.moment-glyph {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.moment-layer[data-phase='work'] .moment-glyph {
  animation: moment-glyph-work 670ms ease-out both;
}

.moment-layer[data-phase='night'] .moment-visual::before {
  animation: moment-night-halo 1100ms ease-out both;
}

.moment-layer[data-phase='night'] .moment-glyph {
  animation: moment-glyph-night 1050ms ease-in-out both;
}

.moment-layer[data-phase='dawn'] .moment-visual::before,
.moment-layer[data-phase='victory'] .moment-visual::before {
  animation: moment-daybreak 950ms ease-out both;
}

.moment-layer[data-phase='decision'] .moment-visual {
  box-shadow: 0 13px 38px #c99b4b61;
}

.moment-layer[data-phase='decision'] .moment-visual::before {
  animation: moment-decision-ring 900ms ease-out both;
}

.moment-layer[data-phase='decision'] .moment-glyph,
.moment-layer[data-phase='victory'] .moment-glyph {
  animation: moment-glyph-rise 640ms cubic-bezier(0.2, 0.85, 0.25, 1.2) both;
}

.moment-layer[data-phase='warning'] .moment-visual::before {
  opacity: 0.5;
}

.moment-eyebrow {
  margin-top: 1px;
}

.moment-card h2 {
  margin: -7px 0 0;
  color: var(--moment-ink);
  font-size: clamp(23px, 3vw, 31px);
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.moment-card #moment-description {
  max-width: 44em;
  margin: -5px auto 0;
  color: var(--moment-muted);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.moment-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 8px;
}

.moment-metric {
  min-width: 0;
  min-height: 62px;
  padding: 9px 11px;
  border: 1px solid var(--moment-line);
  border-radius: 11px;
  background: var(--moment-soft);
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: left;
}

.moment-metric span {
  color: var(--moment-muted);
  font-size: 12px;
  line-height: 1.4;
}

.moment-metric strong {
  color: var(--moment-ink);
  font-size: clamp(15px, 2.2vw, 19px);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.moment-timeline {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.moment-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 29px;
  padding: 4px 9px;
  border: 1px solid var(--moment-line);
  border-radius: 20px;
  background: transparent;
  color: var(--moment-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
}

.moment-step::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid currentColor;
}

.moment-step.is-current {
  border-color: var(--moment-accent);
  background: var(--moment-soft);
  color: var(--moment-ink);
}

.moment-step.is-current::before,
.moment-step.is-done::before {
  background: var(--moment-accent);
  border-color: var(--moment-accent);
}

.moment-step.is-done {
  color: var(--moment-accent);
}

.moment-bottom {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px 14px;
  padding: 14px 22px;
  border-top: 1px solid var(--moment-line);
  background: var(--moment-surface);
  text-align: left;
}

.moment-tap-hint {
  grid-column: 1 / -1;
  color: var(--moment-muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
}

.moment-caption {
  min-width: 0;
  margin: 0;
  color: var(--moment-muted);
  font-size: 12px;
  line-height: 1.6;
}

.moment-next {
  flex: none;
  width: 152px;
  min-width: 125px;
  min-height: 44px;
  padding: 10px 17px;
  border-radius: 9px;
  background: var(--moment-accent);
  color: var(--moment-surface);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 0 #142a2733;
}

.moment-layer[data-phase='night'] .moment-next {
  color: #17343e;
}

#cash-value.moment-gain,
#cost-value.moment-gain {
  animation: moment-value-gain 620ms ease-out both;
}

#cash-value.moment-loss,
#cost-value.moment-loss {
  animation: moment-value-loss 620ms ease-out both;
}

.owned-asset.moment-asset-new {
  animation: moment-asset-arrive 650ms cubic-bezier(0.18, 0.85, 0.25, 1.15) both;
}

/* The permanent daily receipt is compact enough for the constrained desk view. */
.day-feedback {
  min-width: 0;
  margin: 8px 12px;
  padding: 9px 12px;
  border: 1px solid #c5dbc7;
  border-left: 4px solid #54875b;
  border-radius: 10px;
  background: linear-gradient(110deg, #eff6e9, #fffdf5);
  box-shadow: 0 3px 11px #1d493016;
  display: grid;
  gap: 7px;
}

.day-feedback-head {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: #2a5544;
  font-size: 12px;
  line-height: 1.4;
}

.day-feedback-head strong {
  color: #254d3c;
  font-size: 12px;
}

.day-feedback-head span {
  flex: 1 1 110px;
  min-width: 0;
  color: #536d5a;
  font-size: 10px;
}

.day-feedback-head .text-button {
  white-space: nowrap;
}

.day-feedback-stats {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.day-feedback-stat {
  flex: 1 1 90px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #d5e4d2;
  border-radius: 7px;
  background: #ffffffb8;
  display: grid;
  align-content: center;
  gap: 2px;
}

.day-feedback-stat span {
  min-width: 0;
  color: #5c6e60;
  font-size: 10px;
  white-space: nowrap;
}

.day-feedback-stat strong {
  color: #294c38;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (min-width: 1100px) and (min-height: 720px) {
  .day-feedback {
    margin: 3px 10px;
    padding: 5px 8px;
    gap: 4px;
  }

  .day-feedback-head,
  .day-feedback-head strong,
  .day-feedback-stat strong {
    font-size: 10px;
  }

  .day-feedback-stat {
    min-height: 34px;
    padding: 3px 6px;
  }
}

@media (max-width: 480px) {
  .moment-layer {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .moment-card {
    height: min(760px, calc(
      100dvh - max(10px, env(safe-area-inset-top)) -
        max(10px, env(safe-area-inset-bottom))
    ));
    border-radius: 19px;
  }

  .moment-topline {
    padding: 13px 16px 10px;
  }

  .moment-content {
    padding: 17px;
    gap: 11px;
    scrollbar-width: auto;
  }

  .moment-visual {
    width: 88px;
    height: 88px;
    border-radius: 23px;
  }

  .moment-visual::before {
    inset: -7px;
    border-radius: 29px;
  }

  .moment-visual::after {
    inset: 8px;
  }

  .moment-glyph {
    font-size: 44px;
  }

  .moment-glyph img,
  img.moment-glyph {
    width: 68px;
    height: 68px;
  }

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

  .moment-metric {
    min-height: 58px;
    padding: 8px 9px;
  }

  .moment-bottom {
    padding: 11px 16px;
    gap: 10px;
  }

  .moment-next {
    min-width: 106px;
    padding-inline: 10px;
  }

  .day-feedback {
    margin: 7px 10px;
    padding: 9px;
  }
}

@media (max-height: 600px) {
  .moment-content {
    gap: 8px;
    padding-block: 15px;
  }

  .moment-topline {
    padding-block: 10px 8px;
    gap: 5px;
  }

  .moment-bottom {
    padding-block: 9px;
  }

  .moment-visual {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  .moment-glyph {
    font-size: 37px;
  }

  .moment-glyph img,
  img.moment-glyph {
    width: 56px;
    height: 56px;
  }
}

.moment-layer[data-reduced='true'],
.moment-layer[data-reduced='true'] *,
.moment-layer[data-reduced='true'] *::before,
.moment-layer[data-reduced='true'] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
  transform: none !important;
}

@keyframes moment-scrim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes moment-card-enter {
  from { opacity: 0; transform: translateY(15px) scale(0.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes moment-glyph-work {
  from { opacity: 0.7; transform: translateY(8px) rotate(-5deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes moment-glyph-night {
  from { opacity: 0.65; transform: translateY(5px) scale(0.94); }
  55% { opacity: 1; transform: translateY(-5px) scale(1.04); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes moment-night-halo {
  from { opacity: 0.08; transform: scale(0.84); }
  to { opacity: 0.52; transform: scale(1); }
}

@keyframes moment-daybreak {
  from { opacity: 0.12; transform: scale(0.7); }
  to { opacity: 0.55; transform: scale(1.13); }
}

@keyframes moment-decision-ring {
  from { opacity: 0; transform: scale(0.76); }
  55% { opacity: 0.7; }
  to { opacity: 0.48; transform: scale(1.1); }
}

@keyframes moment-glyph-rise {
  from { opacity: 0.55; transform: translateY(11px) scale(0.84); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes moment-value-gain {
  from { color: #327652; transform: translateY(4px) scale(1.1); }
  to { transform: translateY(0) scale(1); }
}

@keyframes moment-value-loss {
  from { color: #a2513c; transform: translateY(4px) scale(1.1); }
  to { transform: translateY(0) scale(1); }
}

@keyframes moment-asset-arrive {
  from { opacity: 0; transform: translateY(12px) scale(0.82); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion='full']) .moment-layer,
  html:not([data-motion='full']) .moment-layer *,
  html:not([data-motion='full']) .moment-layer *::before,
  html:not([data-motion='full']) .moment-layer *::after,
  html:not([data-motion='full']) .day-feedback,
  html:not([data-motion='full']) .day-feedback *,
  html:not([data-motion='full']) .day-feedback *::before,
  html:not([data-motion='full']) .day-feedback *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
    transform: none !important;
  }

  html:not([data-motion='full']) #cash-value.moment-gain,
  html:not([data-motion='full']) #cash-value.moment-loss,
  html:not([data-motion='full']) #cost-value.moment-gain,
  html:not([data-motion='full']) #cost-value.moment-loss,
  html:not([data-motion='full']) .owned-asset.moment-asset-new {
    animation: none !important;
    transform: none !important;
  }
}
