:root {
  --void: #080a09;
  --ink: #f3eadc;
  --mute: rgba(243, 234, 220, 0.48);
  --line: rgba(243, 234, 220, 0.14);
  --brass: #c4a06a;
  --brass-deep: #9a7848;
  --font: "Instrument Sans", ui-sans-serif, sans-serif;
  --t: env(safe-area-inset-top, 0px);
  --b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  animation: none !important;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

img { display: block; max-width: 100%; }

.app {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #050605;
}

.live,
.live-idle {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #101211;
}

.live-idle {
  background:
    radial-gradient(88% 64% at 50% 40%, #4a524c 0%, #242a27 58%, #121614 100%),
    repeating-linear-gradient(180deg, transparent 0 2px, rgba(255,255,255,0.03) 2px 3px);
}

body.has-cam .live-idle { display: none; }

.bang {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #fff;
  pointer-events: none;
}

.bar {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
  padding: calc(0.55rem + var(--t)) 0.55rem 0.15rem;
}

.bar__name {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.045em;
}

.icon {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.icon[aria-pressed="true"] { color: var(--brass); }

.stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.crop--page {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(84vw, 21.5rem);
  aspect-ratio: 1 / 1.34;
  transform: translate(-50%, -56%);
  box-shadow: 0 0 0 999vmax rgba(4, 6, 5, 0.72);
  outline: 1px solid rgba(243, 234, 220, 0.34);
}

.crop--page i {
  position: absolute;
  width: 1.7rem;
  height: 1.7rem;
  border: 2.5px solid var(--ink);
}
.crop--page i:nth-child(1) { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.crop--page i:nth-child(2) { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.crop--page i:nth-child(3) { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.crop--page i:nth-child(4) { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.crop--qr {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(62vw, 15.2rem);
  aspect-ratio: 1;
  transform: translate(-50%, -58%);
  border: 2px solid rgba(243, 234, 220, 0.9);
  box-shadow: 0 0 0 999vmax rgba(4, 6, 5, 0.74);
}

.crop--qr::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(243, 234, 220, 0.22);
}

.hint {
  position: absolute;
  z-index: 4;
  left: 1rem;
  right: 1rem;
  bottom: calc(8.9rem + var(--b));
  margin: 0;
  text-align: center;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);
}

.modes {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: calc(6.55rem + var(--b));
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.modes button {
  min-height: 2.75rem;
  padding: 0 0.2rem;
  color: rgba(243, 234, 220, 0.38);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.modes .is-on {
  color: var(--ink);
  box-shadow: 0 2px 0 0 var(--brass);
}

.dock {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.2rem 1.45rem calc(1rem + var(--b));
  background: linear-gradient(180deg, transparent 0%, rgba(5, 7, 6, 0.88) 55%);
}

.thumb {
  justify-self: start;
  width: 3rem;
  height: 3rem;
  overflow: hidden;
  border-radius: 0.28rem;
  border: 1px solid var(--line);
  background: #161917;
}

.thumb span {
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.shutter {
  width: 4.75rem;
  height: 4.75rem;
  border-radius: 50%;
  border: 3px solid #f7f1e6;
  background: transparent;
}

.shutter span {
  display: block;
  width: 3.85rem;
  height: 3.85rem;
  margin: 0.22rem auto 0;
  border-radius: 50%;
  background: #f7f1e6;
}

.shutter:active span { background: var(--brass); }

body:not(.has-cam) .shutter {
  opacity: 0.38;
  pointer-events: none;
}

.dock__pad {
  justify-self: end;
  width: 3rem;
  height: 3rem;
}

.sheet {
  position: absolute;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.15rem 1.15rem calc(1.2rem + var(--b));
  background: #121413;
  border-top: 1px solid var(--line);
}

.sheet p {
  margin: 0 0 0.9rem;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.sheet button {
  width: 100%;
  min-height: 3.1rem;
  border-radius: 0.2rem;
  background: var(--brass);
  color: #1a140c;
  font-weight: 700;
  font-size: 1rem;
}

.review,
.files {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: #080a09;
}

.review[hidden],
.files[hidden],
.sheet[hidden],
.bang[hidden],
.crop[hidden] { display: none !important; }

.review img {
  width: 100%;
  height: calc(100% - 5.5rem - var(--b));
  object-fit: contain;
  background: #000;
}

.review__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.05rem calc(1rem + var(--b));
  background: #101211;
  border-top: 1px solid var(--line);
}

.review__bar button {
  min-height: 3rem;
  padding: 0 0.4rem;
  font-weight: 700;
}

.review__save {
  min-width: 8.5rem;
  border-radius: 0.2rem;
  background: var(--brass);
  color: #1a140c;
  padding-inline: 1.15rem;
}

.files header {
  display: grid;
  grid-template-columns: 4.6rem 1fr 4.6rem;
  align-items: center;
  padding: calc(0.65rem + var(--t)) 0.4rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.files header button {
  min-height: 2.8rem;
  padding: 0 0.7rem;
  justify-self: start;
  color: var(--brass);
  font-weight: 600;
}

.files h1 {
  margin: 0;
  text-align: center;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.files ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.files li {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto;
  gap: 0.85rem;
  align-items: center;
  min-height: 4.4rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(243, 234, 220, 0.07);
}

.files li img {
  width: 3.6rem;
  height: 3.6rem;
  object-fit: cover;
  background: #161917;
}

.files li strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.files li small {
  color: var(--mute);
  font-size: 0.75rem;
}

.files li em {
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
}

.empty {
  margin: 4.2rem 1.4rem 0;
  text-align: center;
  color: var(--mute);
  font-size: 0.95rem;
}

.empty[hidden] { display: none; }

.empty__mark {
  display: block;
  width: 3.4rem;
  height: 4.2rem;
  margin: 0 auto 1rem;
  border: 1.5px solid rgba(196, 160, 106, 0.55);
  background: linear-gradient(180deg, #161917, #101211);
}

.empty p { margin: 0; }

@media (min-width: 480px) {
  .app {
    max-width: 26.25rem;
    margin: 0 auto;
    min-height: 100dvh;
    box-shadow: 0 0 0 1px #1a1c1b;
  }
}
