* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; font-family: Verdana, Geneva, Tahoma, sans-serif; }
.stage { position: fixed; inset: 0; overflow: hidden; background: #000; }

#cam {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: 1; background: #111;
}
#master {
  position: absolute; top: 84px; right: 16px; z-index: 2;
  width: min(34vw, 460px); aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 12px; box-shadow: 0 6px 30px rgba(0,0,0,.55);
  background: #000;
}
/* Switched: master full screen, cam small on top */
.stage.swapped #master { inset: 0; width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
.stage.swapped #cam {
  inset: auto; top: 84px; right: 16px; z-index: 3;
  width: min(34vw, 460px); height: auto; aspect-ratio: 16 / 9;
  border-radius: 12px; box-shadow: 0 6px 30px rgba(0,0,0,.55);
}

.overlay-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 26px; color: #fff;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
  pointer-events: none;
}
.logo { width: 46px; height: 46px; background: #f4f1ec; border-radius: 10px; padding: 3px; }
.app-name { font-size: 22px; font-weight: 700; line-height: 1.1; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.slogan { font-size: 12.5px; opacity: .92; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.section-banner {
  margin-left: auto; text-align: right; font-size: 15px; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,.7); max-width: 46vw;
}
.section-banner .sub { display: block; font-size: 12px; font-weight: 400; opacity: .9; }

.verdict-badge {
  position: absolute; z-index: 6; left: 50%; bottom: 108px; transform: translateX(-50%);
  padding: 10px 22px; border-radius: 999px; color: #fff; font-size: 19px; font-weight: 700;
  box-shadow: 0 6px 24px rgba(0,0,0,.5); text-align: center; max-width: 86vw;
}
.verdict-badge .reason { display: block; font-size: 13px; font-weight: 400; margin-top: 2px; }
.verdict-badge.pass { background: #1f9d55; }
.verdict-badge.no-pass { background: #d64545; }
.verdict-badge.pending { background: #555f6e; }

.hint {
  position: absolute; z-index: 5; left: 50%; bottom: 74px; transform: translateX(-50%);
  color: #fff; font-size: 13.5px; text-shadow: 0 1px 4px rgba(0,0,0,.8);
  background: rgba(0,0,0,.35); padding: 4px 12px; border-radius: 999px; white-space: nowrap;
  max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 26px 12px 14px;
  background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.62));
}
.controls button, .save-form button, #btnAgain {
  border: 1px solid rgba(255,255,255,.35); background: rgba(20,20,20,.72); color: #fff;
  font-size: 15px; padding: 10px 18px; border-radius: 999px; cursor: pointer;
}
.controls button:hover:not(:disabled), .save-form button:hover { background: rgba(60,60,60,.85); }
.controls button:disabled { opacity: .38; cursor: default; }
.controls button.primary, .save-form button.primary { background: #9c6642; border-color: #9c6642; font-weight: 700; }
.controls button.capture { background: #1f9d55; border-color: #1f9d55; font-weight: 700; }

.album {
  position: absolute; inset: 0; z-index: 10; overflow: auto;
  background: rgba(10,10,10,.88); padding: 22px 14px 40px;
}
.album-card { max-width: 980px; margin: 0 auto; color: #fff; }
.album-card h2 { margin: 4px 0 14px; font-size: 22px; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.shot { position: relative; border-radius: 10px; overflow: hidden; background: #1c1c1c; }
.shot img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.shot .mark {
  position: absolute; top: 8px; right: 8px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff;
}
.shot .mark.pass { background: #1f9d55; }
.shot .mark.no-pass { background: #d64545; }
.shot .mark.none { background: #555f6e; }
.shot .cap { padding: 8px 10px; font-size: 12.5px; }
.shot .cap .r { display: block; opacity: .75; margin-top: 2px; }
.shot.empty { display: flex; align-items: center; justify-content: center; min-height: 130px; color: #999; font-size: 13px; }
.save-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-top: 20px; }
.save-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.save-form input {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #555;
  background: #161616; color: #fff; font-size: 15px; min-width: 200px;
}
.save-status { margin-top: 14px; font-size: 14.5px; }
#btnAgain { margin-top: 12px; }
