:root {
  --bg: #0b0f14;
  --panel: #121821;
  --line: #232c39;
  --text: #e8edf4;
  --muted: #7d8999;
  --accent: #5fd09c;
  --danger: #f06a6a;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  overscroll-behavior: contain;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

nav button {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit;
  cursor: pointer;
}

nav button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #062116;
  font-weight: 600;
}

#app section {
  display: grid;
  place-items: center;
  min-width: 0;
}

#view-camera {
  position: relative;
  overflow: hidden;
  background: #000;
}

#video {
  width: 100%;
  height: 100dvh;
  object-fit: cover;
}

.status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  border-radius: var(--radius);
  padding: 14px 18px;
  pointer-events: none;
  animation: fade 0.6s ease-out;
}

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

#shutter {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 76px;
  background: none;
  border: 0;
  cursor: pointer;
}

#shutter::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px solid var(--line);
  transition: border-color 0.15s, background 0.15s;
}

#shutter:active::after {
  border-color: var(--accent);
  background: rgba(95, 208, 156, 0.15);
}

#shutter.captured::after {
  border-color: var(--accent);
}

#view-gallery {
  align-items: start;
  padding: 16px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  width: 100%;
}

.gallery li {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery figure {
  margin: 0;
}

.actions {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(5, 8, 12, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.actions button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.actions button:active {
  background: rgba(255, 255, 255, 0.12);
}

.actions button.del { color: var(--danger); }
.actions button.del:active { background: rgba(240, 106, 106, 0.15); }

.empty {
  color: var(--muted);
}
