/* =====================================================================
   Camera - full-bleed black UI in both themes
   ===================================================================== */
.win.cam-win { background: #000; }
.win.cam-win .win-bar { background: #0b0c0e; color: #f2f3f5; border-bottom-color: rgba(255, 255, 255, .06); -webkit-backdrop-filter: none; backdrop-filter: none; }
.win.cam-win:not(.focused) .win-bar { color: rgba(242, 243, 245, .6); }
[data-buttons="right"] .win.cam-win .wc { color: rgba(255, 255, 255, .8) !important; }
[data-buttons="right"] .win.cam-win .wc:hover { background: rgba(255, 255, 255, .1) !important; color: #fff !important; }
[data-buttons="right"] .win.cam-win .wc-close:hover { background: #e5484d !important; }

.app-camera { --cam-yellow: #ffd60a; position: relative; background: #000; color: #f4f5f7; outline: none; }

/* ---------- stage ---------- */
.cam-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; }
.cam-frame { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: hidden; background: #111; opacity: 0; transition: opacity .35s; }
.app-camera[data-state="live"] .cam-frame { opacity: 1; }
.cam-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; transition: filter .25s; }
.cam-portrait {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
  -webkit-mask-image: radial-gradient(ellipse 46% 56% at 50% 45%, transparent 55%, #000 100%);
  mask-image: radial-gradient(ellipse 46% 56% at 50% 45%, transparent 55%, #000 100%);
  box-shadow: inset 0 0 140px rgba(0, 0, 0, .38);
}
.app-camera[data-mode="portrait"] .cam-portrait { opacity: 1; }
.cam-grid { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s; }
.cam-grid-on .cam-grid { opacity: 1; }
.cam-grid i { position: absolute; background: rgba(255, 255, 255, .38); box-shadow: 0 0 2px rgba(0, 0, 0, .3); }
.cam-grid i:nth-child(1), .cam-grid i:nth-child(2) { top: 0; bottom: 0; width: 1px; }
.cam-grid i:nth-child(1) { left: 33.333%; } .cam-grid i:nth-child(2) { left: 66.666%; }
.cam-grid i:nth-child(3), .cam-grid i:nth-child(4) { left: 0; right: 0; height: 1px; }
.cam-grid i:nth-child(3) { top: 33.333%; } .cam-grid i:nth-child(4) { top: 66.666%; }

.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 5; }
.cam-flash.go { animation: cam-flash .42s ease-out; }
@keyframes cam-flash { 0% { opacity: .92; } 100% { opacity: 0; } }

.cam-count {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none;
  font-family: var(--font-display); font-size: 140px; font-weight: 200; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, .45);
}
.cam-count.go { animation: cam-count 1s var(--ease); }
@keyframes cam-count { 0% { opacity: 0; transform: scale(1.4); } 25% { opacity: 1; transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: scale(.92); } }

/* top overlay */
.cam-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 10px 12px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .45), transparent);
  opacity: 0; transition: opacity .25s;
}
.app-camera[data-state="live"] .cam-top { opacity: 1; }
.app-camera[data-state="live"] .cam-top > * { pointer-events: auto; }
.cam-top-l { display: flex; gap: 8px; }
.cam-top-r { display: flex; justify-content: flex-end; }
.cam-pill {
  height: 32px; min-width: 32px; padding: 0 10px; border: 0; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(30, 30, 34, .55); color: #fff; font-size: 12.5px; font-weight: 700;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  transition: background .15s, color .15s;
}
.cam-pill:hover { background: rgba(60, 60, 66, .65); }
.cam-pill.on { color: var(--cam-yellow); }
.cam-badge { display: flex; justify-content: center; }
.cam-portrait-badge {
  height: 26px; padding: 0 12px; border-radius: 6px; display: inline-flex; align-items: center;
  background: var(--cam-yellow); color: #1a1500; font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.cam-rec {
  height: 28px; padding: 0 12px; border-radius: 7px; display: inline-flex; align-items: center; gap: 7px;
  background: #e5332a; color: #fff; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cam-rec i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: cam-blink 1s steps(2, start) infinite; }
@keyframes cam-blink { to { visibility: hidden; } }

/* filter chips */
.cam-filters {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: center; gap: 6px; flex-wrap: nowrap;
  padding: 26px 12px 12px; overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(to top, rgba(0, 0, 0, .45), transparent);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.cam-filters::-webkit-scrollbar { display: none; }
.app-camera[data-state="live"] .cam-filters { opacity: 1; pointer-events: auto; }
.app-camera.cam-recording .cam-filters, .app-camera.cam-counting .cam-filters { opacity: 0; pointer-events: none; }
.cam-chip {
  flex: 0 0 auto; height: 30px; padding: 0 12px 0 6px; border: 0; border-radius: 15px; display: inline-flex; align-items: center; gap: 7px;
  background: rgba(30, 30, 34, .6); color: rgba(255, 255, 255, .9); font-size: 12.5px; font-weight: 700;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  transition: background .15s, color .15s, box-shadow .15s;
}
.cam-chip i { width: 18px; height: 18px; border-radius: 50%; background: var(--dot); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.cam-chip:hover { background: rgba(60, 60, 66, .7); }
.cam-chip.on { background: rgba(255, 255, 255, .92); color: #111; box-shadow: none; }

/* start / waiting / error screens */
.cam-screen {
  position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px; text-align: center;
  background: radial-gradient(60% 60% at 50% 40%, #1d2026 0%, #0a0b0d 70%, #000 100%);
  animation: cam-fade .3s ease;
}
.cam-screen:empty { display: none; }
@keyframes cam-fade { from { opacity: 0; } }
.cam-hero {
  width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; color: #fff;
  background: linear-gradient(145deg, #4a505a, #24282e);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 0 0 10px rgba(255, 255, 255, .03), 0 0 0 22px rgba(255, 255, 255, .02), 0 18px 40px -10px rgba(0, 0, 0, .8);
}
.cam-hero.error { color: #ffb4a8; background: linear-gradient(145deg, #4b2c2a, #24181a); }
.cam-hero.waiting .spinner { width: 30px; height: 30px; border-width: 3px; border-color: rgba(255, 255, 255, .16); border-top-color: #fff; }
.cam-screen h2 { margin: 6px 0 0; font-size: 20px; font-weight: 700; color: #fff; }
.cam-screen p { margin: 0; max-width: 380px; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, .7); }
.cam-steps { margin: 4px 0 2px; padding: 12px 16px 12px 34px; max-width: 380px; text-align: left; border-radius: 12px; background: rgba(255, 255, 255, .06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .85); font-size: 13px; line-height: 1.6; }
.app-camera .cam-cta { margin-top: 10px; height: 38px; padding: 0 18px; border-radius: 19px; font-size: 14px; }
.cam-fine { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11.5px; color: rgba(255, 255, 255, .45); }

/* ---------- controls ---------- */
.cam-controls { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px 20px 16px; background: #000; }
.cam-modes { display: flex; gap: 6px; }
.cam-mode {
  height: 26px; padding: 0 12px; border: 0; border-radius: 13px; background: none;
  color: rgba(255, 255, 255, .62); font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; transition: color .15s, background .15s;
}
.cam-mode:hover { color: #fff; }
.cam-mode.on { color: var(--cam-yellow); background: rgba(255, 255, 255, .08); }
.cam-mode:disabled { opacity: .35; }
.cam-row { width: 100%; max-width: 420px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.cam-thumb {
  justify-self: start; width: 50px; height: 50px; padding: 0; border: 0; border-radius: 12px;
  background: #1b1d21 center / cover no-repeat; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22), 0 4px 12px rgba(0, 0, 0, .5);
  transition: transform .12s;
}
.cam-thumb:hover { transform: scale(1.04); }
.cam-thumb.empty { background: #15171a; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .12); }
.cam-thumb:disabled { cursor: default; transform: none; }
.cam-thumb.pop { animation: cam-pop .45s var(--ease); }
@keyframes cam-pop { 0% { transform: scale(.6); opacity: .2; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.cam-shutter {
  position: relative; width: 72px; height: 72px; padding: 0; border: 0; border-radius: 50%; background: none;
  box-shadow: inset 0 0 0 4px #fff; display: grid; place-items: center; transition: opacity .2s;
}
.cam-shutter i { width: 58px; height: 58px; border-radius: 50%; background: #fff; transition: transform .12s, border-radius .2s, width .2s, height .2s, background .2s; }
.cam-shutter:hover i { transform: scale(.96); }
.cam-shutter:active i { transform: scale(.88); }
.cam-shutter:disabled { opacity: .35; }
.cam-shutter:disabled i { transform: none; }
.app-camera[data-mode="video"] .cam-shutter i { background: #ff3b30; }
.app-camera.cam-recording .cam-shutter i { width: 28px; height: 28px; border-radius: 7px; }
.app-camera.cam-counting .cam-shutter i { background: rgba(255, 255, 255, .5); transform: scale(.82); }
.cam-flip {
  justify-self: end; width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .12); color: #fff; transition: background .15s, transform .3s var(--ease);
}
.cam-flip:hover { background: rgba(255, 255, 255, .2); }
.cam-flip:active { transform: rotate(180deg); }
.cam-flip:disabled { opacity: .3; }

/* phone */
[data-layout="mobile"] .cam-controls { padding-bottom: 30px; gap: 14px; }
[data-layout="mobile"] .cam-shutter { width: 76px; height: 76px; }
[data-layout="mobile"] .cam-filters { justify-content: flex-start; }
