/* Hide scrollbar for a more app-like feel */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}
body {
    background-color: #f3f4f6; /* Gray background for desktop view to frame the app */
}
.app-container {
    /* Simulate mobile screen on desktop, full width on mobile */
    max-width: 414px; 
    margin: 0 auto;
    height: 100dvh;
    background-color: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.view {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    background-color: #f9fafb;
}
.view.active {
    display: flex;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.cam-placeholder {
    background: linear-gradient(-45deg, #1f2937, #111827, #374151, #000000);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}
/* Selfy Club camera-first emergency experience */
.home-map-card{position:relative;background:#e7edf2;border:1px solid #e2e8f0;border-radius:18px;overflow:hidden;box-shadow:0 5px 20px rgba(15,23,42,.06)}
.home-map{height:245px;width:100%;background:linear-gradient(135deg,#dbeafe,#ecfdf5);z-index:0}
.home-location-card{position:relative;background:#fff;padding:13px 14px 14px;border-top:1px solid #e9edf2}
.location-live-dot{width:8px;height:8px;background:#16a34a;border-radius:50%;display:inline-block;box-shadow:0 0 0 4px #dcfce7}
.map-style-button{display:inline-flex;align-items:center;justify-content:center;border:1px solid #e2e8f0;border-radius:8px;background:#fff;padding:6px 10px;font-size:10px;font-weight:800;color:#475569;text-decoration:none}
.map-style-button.active{background:#172033;color:#fff;border-color:#172033}
.home-action-card{min-height:102px;display:flex;align-items:center;gap:10px;padding:13px;border-radius:15px;background:#fff;border:1px solid #e5e7eb;box-shadow:0 4px 12px rgba(15,23,42,.045);text-align:left;color:#172033}
.home-action-card strong{display:block;font-size:13px;font-weight:850;line-height:1.3}.home-action-card small{display:block;font-size:10px;color:#64748b;margin-top:4px;line-height:1.35}
.home-action-icon{width:39px;height:39px;border-radius:12px;display:grid;place-items:center;background:#fff1ef;color:#e54b40;flex:0 0 auto;font-size:17px}
.home-action-primary{background:linear-gradient(135deg,#f15246,#d93632);border-color:#e34c41;color:#fff}.home-action-primary small{color:#ffe4e1}.home-action-primary .home-action-icon{background:rgba(255,255,255,.18);color:#fff}
.home-action-live{background:linear-gradient(135deg,#172033,#283c5b);border-color:#263a57;color:#fff}.home-action-live small{color:#cbd5e1}.home-action-live .home-action-icon{background:rgba(255,255,255,.12);color:#fff}
.capture-view{background:#05070b!important;color:#fff;overflow:hidden;min-height:0}
.capture-toolbar{height:62px;flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;padding:9px 16px;background:#080b11}
.capture-gps-badge{display:inline-flex;gap:6px;align-items:center;border:1px solid rgba(34,197,94,.35);background:rgba(22,163,74,.13);color:#a7f3d0;padding:7px 10px;border-radius:999px;font-size:10px;font-weight:800}
.capture-stage{position:relative;flex:1;min-height:280px;max-height:calc(100dvh - 275px);background:#030407;display:flex;align-items:center;justify-content:center;overflow:hidden}
#capture-video{width:100%;height:100%;object-fit:cover;background:#030407}
.capture-camera-fallback{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:#cbd5e1;font-size:13px;padding:24px;background:linear-gradient(145deg,#111827,#030407)}
.capture-camera-fallback.hidden{display:none}
.camera-stamp{position:absolute;left:10px;right:10px;bottom:12px;z-index:3;display:flex;align-items:stretch;gap:9px;padding:9px;border-radius:11px;background:rgba(3,7,18,.78);border:1px solid rgba(255,255,255,.18);backdrop-filter:blur(12px);box-shadow:0 5px 22px rgba(0,0,0,.28)}
.camera-stamp-map{width:55px;min-width:55px;border-radius:8px;background:linear-gradient(145deg,#dbeafe,#bfdbfe);color:#dc2626;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:20px}.camera-stamp-map small{font-size:8px;color:#334155;font-weight:900;letter-spacing:.8px}
.camera-stamp-content{min-width:0;flex:1}.camera-stamp-address{font-size:11px;font-weight:800;line-height:1.3;color:#fff}.camera-stamp-coords,.camera-stamp-datetime,.camera-stamp-accuracy{font-size:9px;line-height:1.4;color:#dbeafe;margin-top:3px}
.camera-stamp-settings{width:30px;flex:0 0 30px;border-radius:8px;background:rgba(255,255,255,.13);color:#fff;align-self:flex-start;height:30px}
.capture-live-badge{position:absolute;top:13px;left:13px;background:rgba(220,38,38,.92);color:white;font-size:10px;font-weight:900;letter-spacing:.08em;padding:7px 10px;border-radius:999px}.capture-live-badge span{width:7px;height:7px;background:#fff;border-radius:50%;display:inline-block;margin-right:6px;animation:liveBlink 1.3s infinite}
.capture-stage-tools{position:absolute;top:12px;right:12px;z-index:12;display:flex;gap:7px;align-items:center}
.capture-stage-tool{width:40px;height:40px;display:grid;place-items:center;border-radius:999px;background:rgba(8,13,23,.78);border:1px solid rgba(255,255,255,.25);color:#fff;font-size:15px;backdrop-filter:blur(10px);box-shadow:0 4px 14px rgba(0,0,0,.22)}
.capture-stage-tool:active{transform:scale(.96)}
.camera-stamp[hidden]{display:none!important}
.capture-view:fullscreen{width:100vw;height:100dvh;max-width:none;background:#05070b;overflow-y:auto}
.capture-view:fullscreen .capture-stage{flex:1 0 auto;height:auto;max-height:none;min-height:34vh}
body.camera-expanded-mode .app-container{position:fixed;inset:0;width:100vw;max-width:none;height:100dvh;z-index:9999}
body.camera-expanded-mode #view-user-camera{height:100dvh;min-height:0}
body.camera-expanded-mode #view-user-camera .capture-stage{flex:1 0 auto;height:auto;max-height:none;min-height:35vh}

.capture-controls{flex:0 0 auto;background:#090d15;padding:11px 16px max(15px,env(safe-area-inset-bottom));text-align:center}.capture-mode-switch{display:flex;justify-content:center;gap:5px;margin-bottom:10px}.capture-mode-switch button{background:transparent;color:#9ca3af;border:0;border-radius:999px;padding:7px 18px;font-size:10px;font-weight:900;letter-spacing:.1em}.capture-mode-switch button.active{background:#253148;color:#fff}
.capture-control-row{display:flex;align-items:center;justify-content:space-between;max-width:280px;margin:0 auto}.capture-side-button{width:44px;height:44px;border-radius:50%;background:#202a3a;color:#e2e8f0;font-size:17px}.capture-shutter{width:68px;height:68px;border-radius:50%;border:4px solid #fff;background:transparent;display:grid;place-items:center;box-shadow:0 0 0 2px rgba(255,255,255,.18)}.capture-shutter span{display:block;width:48px;height:48px;border-radius:50%;background:#fff}.capture-shutter.recording span{background:#ef4444;border-radius:11px;width:27px;height:27px}.capture-hint{color:#9ca3af;font-size:10px;margin-top:10px}
.stamp-option{display:flex;align-items:center;gap:11px;padding:12px;border:1px solid #e5e7eb;border-radius:10px;font-size:14px;font-weight:650;color:#263246}.stamp-option input{width:18px;height:18px;accent-color:#ef5145}
.confirm-map{height:310px;width:100%;border-radius:16px;overflow:hidden;border:1px solid #e2e8f0;background:#e2e8f0}
.review-evidence-card{background:#fff;border:1px solid #e5e7eb;border-radius:13px;overflow:hidden;position:relative}.review-evidence-card img,.review-evidence-card video{display:block;width:100%;height:145px;object-fit:cover;background:#0f172a}.review-evidence-card .review-name{font-size:10px;font-weight:700;padding:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.review-remove{position:absolute;top:7px;right:7px;width:27px;height:27px;border-radius:50%;background:rgba(15,23,42,.78);color:#fff}
.leaflet-container{font:inherit}.leaflet-control-attribution{font-size:8px!important}
@keyframes liveBlink{50%{opacity:.25}}
@media(max-height:690px){.home-map{height:190px}.capture-stage{max-height:calc(100dvh - 250px)}.camera-stamp{bottom:7px}.capture-controls{padding-top:8px}}
@media(min-width:600px){.home-map{height:280px}.capture-stage{max-height:650px}}

.review-gps-stamp{position:absolute;left:6px;right:6px;bottom:34px;padding:6px 7px;border-radius:7px;background:rgba(2,6,23,.78);color:#fff;display:flex;flex-direction:column;gap:2px;pointer-events:none}.review-gps-stamp strong{font-size:9px;line-height:1.25}.review-gps-stamp span{font-size:7px;color:#dbeafe;line-height:1.25}
/* Pre-camera location confirmation and live GPS mini-map stamp */
.location-preview-map{height:300px;min-height:260px}
.camera-stamp-map{width:76px;min-width:76px;height:66px;overflow:hidden;padding:0;background:#dbeafe}
#camera-stamp-mini-map{width:100%;height:100%;min-height:66px}
#camera-stamp-mini-map .leaflet-control-attribution{font-size:6px;line-height:1;background:rgba(255,255,255,.72);padding:1px 2px}
@media(max-height:690px){.location-preview-map{height:245px;min-height:220px}}
.review-actions{display:flex;gap:7px;padding:0 8px 9px}
.review-retake,.review-delete{flex:1;padding:8px 6px;border-radius:8px;font-size:10px;font-weight:800}
.review-retake{background:#fff1ef;color:#bd342c;border:1px solid #f7c9c4}
.review-delete{background:#f8fafc;color:#475569;border:1px solid #e2e8f0}
.review-gps-stamp{bottom:58px}

/* Fast emergency capture: keep camera live and place incident routing directly below it. */
.home-map-compact{height:150px}
.home-action-large{min-height:112px}
.capture-view{overflow-y:auto!important;overflow-x:hidden!important}
.capture-stage{flex:0 0 auto;height:min(48vh,430px);min-height:250px;max-height:430px}
.capture-controls{flex:0 0 auto}
.capture-inline-panel{display:block;background:#f8fafc;padding:14px 14px max(22px,env(safe-area-inset-bottom));border-top:1px solid #273244;color:#172033}
.capture-inline-panel[hidden]{display:none}
.capture-inline-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.capture-ready-pill{font-size:10px;font-weight:800;color:#047857;background:#d1fae5;border-radius:999px;padding:7px 10px;white-space:nowrap}
.capture-inline-evidence-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:13px}
.capture-inline-evidence-list:empty{display:none}
.capture-inline-item{position:relative;min-width:0;background:#fff;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden}
.capture-inline-item img,.capture-inline-item video{width:100%;height:88px;display:block;object-fit:cover;background:#0f172a}
.capture-inline-item-actions{display:flex;gap:5px;padding:5px 6px 0}.capture-inline-item-actions button{position:static;flex:1;width:auto;height:auto;border-radius:7px;background:#f1f5f9;color:#334155;padding:6px 4px;font-size:9px;font-weight:800;white-space:nowrap}.capture-inline-item-actions .capture-remove-button{background:#fff1f2;color:#be123c}.capture-inline-item-actions .capture-retake-button{background:#eff6ff;color:#1d4ed8}
.capture-inline-item small{display:block;padding:5px 6px;font-size:9px;color:#475569;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.capture-inline-field-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.capture-inline-field-grid>div:first-child{grid-column:1/-1}
@media(max-width:360px){.capture-inline-field-grid{grid-template-columns:1fr}.capture-inline-field-grid>div:first-child{grid-column:auto}.capture-inline-evidence-list{grid-template-columns:repeat(2,minmax(0,1fr))}}


/* Selfy Club V2: polished, touch-friendly mobile layout */
@media(max-width:600px){
  html,body{width:100%;min-height:100%;overscroll-behavior-y:contain}
  body{background:#fff}
  .app-container{width:100%;max-width:none;height:100svh;height:100dvh;min-height:0;margin:0;border-radius:0;box-shadow:none;overflow:hidden}
  .app-header{min-height:60px;padding-top:max(9px,env(safe-area-inset-top));padding-bottom:9px;position:relative;z-index:30}
  .app-header .brand-link img{height:34px;max-width:135px}
  .view{height:auto;min-height:0;flex:1 1 auto;overflow-x:hidden;overscroll-behavior:contain;padding-bottom:max(16px,env(safe-area-inset-bottom))}
  #view-user-home{padding:15px 14px max(20px,env(safe-area-inset-bottom))}
  #view-user-home h1{font-size:22px;line-height:1.15;letter-spacing:-.04em}
  #view-user-home .home-action-card{min-height:84px;padding:11px;gap:9px;border-radius:14px}
  #view-user-home .home-action-large{min-height:92px}
  #view-user-home .home-action-icon{width:36px;height:36px;border-radius:11px;font-size:15px}
  #view-user-home .home-action-card strong{font-size:12px}
  #view-user-home .home-action-card small{font-size:9px;line-height:1.3}
  #view-user-home .home-map-card{border-radius:15px}
  #view-user-home .home-map{height:160px;min-height:160px}
  #view-user-home .home-location-card{padding:11px 12px}
  #view-user-home .home-location-card #home-location-address{font-size:12px;line-height:1.35}
  #view-user-home .home-location-card #home-location-coords{font-size:10px}
  #view-user-home .mt-4.rounded-xl{margin-top:12px;padding:10px;border-radius:12px}
  #view-user-home .mt-4.rounded-xl p{font-size:10px;line-height:1.4}
  .capture-view{flex:1 1 auto;min-height:0;height:auto;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain}
  .capture-toolbar{height:54px;min-height:54px;padding:8px 12px}
  #capture-mode-title{font-size:15px;line-height:1.2}
  .capture-gps-badge{padding:6px 9px;font-size:9px;max-width:48%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .capture-stage{position:relative;flex:0 0 auto;width:100%;height:clamp(270px,49svh,470px);min-height:270px;max-height:58svh}
  #capture-video{width:100%;height:100%;object-fit:cover}
  .capture-stage-tools{top:9px;right:9px;gap:6px;z-index:40}
  .capture-stage-tool{width:40px;height:40px;font-size:14px;background:rgba(5,10,20,.92);border-color:rgba(255,255,255,.45)}
  .camera-stamp{left:9px;right:9px;bottom:9px;gap:7px;padding:8px;border-radius:10px;z-index:35}
  .camera-stamp-map{width:58px;min-width:58px;height:58px}
  #camera-stamp-mini-map{min-height:58px}
  .camera-stamp-address{font-size:10px}
  .camera-stamp-coords,.camera-stamp-datetime,.camera-stamp-accuracy{font-size:8px}
  .camera-stamp-settings{width:29px;flex-basis:29px;height:29px}
  .capture-controls{position:sticky;bottom:0;z-index:25;padding:9px 12px max(12px,env(safe-area-inset-bottom));background:linear-gradient(180deg,#111827,#070b12);box-shadow:0 -8px 24px rgba(0,0,0,.18)}
  .capture-mode-switch{margin:0 auto 8px;width:max-content;padding:3px;border:1px solid rgba(255,255,255,.12);border-radius:999px;background:#111827}
  .capture-mode-switch button{min-width:82px;padding:8px 15px;font-size:10px}
  .capture-mode-switch button.active{background:#f15246;color:#fff;box-shadow:0 3px 10px rgba(241,82,70,.25)}
  .capture-control-row{width:100%;max-width:310px;justify-content:space-between;gap:18px}
  .capture-side-button{width:46px;height:46px;flex:0 0 46px;border:1px solid rgba(255,255,255,.12);background:#243247;font-size:16px}
  .capture-shutter{width:70px;height:70px;flex:0 0 70px}
  .capture-shutter span{width:50px;height:50px}
  .capture-hint{font-size:9px;margin-top:7px}
  .capture-inline-panel{padding:14px 13px max(20px,env(safe-area-inset-bottom));}
  .capture-inline-heading h2{font-size:17px;line-height:1.2}
  .capture-inline-field-grid{gap:8px}
  .capture-inline-field-grid .field{min-height:43px;padding:10px 11px;font-size:13px}
  .capture-inline-panel .form-label{font-size:11px;margin-bottom:5px}
  .capture-inline-panel .primary-action{min-height:46px;font-size:13px}
  .capture-inline-evidence-list{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
  .capture-inline-item img,.capture-inline-item video{height:78px}
  .capture-inline-item-actions button{font-size:8px;padding:7px 3px}
  .stamp-option{padding:10px;font-size:12px}
  .location-preview-map{height:220px;min-height:220px}
}
@media(max-width:360px){
  #view-user-home{padding-left:11px;padding-right:11px}
  #view-user-home .home-action-card{padding:9px;gap:7px}
  #view-user-home .home-action-icon{width:32px;height:32px}
  #view-user-home .home-action-card strong{font-size:11px}
  .capture-stage{height:46svh;min-height:245px}
  .capture-control-row{max-width:285px}
  .capture-side-button{width:42px;height:42px;flex-basis:42px}
}
@media(orientation:landscape) and (max-height:520px){
  .capture-toolbar{height:46px;min-height:46px}
  .capture-stage{height:calc(100svh - 156px);max-height:none;min-height:180px}
  .capture-controls{padding-top:6px}
  .capture-shutter{width:54px;height:54px}
  .capture-shutter span{width:38px;height:38px}
}
