.hidden { display: none !important; }
.main { overflow: hidden; }

.header { height: var(--height); }
.logo-mark { background-image: url("favicon.png"); }
.header-tools { height: 100%; }

.field { display: flex; flex-direction: column; gap: var(--gap-extra-small); padding: 0 var(--padding-medium); }
.field-label { font-size: var(--font-size-extra-small); font-weight: 700; text-transform: uppercase; color: var(--fg-1); }
.field select { width: 100%; min-width: 0; }
.check { flex: none; display: flex; align-items: center; gap: var(--gap-small); height: var(--height); padding: 0 var(--padding-medium); }
.controls { display: contents; }
.preset-actions { display: flex; gap: var(--gap-small); padding: 0 var(--padding-medium); }
.field-hint { color: var(--fg-1); font-size: var(--font-size-extra-small); }
.field-hint:empty { display: none; }

.stage {
  --ratio: calc(16 / 9);
  --on-video: var(--white);
  --shade: color-mix(in srgb, var(--black) 70%, transparent);
  position: relative; flex: 1; min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--on-video); background: var(--black); border-radius: var(--border-radius-large);
}
.frame { position: relative; width: min(100%, calc(var(--cqh) * 100 * var(--ratio))); aspect-ratio: var(--ratio); overflow: hidden; }
.preview, .canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.frame.mirror :is(.preview, .canvas) { scale: -1 1; }
.grid-lines {
  --grid-line: color-mix(in srgb, var(--white) 50%, transparent);
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(100% / 3 - var(--border-width)), var(--grid-line) 0 calc(100% / 3), transparent 0 calc(100% / 3 * 2 - var(--border-width)), var(--grid-line) 0 calc(100% / 3 * 2), transparent 0),
    linear-gradient(to bottom, transparent calc(100% / 3 - var(--border-width)), var(--grid-line) 0 calc(100% / 3), transparent 0 calc(100% / 3 * 2 - var(--border-width)), var(--grid-line) 0 calc(100% / 3 * 2), transparent 0);
}
.focus-ring { position: absolute; width: calc(var(--height) * 2); height: calc(var(--height) * 2); translate: -50% -50%; border: var(--border-width-thick) solid var(--white); border-radius: 50%; pointer-events: none; }
.focus-ring.on { animation: camu-focus 0.8s ease-out; }
@keyframes camu-focus { from { scale: 1.6; opacity: 1; } to { scale: 1; opacity: 0; } }
.flash { position: absolute; inset: 0; background: var(--white); opacity: 0; pointer-events: none; }
.flash.on { animation: camu-flash 0.16s ease-out; }
@keyframes camu-flash { from { opacity: 0.9; } to { opacity: 0; } }
.countdown {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
  font-size: calc(var(--unit) * 60); font-weight: 700; text-shadow: 0 0 calc(var(--unit) * 8) var(--black);
}
.message { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--gap-medium); padding: var(--padding-large); text-align: center; background: var(--black); }
.message-text { max-width: calc(var(--unit) * 160); color: var(--fg-1); }
.message-text:empty { display: none; }
.recording {
  position: absolute; top: var(--padding-medium); inset-inline-start: var(--padding-medium); display: flex; align-items: center; gap: var(--gap-small); height: var(--height); padding: 0 var(--padding-medium);
  font-family: var(--font-mono); background: var(--shade); border-radius: var(--border-radius-medium);
}
.recording .icon { color: var(--red); animation: camu-blink 1s steps(1) infinite; }
@keyframes camu-blink { 50% { opacity: 0.2; } }

.bottom-bar { position: absolute; inset-inline: 0; bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: var(--gap-small); padding: var(--padding-medium); background: linear-gradient(to top, var(--shade), transparent); }
.shots { min-width: 0; display: flex; align-items: flex-end; gap: var(--gap-small); overflow-x: auto; }
.gallery-area { display: flex; justify-content: flex-end; }
.gallery-button { width: var(--height); height: var(--height); padding: 0; background: var(--bg); }
.shutter-area { grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: var(--gap-small); }
#mode { background: var(--bg); border-radius: var(--border-radius-medium); }
#mode button { width: calc(var(--height) * 3.5); }
.shutter {
  display: flex; align-items: center; justify-content: center; width: calc(var(--height) * 2); height: calc(var(--height) * 2); padding: 0;
  border-radius: 50%; border: var(--border-width-thick) solid var(--white); background: var(--white); color: var(--black);
}
.shutter .icon { width: var(--icon-size-large); height: var(--icon-size-large); }
.shutter.recording-now { background: var(--red); border-color: var(--red); color: var(--white); }
.shutter:disabled { background: var(--shade); border-color: var(--shade); color: var(--fg-1); }

.shot { position: relative; flex: none; width: calc(var(--height) * 3.5); overflow: hidden; border: var(--border-width) solid var(--border); border-radius: var(--border-radius-medium); background: var(--black); }
.shot-media { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.shot-bar { position: absolute; inset: 0; display: none; flex-wrap: wrap; align-content: center; justify-content: center; gap: var(--gap-extra-small); background: var(--shade); }
.shot:hover .shot-bar, .shot:focus-within .shot-bar { display: flex; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--height) * 6), 1fr)); gap: var(--gap-small); }
.gallery .shot { width: auto; }

@media (max-width: 48rem) {
  .shots { grid-column: 1 / -1; grid-row: 1; }
  .shutter-area { grid-row: 2; }
  .gallery-area { grid-column: 3; grid-row: 2; }
}
