:root {
  color-scheme: light;
  --ink: #27211d;
  --muted: #7b7168;
  --line: #eaded0;
  --paper: #fbf6ee;
  --panel: #fffdf8;
  --mint: #8fc8b4;
  --mint-dark: #4f927f;
  --coral: #e97667;
  --sky: #f3b19e;
  --shadow: 0 18px 60px rgba(95, 74, 63, 0.14);
  --app-height: 100dvh;
  --app-width: 100vw;
  --control-font-size: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}

body {
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  display: grid;
  gap: 8px;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: var(--app-height);
  max-height: var(--app-height);
  min-height: 0;
  overflow: hidden;
  padding: max(8px, env(safe-area-inset-top)) clamp(8px, 2vw, 16px) max(8px, env(safe-area-inset-bottom));
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 560px;
  min-height: 42px;
  width: 100%;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-size: 1.14rem;
  font-weight: 820;
  gap: 11px;
  letter-spacing: 0;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background:
    radial-gradient(circle at 49% 51%, transparent 0 12%, #c9ded1 13% 16%, transparent 17% 26%, var(--mint) 27% 31%, transparent 32% 41%, #7fad9b 42% 46%, transparent 47% 55%, var(--mint-dark) 56% 61%, transparent 62%),
    #fffdf8;
  border-radius: 50%;
  box-shadow: 0 5px 12px rgba(95, 74, 63, 0.12);
  display: inline-flex;
  flex: 0 0 44px;
  height: 44px;
  justify-content: center;
  position: relative;
  width: 44px;
}

.brand-mark::after {
  color: var(--coral);
  content: "♥";
  font-size: 14px;
  line-height: 1;
  transform: translateY(1px);
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.sync-pill {
  background: #eaf6f1;
  border: 1px solid #cae7dc;
  border-radius: 999px;
  color: var(--mint-dark);
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 740;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

.workspace {
  height: 100%;
  margin: 0 auto;
  max-width: 560px;
  min-height: 0;
  width: 100%;
}

.capture-panel,
.player-panel,
.timeline-panel,
.family-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tab-panel {
  animation: tabIn 180ms ease both;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 10px;
}

.tab-panel:not(.active) {
  display: none;
}

@keyframes tabIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.panel-header.compact {
  align-items: center;
  margin-bottom: 8px;
}

.eyebrow {
  color: var(--coral);
  font-size: 0.66rem;
  font-weight: 800;
  margin: 0 0 2px;
  text-transform: uppercase;
}

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0;
}

h1 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  max-width: 540px;
}

#captureTitle {
  font-size: 1.02rem;
  font-weight: 860;
  white-space: nowrap;
}

h2 {
  font-size: 1.06rem;
}

.capture-fields {
  align-items: center;
  display: grid;
  flex: 1 1 0;
  gap: 0 6px;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.capture-fields label {
  font-size: 0.62rem;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.capture-fields .date-display-button,
.capture-fields select {
  border-radius: 6px;
  font-size: 0.68rem;
  min-height: 26px;
  min-width: 0;
  padding: 0 7px;
  width: 100%;
}

.date-display-button {
  appearance: none;
  background: #fbfdfc;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 760;
  outline: none;
  text-align: left;
}

.date-display-button:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(53, 196, 157, 0.16);
}

.storage-hint {
  color: var(--muted);
  display: block;
  font-size: 0.62rem;
  line-height: 1.22;
  margin: -2px 0 7px;
  max-width: 100%;
  text-align: right;
  white-space: nowrap;
}

.capture-status {
  align-items: center;
  background: rgba(241, 250, 246, 0.92);
  border: 1px solid rgba(207, 238, 226, 0.92);
  border-radius: 8px;
  bottom: 8px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  left: 8px;
  padding: 7px 8px;
  position: absolute;
  right: 8px;
  z-index: 5;
}

.capture-status.warning {
  background: #fff7ee;
  border-color: #f5d4b4;
}

.capture-status.blocked {
  background: #fff2f0;
  border-color: #f4c2bb;
}

.capture-status div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.capture-status strong {
  font-size: 0.78rem;
}

.capture-status span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.capture-status a {
  background: var(--ink);
  border-radius: 8px;
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 7px 9px;
  text-decoration: none;
}

label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

input[type="date"],
input[type="text"] {
  appearance: none;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--control-font-size);
  min-height: 38px;
  outline: none;
  padding: 0 12px;
  width: 100%;
}

select {
  appearance: none;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 38px;
  outline: none;
  padding: 0 12px;
  width: 100%;
}

input[type="date"]:focus,
input[type="text"]:focus,
select:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(53, 196, 157, 0.16);
}

.camera-stage {
  aspect-ratio: 4 / 5;
  background: #121715;
  border: 9px solid #ffffff;
  border-bottom-width: 28px;
  border-radius: 8px;
  box-shadow:
    0 18px 34px rgba(16, 20, 19, 0.16),
    inset 0 0 0 1px rgba(16, 20, 19, 0.08);
  isolation: isolate;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.capture-panel,
.player-panel {
  display: grid;
}

.capture-panel {
  align-content: start;
  grid-template-rows: auto auto auto auto;
  justify-items: stretch;
}

.capture-panel .camera-stage {
  align-self: start;
  aspect-ratio: 4 / 5;
  height: auto;
  justify-self: center;
  max-height: min(100%, 62vh);
  min-height: 0;
  max-width: 100%;
  width: min(100%, 420px);
}

.camera-stage video,
.camera-stage img,
.guide-overlay,
.camera-empty {
  border-radius: 5px;
  inset: 0;
  position: absolute;
}

.camera-stage video {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.photo-preview {
  display: none;
  height: 100%;
  object-fit: cover;
  width: 100%;
  z-index: 1;
}

.photo-preview.visible {
  display: block;
}

.flash-button {
  align-items: center;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 999px;
  box-shadow: 0 7px 18px rgba(18, 23, 21, 0.18);
  color: rgba(255, 255, 255, 0.92);
  display: inline-flex;
  height: 38px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 10px;
  top: 10px;
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease,
    opacity 0.16s ease;
  width: 38px;
  z-index: 6;
}

.flash-button svg {
  fill: currentColor;
  filter: drop-shadow(0 1px 2px rgba(18, 23, 21, 0.46));
  height: 19px;
  width: 19px;
}

.flash-button.active {
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 7px 20px rgba(255, 207, 102, 0.38),
    0 0 0 4px rgba(255, 207, 102, 0.16);
  color: #d8891d;
}

.flash-button:disabled,
.flash-button.unsupported {
  opacity: 0.74;
}

.camera-stage.user-facing video {
  transform: scaleX(-1);
}

.ghost-image {
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  width: 100%;
  z-index: 2;
}

.ghost-image.visible {
  opacity: var(--ghost-opacity, 0.34);
}

.guide-overlay {
  border: 1px solid rgba(255, 255, 255, 0.34);
  --guide-soft: rgba(255, 255, 255, 0.32);
  --guide-strong: rgba(53, 196, 157, 0.95);
  --guide-warm: rgba(242, 111, 91, 0.78);
  z-index: 3;
}

.grid-line,
.guide-line,
.center-line,
.safe-frame,
.golden-line,
.face-high-oval,
.headroom-line,
.headroom-arc,
.shoulder-line {
  display: none;
  position: absolute;
}

.grid-line,
.guide-line,
.center-line,
.headroom-line,
.shoulder-line {
  background: var(--guide-soft);
}

.camera-stage.guide-none .guide-overlay {
  display: none;
}

.camera-stage.guide-face .face-oval,
.camera-stage.guide-face .guide-line,
.camera-stage.guide-grid .grid-line,
.camera-stage.guide-face-high .face-high-oval,
.camera-stage.guide-headroom .headroom-line,
.camera-stage.guide-headroom .headroom-arc,
.camera-stage.guide-shoulders .shoulder-line,
.camera-stage.guide-center .center-line,
.camera-stage.guide-safe .safe-frame,
.camera-stage.guide-golden .golden-line {
  display: block;
}

.grid-v {
  height: 100%;
  top: 0;
  width: 1px;
}

.grid-h {
  height: 1px;
  left: 0;
  width: 100%;
}

.v1 {
  left: 33.333%;
}

.v2 {
  left: 66.666%;
}

.h1 {
  top: 33.333%;
}

.h2 {
  top: 66.666%;
}

.face-oval {
  border: 2px solid var(--guide-strong);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(18, 23, 21, 0.12);
  display: none;
  height: 44%;
  left: 50%;
  position: absolute;
  top: 45%;
  transform: translate(-50%, -50%);
  width: 48%;
}

.face-high-oval {
  border: 2px solid rgba(255, 207, 102, 0.92);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(18, 23, 21, 0.16),
    0 0 0 999px rgba(18, 23, 21, 0.08);
  height: 42%;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%);
  width: 47%;
}

.headroom-line {
  height: 2px;
  left: 26%;
  top: 18%;
  width: 48%;
}

.headroom-arc {
  border: 2px dashed rgba(255, 207, 102, 0.82);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  height: 12%;
  left: 32%;
  top: 20%;
  width: 36%;
}

.shoulder-line {
  height: 2px;
  top: 72%;
  width: 28%;
}

.shoulder-line.left {
  left: 22%;
  transform: rotate(7deg);
  transform-origin: right center;
}

.shoulder-line.right {
  right: 22%;
  transform: rotate(-7deg);
  transform-origin: left center;
}

.guide-line {
  height: 2px;
  left: 27%;
  width: 46%;
}

.eye-line {
  top: 38%;
}

.nose-line {
  background: var(--guide-warm);
  top: 48%;
}

.mouth-line {
  top: 57%;
}

.center-v {
  height: 50%;
  left: 50%;
  top: 22%;
  width: 1px;
}

.center-h {
  height: 1px;
  left: 23%;
  top: 50%;
  width: 54%;
}

.safe-frame {
  border: 2px dashed rgba(255, 255, 255, 0.62);
  border-radius: 7px;
  box-shadow:
    0 0 0 1px rgba(18, 23, 21, 0.22),
    inset 0 0 0 999px rgba(18, 23, 21, 0.04);
  inset: 7%;
}

.golden-line {
  background: rgba(255, 207, 102, 0.74);
  box-shadow: 0 0 0 1px rgba(18, 23, 21, 0.1);
}

.golden-v {
  height: 100%;
  top: 0;
  width: 1px;
}

.golden-h {
  height: 1px;
  left: 0;
  width: 100%;
}

.golden-v1 {
  left: 38.2%;
}

.golden-v2 {
  left: 61.8%;
}

.golden-h1 {
  top: 38.2%;
}

.golden-h2 {
  top: 61.8%;
}

.camera-empty {
  align-items: center;
  background: radial-gradient(circle at center, rgba(53, 196, 157, 0.14), rgba(18, 23, 21, 0.82));
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  text-align: center;
  z-index: 4;
}

.camera-empty strong {
  font-size: 1.1rem;
}

.camera-empty span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
}

.camera-empty.hidden {
  display: none;
}

.camera-controls,
.player-controls {
  align-items: center;
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.camera-controls {
  grid-template-columns: minmax(0, 1fr);
}

.camera-primary-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
}

.tool-button,
.primary-action,
.icon-button,
.toggle-control {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  font-weight: 780;
  gap: 5px;
  justify-content: center;
  min-height: 38px;
}

.tool-button,
.icon-button,
.toggle-control {
  background: #fbfdfc;
  color: var(--ink);
}

.tool-button {
  padding: 0 14px;
}

.primary-action {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  flex: 1 1 128px;
  min-height: 44px;
  padding: 0 12px;
}

#startCameraButton,
#captureButton {
  background: var(--coral);
  border-color: #d84d3d;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(242, 111, 91, 0.28);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 880;
  min-height: 50px;
}

.camera-primary-row #startCameraButton,
.camera-primary-row #captureButton {
  grid-column: 3;
  min-width: 0;
  width: 100%;
}

#startCameraButton span:first-child,
#captureButton span:first-child {
  background: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px var(--coral);
  color: transparent;
  flex: 0 0 22px;
  font-size: 0;
  height: 22px;
  width: 22px;
}

.camera-icon-button {
  border-radius: 999px;
  flex: 0 0 46px;
  font-size: 1.06rem;
  height: 46px;
  min-height: 46px;
  padding: 0;
  width: 46px;
}

#flipCameraButton {
  grid-column: 1;
}

#fallbackPhotoButton {
  color: var(--mint-dark);
  grid-column: 4;
}

.ghost-toggle {
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  gap: 7px;
  grid-column: 2;
  min-height: 34px;
  padding: 0 12px 0 7px;
  position: relative;
}

.ghost-toggle input {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.ghost-switch {
  background: #d7e4df;
  border-radius: 999px;
  flex: 0 0 30px;
  height: 18px;
  position: relative;
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
  width: 30px;
}

.ghost-switch::after {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(18, 23, 21, 0.24);
  content: "";
  height: 14px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: transform 0.18s ease;
  width: 14px;
}

.ghost-toggle input:checked + .ghost-switch {
  background: var(--mint-dark);
  box-shadow: 0 0 0 3px rgba(53, 196, 157, 0.13);
}

.ghost-toggle input:checked + .ghost-switch::after {
  transform: translateX(12px);
}

.primary-action span:first-child {
  background: var(--coral);
  border: 2px solid #ffffff;
  border-radius: 50%;
  height: 16px;
  width: 16px;
}

.compact-action {
  flex: none;
  grid-column: auto;
  min-height: 42px;
  order: 0;
  width: 100%;
}

.icon-button {
  flex: 0 0 42px;
  font-size: 1.1rem;
  height: 42px;
  padding: 0;
  width: 42px;
}

.icon-button.danger {
  color: #b23429;
}

.tool-button.danger {
  border-color: #f0c3bb;
  color: #b23429;
}

.settings-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.toggle-control {
  padding: 0 12px;
}

.toggle-control input {
  accent-color: var(--mint-dark);
}

.last-shot {
  align-items: center;
  background: #f4f8f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 58px 1fr;
  margin-top: 8px;
  padding: 8px;
}

.last-shot img {
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  object-fit: cover;
  width: 58px;
}

.last-shot div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.last-shot span {
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-frame {
  background: #111513;
  border-radius: 8px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.player-panel {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.player-frame img {
  display: none;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.player-frame img.visible {
  display: block;
}

.player-empty {
  align-items: center;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: absolute;
  text-align: center;
}

.loop-status {
  background: #f4f8f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 8px 10px;
}

.loop-status strong {
  font-size: 0.88rem;
}

.loop-status span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.player-controls {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.speed-buttons {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
}

.speed-button {
  align-items: center;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 820;
  justify-content: center;
  min-height: 34px;
  padding: 0 7px;
}

.speed-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.period-range-group {
  display: grid;
  gap: 5px;
  grid-column: 1 / -1;
}

.period-range-header,
.period-slider-row {
  align-items: center;
  display: grid;
  gap: 6px;
}

.period-range-header {
  grid-template-columns: minmax(0, 1fr) auto;
}

.period-slider-row {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
  grid-template-columns: 34px minmax(0, 1fr);
}

.period-label {
  min-width: 0;
  white-space: nowrap;
}

.period-label span {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 860;
}

#periodStartRange:disabled,
#periodEndRange:disabled {
  opacity: 0.38;
}

input[type="range"] {
  accent-color: var(--mint-dark);
  width: 100%;
}

#frameCounter {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
  text-align: right;
}

.timeline-list {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.timeline-panel,
.family-panel {
  overflow: auto;
}

.timeline-swipe-row {
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.timeline-delete-action {
  align-items: center;
  background: #d94c3c;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  display: flex;
  font-size: 0.8rem;
  font-weight: 860;
  inset: 0 0 0 auto;
  justify-content: center;
  position: absolute;
  width: 88px;
}

.timeline-card {
  align-items: center;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 54px 1fr auto;
  min-height: 72px;
  padding: 8px;
  position: relative;
  text-align: left;
  touch-action: pan-y;
  transition:
    box-shadow 0.18s ease,
    transform 0.18s ease;
  width: 100%;
  z-index: 1;
}

.timeline-card.active {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(53, 196, 157, 0.13);
}

.timeline-swipe-row.open .timeline-card {
  transform: translateX(-88px);
}

.timeline-card.dragging {
  transition: none;
}

.timeline-card img {
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  object-fit: cover;
  width: 54px;
}

.timeline-card strong,
.timeline-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-card strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.timeline-card span {
  color: var(--muted);
  font-size: 0.78rem;
}

.timeline-card .sync-state {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.66rem;
  font-weight: 840;
  margin-top: 4px;
  max-width: 100%;
  padding: 3px 7px;
  width: fit-content;
}

.sync-state.synced {
  background: #eaf6f1;
  color: var(--mint-dark);
}

.sync-state.uploading {
  background: #fff7ee;
  color: #9f6232;
}

.sync-state.failed {
  background: #fff2f0;
  color: #b23429;
}

.timeline-card time {
  color: var(--mint-dark);
  font-size: 0.72rem;
  font-weight: 820;
}

.date-picker {
  inset: 0;
  position: fixed;
  z-index: 18;
}

.date-picker-backdrop {
  background: rgba(18, 23, 21, 0.2);
  inset: 0;
  position: absolute;
}

.date-picker-sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  bottom: max(62px, env(safe-area-inset-bottom));
  box-shadow: 0 14px 42px rgba(16, 20, 19, 0.18);
  display: grid;
  gap: 7px;
  left: 50%;
  max-width: min(316px, calc(100vw - 28px));
  padding: 9px;
  position: absolute;
  transform: translateX(-50%);
  width: max-content;
}

.date-picker-header {
  align-items: center;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 6px;
}

.date-picker-header strong {
  font-size: 0.9rem;
  font-weight: 860;
  text-align: center;
}

.date-picker-nav {
  border-radius: 999px;
  font-size: 1.15rem;
  height: 32px;
  min-height: 32px;
  padding: 0;
  width: 32px;
}

.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.date-picker-weekdays {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 780;
  text-align: center;
}

.date-picker-grid {
  gap: 3px;
}

.date-picker-spacer,
.date-picker-day {
  aspect-ratio: 1;
  min-width: 0;
}

.date-picker-day {
  align-items: center;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 780;
  height: 34px;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  position: relative;
  width: 34px;
}

.date-picker-day.today {
  border-color: var(--mint-dark);
  color: var(--mint-dark);
}

.date-picker-day.recorded {
  align-items: flex-start;
  background: rgba(75, 166, 112, 0.2);
  border-color: rgba(54, 137, 88, 0.42);
  color: rgba(24, 48, 37, 0.86);
  font-size: 0.58rem;
  justify-content: flex-start;
  padding: 4px;
}

.date-picker-day.recorded::after {
  color: #e74b5b;
  content: "♥";
  font-size: 0.44rem;
  left: 50%;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -35%);
  z-index: 1;
}

.date-picker-day.recorded::before {
  background:
    radial-gradient(circle at 49% 51%, transparent 0 16%, #c9ded1 17% 21%, transparent 22% 33%, var(--mint) 34% 39%, transparent 40% 52%, #7fad9b 53% 59%, transparent 60%),
    rgba(255, 253, 248, 0.88);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(55, 92, 74, 0.16);
  content: "";
  height: 17px;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -42%);
  width: 17px;
}

.date-picker-day.recorded.today {
  border-color: var(--mint-dark);
}

.date-picker-day.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.date-picker-day.recorded.selected::after {
  color: #ff6470;
}

.date-picker-day.recorded.selected::before {
  background:
    radial-gradient(circle at 49% 51%, transparent 0 16%, rgba(201, 222, 209, 0.95) 17% 21%, transparent 22% 33%, rgba(143, 200, 180, 0.92) 34% 39%, transparent 40% 52%, rgba(127, 173, 155, 0.9) 53% 59%, transparent 60%),
    rgba(255, 253, 248, 0.16);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.date-picker-actions {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
}

.date-picker-actions .tool-button,
.date-picker-actions .primary-action {
  font-size: 0.76rem;
  min-height: 34px;
}

.replace-confirm {
  inset: 0;
  position: fixed;
  z-index: 19;
}

.replace-confirm-backdrop {
  background: rgba(18, 23, 21, 0.3);
  inset: 0;
  position: absolute;
}

.replace-confirm-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(16, 20, 19, 0.2);
  display: grid;
  gap: 9px;
  left: 50%;
  max-width: min(320px, calc(100vw - 32px));
  padding: 14px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

.replace-confirm-card strong {
  font-size: 0.98rem;
  line-height: 1.25;
}

.replace-confirm-card span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.replace-confirm-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.replace-confirm-actions .tool-button,
.replace-confirm-actions .primary-action {
  font-size: 0.8rem;
  min-height: 38px;
}

.toast {
  background: var(--ink);
  border-radius: 999px;
  bottom: max(18px, env(safe-area-inset-bottom));
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 740;
  left: 50%;
  max-width: calc(100vw - 28px);
  opacity: 0;
  padding: 11px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 18px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bottom-tabs {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 44px rgba(16, 20, 19, 0.16);
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 560px;
  padding: 4px;
  width: 100%;
  z-index: 12;
}

.tab-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  font-size: 0.72rem;
  font-weight: 820;
  gap: 1px;
  justify-items: center;
  min-height: 38px;
  padding: 3px;
}

.tab-button span:first-child {
  font-size: 0.98rem;
  line-height: 1;
}

.tab-button.active {
  background: var(--ink);
  color: #ffffff;
}

.family-panel {
  display: grid;
  gap: 8px;
  grid-template-rows: auto auto auto auto auto auto minmax(0, 1fr) auto;
}

.guide-settings-card,
.account-card,
.invite-card,
.family-form,
.share-box {
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 8px;
}

.settings-card-heading {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.settings-card-heading strong {
  font-size: 0.86rem;
}

.settings-card-heading span,
.range-setting {
  color: var(--muted);
  font-size: 0.76rem;
}

.guide-mode-buttons {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-mode-button {
  background: #f4f8f6;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 820;
  min-height: 32px;
  padding: 0 6px;
}

.guide-mode-button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.range-setting {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.range-setting strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.guide-settings-card input[type="range"] {
  width: 100%;
}

.account-card,
.invite-card,
.share-box {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto;
}

.account-card div:first-child,
.invite-card {
  min-width: 0;
}

.account-card strong,
.invite-card strong,
.share-box strong {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 2px;
}

.account-card span,
.invite-card span {
  color: var(--muted);
  display: block;
  font-size: 0.76rem;
  line-height: 1.28;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.kakao-button {
  align-items: center;
  background: #fee500;
  border: 1px solid #ead000;
  border-radius: 8px;
  color: #191600;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 860;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  text-decoration: none;
}

.invite-card strong,
.invite-card span {
  grid-column: 1;
}

.invite-card .compact-action {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.family-form {
  align-items: center;
  grid-template-columns: auto minmax(80px, 1fr) minmax(80px, 1fr) auto;
  padding: 7px 8px;
}

.family-form h3 {
  font-size: 0.78rem;
  margin: 0;
  white-space: nowrap;
}

.family-form label {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.family-panel input[type="text"] {
  font-size: var(--control-font-size);
  min-height: 32px;
  padding: 0 9px;
}

.family-panel select {
  font-size: 0.78rem;
  min-height: 32px;
  padding: 0 9px;
}

.family-panel .tool-button,
.family-panel .primary-action {
  border-radius: 7px;
  font-size: 0.74rem;
  min-height: 32px;
  padding: 0 9px;
  white-space: nowrap;
}

.family-panel .compact-action {
  width: auto;
}

.family-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.family-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 8px;
}

.family-card > h3,
.family-card > p,
.family-card header {
  grid-column: 1 / -1;
}

.family-card header {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.family-card header > div:first-child {
  min-width: 0;
}

.family-card h3 {
  font-size: 0.88rem;
  margin: 0 0 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.family-card p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
  margin: 0;
}

.family-meta,
.family-row small,
.empty-note {
  color: var(--muted);
  display: block;
  font-size: 0.7rem;
  line-height: 1.24;
}

.family-card-actions,
.family-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.family-section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 5px;
  min-width: 0;
  padding-top: 6px;
}

.family-section > strong {
  font-size: 0.74rem;
}

.family-row-list {
  display: grid;
  gap: 4px;
}

.family-row {
  align-items: center;
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 32px;
  padding: 5px 6px;
}

.family-row.active {
  border-color: var(--mint);
  box-shadow: 0 0 0 2px rgba(53, 196, 157, 0.12);
}

.family-row > span {
  font-size: 0.78rem;
  font-weight: 760;
  min-width: 0;
}

.invite-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.check-chip {
  align-items: center;
  background: #eef8f4;
  border: 1px solid #cae7dc;
  border-radius: 999px;
  color: var(--mint-dark);
  display: inline-flex;
  font-size: 0.7rem;
  gap: 4px;
  padding: 4px 7px;
}

.check-chip input {
  accent-color: var(--mint-dark);
}

.baby-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.baby-chip {
  background: #eaf6f1;
  border: 1px solid #cae7dc;
  border-radius: 999px;
  color: var(--mint-dark);
  font-size: 0.78rem;
  font-weight: 780;
  padding: 7px 10px;
}

.share-box input {
  font-size: var(--control-font-size);
  min-height: 32px;
}

@media (max-width: 860px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-header.compact {
    align-items: center;
    flex-direction: row;
  }

  .capture-panel .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .capture-panel .panel-header > div:first-child {
    min-width: 0;
  }

  .capture-fields {
    max-width: 100%;
    width: 100%;
  }

  .timeline-list {
    max-height: none;
  }
}

@media (max-width: 430px) {
  .capture-status a {
    text-align: center;
  }

  .family-card header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .family-card-actions,
  .family-row-actions {
    justify-content: flex-end;
  }

  .family-card-actions .tool-button,
  .family-row-actions .tool-button {
    flex: 0 0 auto;
  }

  .player-controls {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .speed-buttons {
    grid-column: 2 / 4;
  }

  .period-range-group {
    gap: 4px;
  }

  .period-slider-row {
    font-size: 0.68rem;
    grid-template-columns: 30px minmax(0, 1fr);
  }
}

html.short-viewport .app-shell {
  gap: 6px;
  padding: max(6px, env(safe-area-inset-top)) 8px max(6px, env(safe-area-inset-bottom));
}

html.short-viewport .topbar {
  min-height: 36px;
}

html.short-viewport .brand {
  font-size: 0.98rem;
  gap: 8px;
}

html.short-viewport .brand-mark {
  flex-basis: 36px;
  height: 36px;
  width: 36px;
}

html.short-viewport .brand-mark::after {
  font-size: 12px;
}

html.short-viewport .sync-pill {
  font-size: 0.7rem;
  padding: 5px 8px;
}

html.short-viewport .bottom-tabs {
  gap: 3px;
  padding: 3px;
}

html.short-viewport .tab-button {
  font-size: 0.66rem;
  gap: 1px;
  min-height: 33px;
  padding: 2px;
}

html.short-viewport .tab-button span:first-child {
  font-size: 0.88rem;
}

html.short-viewport .tab-panel {
  padding: 8px;
}

html.short-viewport .panel-header {
  gap: 6px;
  margin-bottom: 6px;
}

html.short-viewport .eyebrow {
  display: none;
}

html.short-viewport h1 {
  font-size: 1.08rem;
}

html.short-viewport h2 {
  font-size: 0.98rem;
}

html.short-viewport label {
  font-size: 0.72rem;
}

html.short-viewport .date-display-button,
html.short-viewport input[type="text"],
html.short-viewport select {
  min-height: 34px;
  padding: 0 10px;
}

html.short-viewport .capture-fields {
  gap: 0 5px;
}

html.short-viewport .storage-hint {
  font-size: 0.58rem;
  margin-bottom: 6px;
}

html.short-viewport .loop-status {
  margin-bottom: 6px;
  padding: 6px 8px;
}

html.short-viewport .capture-status {
  gap: 8px;
  padding: 6px 7px;
}

html.short-viewport .loop-status span {
  display: none;
}

html.short-viewport .capture-status strong,
html.short-viewport .loop-status strong {
  font-size: 0.8rem;
}

html.short-viewport .capture-status a {
  font-size: 0.72rem;
  padding: 7px 9px;
}

html.short-viewport .camera-controls,
html.short-viewport .player-controls {
  gap: 6px;
  margin-top: 6px;
}

html.short-viewport .tool-button,
html.short-viewport .primary-action,
html.short-viewport .icon-button,
html.short-viewport .toggle-control,
html.short-viewport .speed-button {
  border-radius: 7px;
  font-size: 0.78rem;
  min-height: 34px;
}

html.short-viewport .speed-button {
  font-size: 0.68rem;
  padding: 0 5px;
}

html.short-viewport .tool-button,
html.short-viewport .toggle-control {
  padding: 0 10px;
}

html.short-viewport .primary-action {
  min-height: 38px;
}

html.short-viewport #startCameraButton,
html.short-viewport #captureButton {
  min-height: 42px;
}

html.short-viewport .camera-primary-row {
  gap: 5px;
}

html.short-viewport .camera-icon-button {
  border-radius: 999px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  width: 40px;
}

html.short-viewport .ghost-toggle {
  border-radius: 999px;
  min-height: 30px;
  padding: 0 10px 0 6px;
}

html.short-viewport .icon-button {
  height: 36px;
  width: 36px;
}

html.short-viewport .last-shot {
  display: none;
}

html.short-viewport .loop-status {
  margin-top: 6px;
}

html.tiny-viewport .app-shell {
  gap: 4px;
  padding-left: 6px;
  padding-right: 6px;
}

html.tiny-viewport .topbar {
  min-height: 30px;
}

html.tiny-viewport .brand {
  font-size: 0.92rem;
}

html.tiny-viewport .brand-mark {
  flex-basis: 32px;
  height: 32px;
  width: 32px;
}

html.tiny-viewport .brand-mark::after {
  font-size: 11px;
}

html.tiny-viewport .sync-pill {
  font-size: 0.66rem;
  padding: 4px 7px;
}

html.tiny-viewport .bottom-tabs {
  padding: 2px;
}

html.tiny-viewport .tab-button {
  font-size: 0.62rem;
  min-height: 29px;
}

html.tiny-viewport .tab-button span:first-child {
  font-size: 0.82rem;
}

html.tiny-viewport .tab-panel {
  padding: 7px;
}

html.tiny-viewport .panel-header {
  gap: 4px;
  margin-bottom: 4px;
}

html.tiny-viewport h1 {
  font-size: 0.98rem;
}

html.tiny-viewport h2 {
  font-size: 0.92rem;
}

html.tiny-viewport label {
  font-size: 0.68rem;
}

html.tiny-viewport .date-display-button {
  font-size: 0.82rem;
  min-height: 30px;
  padding: 0 8px;
}

html.tiny-viewport select {
  font-size: 0.82rem;
  min-height: 30px;
  padding: 0 8px;
}

html.tiny-viewport input[type="text"] {
  font-size: var(--control-font-size);
  min-height: 30px;
  padding: 0 8px;
}

html.tiny-viewport .date-picker-sheet {
  bottom: max(48px, env(safe-area-inset-bottom));
  gap: 5px;
  max-width: min(292px, calc(100vw - 20px));
  padding: 7px;
}

html.tiny-viewport .date-picker-day {
  font-size: 0.68rem;
  height: 30px;
  width: 30px;
}

html.tiny-viewport .date-picker-actions .tool-button,
html.tiny-viewport .date-picker-actions .primary-action {
  min-height: 30px;
}

html.tiny-viewport .capture-fields {
  gap: 0 4px;
  max-width: 100%;
  width: 100%;
}

html.tiny-viewport .storage-hint {
  font-size: 0.56rem;
  line-height: 1.16;
  margin-bottom: 5px;
}

html.tiny-viewport .loop-status {
  margin-bottom: 4px;
  padding: 5px 7px;
}

html.tiny-viewport .capture-status {
  padding: 5px 6px;
}

html.tiny-viewport .capture-status strong,
html.tiny-viewport .loop-status strong {
  font-size: 0.74rem;
}

html.tiny-viewport .capture-status a {
  font-size: 0.68rem;
  padding: 6px 7px;
}

html.tiny-viewport .camera-empty strong {
  font-size: 0.92rem;
}

html.tiny-viewport .camera-empty span {
  font-size: 0.72rem;
}

html.tiny-viewport .camera-controls,
html.tiny-viewport .player-controls {
  gap: 4px;
  margin-top: 4px;
}

html.tiny-viewport .tool-button,
html.tiny-viewport .primary-action,
html.tiny-viewport .icon-button,
html.tiny-viewport .toggle-control,
html.tiny-viewport .speed-button {
  font-size: 0.72rem;
  min-height: 30px;
}

html.tiny-viewport .speed-button {
  font-size: 0.64rem;
  padding: 0 4px;
}

html.tiny-viewport .tool-button,
html.tiny-viewport .toggle-control {
  padding: 0 8px;
}

html.tiny-viewport .primary-action {
  min-height: 34px;
}

html.tiny-viewport #startCameraButton,
html.tiny-viewport #captureButton {
  min-height: 36px;
}

html.tiny-viewport .primary-action span:first-child {
  height: 12px;
  width: 12px;
}

html.tiny-viewport .camera-primary-row {
  gap: 4px;
}

html.tiny-viewport .camera-icon-button {
  border-radius: 999px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  width: 34px;
}

html.tiny-viewport .ghost-toggle {
  border-radius: 999px;
  font-size: 0.68rem;
  min-height: 28px;
  padding: 0 8px 0 5px;
}

html.tiny-viewport .icon-button {
  height: 32px;
  width: 32px;
}

@media (max-width: 360px) {
  .family-form {
    gap: 4px;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
    padding: 6px;
  }

  .family-form h3 {
    font-size: 0.7rem;
  }

  .family-panel select {
    font-size: 0.72rem;
    min-height: 30px;
    padding: 0 6px;
  }

  .family-panel input[type="text"],
  .share-box input {
    font-size: var(--control-font-size);
    min-height: 30px;
    padding: 0 6px;
  }

  .family-panel .tool-button,
  .family-panel .primary-action {
    font-size: 0.68rem;
    min-height: 30px;
    padding: 0 6px;
  }

  .camera-controls {
    gap: 5px;
    grid-template-columns: minmax(0, 1fr);
  }

  .camera-primary-row {
    gap: 5px;
  }

  .camera-icon-button {
    border-radius: 999px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    width: 38px;
  }

  .tool-button,
  .toggle-control {
    padding-left: 8px;
    padding-right: 8px;
  }

  .camera-icon-button {
    padding-left: 0;
    padding-right: 0;
  }
}
