:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #f8f8f4;
  background: #10110f;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid #d9e4be;
  outline-offset: 5px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#camera-section {
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow: hidden;
  background: #10110f;
}
.viewfinder,
.viewfinder > video,
.camera-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.viewfinder > video {
  object-fit: cover;
}
.camera-placeholder {
  display: grid;
  place-items: center;
  background: #10110f;
}
.open-camera {
  border: 0;
  background: none;
  color: #f5f5ef;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px;
  font-size: 14px;
}
.open-camera svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.2;
  color: #c5ceba;
}
svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.camera-top {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  padding: calc(18px + env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right)) 28px
    max(22px, env(safe-area-inset-left));
  background: linear-gradient(#0005, transparent);
  pointer-events: none;
}
.camera-top > * {
  pointer-events: auto;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #24282080;
  color: #fff;
}
.icon-button[aria-pressed="true"] {
  color: #e6eab5;
  background: #5b6649cc;
}
#record-clock {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: #852f2f;
  padding: 8px 14px;
  border-radius: 20px;
}
.camera-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 44px max(24px, env(safe-area-inset-right))
    calc(25px + env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  background: linear-gradient(transparent, #0009);
}
.mode-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.mode-switch button {
  border: 0;
  background: transparent;
  color: #b4b6b0;
  padding: 12px 17px;
  font-size: 13px;
  min-height: 44px;
  border-radius: 24px;
}
.mode-switch button.active {
  color: #e1e8ca;
  background: #ffffff12;
}
.capture-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 360px;
  margin: 20px auto 0;
}
.shutter {
  width: 76px;
  height: 76px;
  border: 2px solid #fff;
  border-radius: 50%;
  padding: 5px;
  background: transparent;
}
.shutter > span {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 50%;
}
.shutter.video > span {
  background: #d77468;
}
.shutter.recording > span {
  border-radius: 5px;
  width: 28px;
  height: 28px;
  margin: auto;
}
.toast {
  position: fixed;
  top: calc(84px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 40px);
  z-index: 5;
  background: #f0f1e9;
  color: #343b2e;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 8px 30px #0002;
}
body[data-state="gallery"] {
  background: #f6f3ec;
  color: #34392f;
}
#gallery-section {
  min-height: 100dvh;
  padding: 0 8px 24px;
}
.gallery-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f3ecf5;
  padding: calc(10px + env(safe-area-inset-top)) 12px 12px;
  backdrop-filter: blur(12px);
}
.gallery-toolbar .mode-switch button {
  color: #72786a;
}
.gallery-toolbar .mode-switch button.active {
  background: #e5e9dc;
  color: #46553a;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.media-card {
  margin: 0;
  min-width: 0;
  align-self: start;
}
.media-card img,
.media-card video {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e6e9de;
  border-radius: 3px;
}
.media-card figcaption {
  padding: 8px 4px 12px;
  font-size: 11px;
  line-height: 1.6;
  color: #747969;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.text-button {
  color: #566347;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  padding: 0;
}
.text-button:hover {
  text-decoration: underline;
}
#back-folders {
  margin: 8px 8px 20px;
  min-height: 44px;
}
.empty {
  grid-column: 1/-1;
  display: grid;
  place-items: center;
  min-height: 65vh;
  text-align: center;
  font-size: 14px;
  color: #777e6f;
}
.folder {
  align-self: start;
  border: 1px solid #dfe4d5;
  border-radius: 4px;
  background: #eef0e7;
  text-align: left;
  padding: 22px;
  color: #566347;
  font-size: 13px;
  line-height: 1.8;
}
.folder span {
  display: block;
  font-size: 32px;
}
dialog {
  width: min(520px, 100%);
  max-height: 100dvh;
  margin: auto;
  padding: 16px;
  border: 0;
  border-radius: 12px;
  background: #151713;
  color: #e6e9df;
}
dialog::backdrop {
  background: #000c;
}
.close-preview {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 28px;
  z-index: 1;
}
#preview-content img,
#preview-content video {
  display: block;
  width: 100%;
  max-height: 70dvh;
  object-fit: contain;
  background: #0e100d;
  border-radius: 4px;
}
dialog p {
  text-align: center;
  font-size: 11px;
  color: #afb5a5;
  margin: 15px 0;
}
.dialog-actions {
  display: flex;
  gap: 12px;
}
.primary,
.secondary {
  border: 0;
  padding: 14px 20px;
  border-radius: 6px;
  font-size: 14px;
  flex: 1;
}
.primary {
  background: #c8d2b6;
  color: #27321f;
}
.secondary {
  background: #ffffff0d;
  color: #e6e9df;
}
@media (max-width: 600px) {
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  #gallery-section {
    padding-left: 4px;
    padding-right: 4px;
  }
  .media-card figcaption {
    font-size: 10px;
  }
  .media-card figcaption .text-button {
    font-size: 10px;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .camera-controls {
    left: auto;
    top: 0;
    bottom: 0;
    width: 190px;
    padding: 16px 24px;
    background: linear-gradient(90deg, transparent, #0008);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .capture-row {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 12px;
  }
  .shutter {
    order: -1;
    margin: 0 30px;
  }
  .camera-top {
    right: 190px;
  }
}
.media-open {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 3px;
  overflow: hidden;
}
.media-open video {
  pointer-events: none;
}
.video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: white;
  background: #0009;
  font-size: 20px;
}
body.viewer-open {
  overflow: hidden;
}
#gallery-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #080908;
  overflow: hidden;
}
#gallery-viewer::backdrop {
  background: #080908;
}
#viewer-content {
  width: 100%;
  height: 100%;
  padding: calc(72px + env(safe-area-inset-top)) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#viewer-content img,
#viewer-content video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.viewer-close {
  position: absolute;
  z-index: 2;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  font-size: 32px;
  background: #30342bdd;
}
