* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  width: 100%;
  height: 100%;
  height: -webkit-fill-available; /* mobil tarayici yukseklik fix */
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}
/* body'yi gercek goruntu alanina sabitle (vh/vw kuyruklarini bypass et) */
body { position: fixed; top: 0; left: 0; right: 0; bottom: 0; }
.screen { display: none; height: 100%; width: 100%; flex-direction: column; }
.screen.active { display: flex; }
.header {
  padding: env(safe-area-inset-top, 20px) 16px 16px;
  padding-top: max(env(safe-area-inset-top), 20px);
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 12px;
}
.header h1 { font-size: 22px; font-weight: 700; }
.header .subtitle { font-size: 14px; color: #94a3b8; margin-top: 4px; }
.back {
  background: none; border: none; color: #e2e8f0;
  font-size: 28px; cursor: pointer; padding: 4px 10px;
}
.content { flex: 1; padding: 20px 16px; overflow-y: auto; }
.content h3 { color: #94a3b8; font-size: 13px; font-weight: 500; text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.05em; }

.site-list, .ppe-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.site-item, .ppe-item {
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s;
}
.site-item:active, .ppe-item:active { transform: scale(0.98); }
.ppe-item.selected { border-color: #22c55e; background: #14532d; }
.ppe-item .check { font-size: 22px; color: #22c55e; }
.ppe-item:not(.selected) .check { color: #475569; }

.btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #2563eb; color: white; }
.btn-secondary { background: #334155; color: #e2e8f0; }
.btn-danger { background: #dc2626; color: white; }

.input, .select {
  width: 100%;
  background: #1e293b;
  border: 2px solid #334155;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 10px;
  font-size: 16px;
  margin-bottom: 10px;
}
.input:focus, .select:focus { outline: none; border-color: #2563eb; }
.select:disabled { opacity: 0.8; }
.hint { font-size: 12px; color: #64748b; margin: -2px 0 4px; line-height: 1.4; }

/* Şantiye listesi düzenleme */
.edit-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.edit-row {
  background: #1e293b; border: 1px solid #334155; border-radius: 10px;
  padding: 12px 14px; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.del-btn {
  background: #7f1d1d; color: #fecaca; border: none;
  width: 30px; height: 30px; border-radius: 8px;
  font-size: 15px; cursor: pointer; flex-shrink: 0;
}
.del-btn:active { transform: scale(0.92); }
.add-row { display: flex; gap: 8px; align-items: stretch; }
.add-row .input { flex: 1; }
.btn-add {
  background: #2563eb; color: #fff; border: none;
  width: 52px; border-radius: 10px; font-size: 26px; cursor: pointer; flex-shrink: 0;
}
.btn-add:active { transform: scale(0.95); }

/* Camera screen */
#screen-camera { background: black; }
.cam-header {
  position: absolute;
  top: max(env(safe-area-inset-top), 16px);
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  z-index: 10;
  color: white;
  font-size: 14px;
  font-weight: 600;
}
.status-off { color: #6b7280; }
.status-on { color: #22c55e; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

#video {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cam-info {
  position: absolute;
  bottom: 100px;
  left: 16px;
  right: 16px;
  padding: 14px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  color: white;
  z-index: 10;
}
.cam-stats { font-size: 14px; color: #94a3b8; margin-bottom: 6px; }
.cam-last { font-size: 16px; font-weight: 600; }
.cam-last.violation { color: #ef4444; }
.cam-last.ok { color: #22c55e; }
/* Gönderiliyor: yanıp sönen yazı + dönen halka (foto gidip gitmediği belli olsun) */
.cam-last.sending { color: #38bdf8; animation: sendPulse 1s ease-in-out infinite; }
.cam-last.sending::before {
  content: ""; display: inline-block; width: 14px; height: 14px;
  margin-right: 8px; vertical-align: -2px;
  border: 2px solid rgba(56,189,248,0.35); border-top-color: #38bdf8;
  border-radius: 50%; animation: sendSpin 0.7s linear infinite;
}
@keyframes sendSpin { to { transform: rotate(360deg); } }
@keyframes sendPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
/* Ortada büyük onay/hata baloncuğu: gönderim bitince patlar (gitti mi net belli olsun) */
.cam-toast {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0.4);
  min-width: 120px; padding: 18px 26px;
  background: rgba(15,23,42,0.92); color: #fff;
  border-radius: 18px; font-size: 19px; font-weight: 700; text-align: center;
  z-index: 60; opacity: 0; pointer-events: none; white-space: nowrap;
}
.cam-toast.ok   { border: 2px solid #22c55e; }
.cam-toast.err  { border: 2px solid #ef4444; }
.cam-toast.go   { animation: toastPop 1.2s ease-out; }
@keyframes toastPop {
  0%   { opacity: 0; transform: translate(-50%,-50%) scale(0.4); }
  18%  { opacity: 1; transform: translate(-50%,-50%) scale(1.08); }
  32%  { transform: translate(-50%,-50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(0.9); }
}
.cam-controls {
  position: absolute;
  bottom: max(env(safe-area-inset-bottom), 24px);
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cam-back, .cam-flip {
  position: absolute;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}
.cam-back { left: 24px; }
.cam-flip { right: 24px; }
.cam-back:active, .cam-flip:active { transform: scale(0.92); }
/* Foto modu deklanşör */
.shutter {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255,255,255,0.5);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.25);
  cursor: pointer;
}
.shutter:active { transform: scale(0.88); background: #cbd5e1; }
/* Deklanşör vuruşu: hızlı bas-bırak + halka dalgası */
.shutter.flash { animation: shutterPunch 0.32s ease-out; }
@keyframes shutterPunch {
  0%   { transform: scale(1);    box-shadow: 0 0 0 4px rgba(0,0,0,0.25); background:#fff; }
  35%  { transform: scale(0.82); box-shadow: 0 0 0 4px rgba(0,0,0,0.25), 0 0 0 6px rgba(255,255,255,0.9); background:#cbd5e1; }
  100% { transform: scale(1);    box-shadow: 0 0 0 4px rgba(0,0,0,0.25), 0 0 0 22px rgba(255,255,255,0); background:#fff; }
}
/* Tam ekran deklanşör flaşı (fotoğraf çekildiği net belli olur) */
.shutter-flash {
  position: absolute; inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
}
.shutter-flash.go { animation: shutterBlink 0.28s ease-out; }
@keyframes shutterBlink {
  0%   { opacity: 0; }
  12%  { opacity: 0.92; }
  100% { opacity: 0; }
}
/* Video modu kayıt halkası */
.record-ring {
  width: 74px; height: 74px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(0,0,0,0.25);
}
.record-dot {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #ef4444;
  transition: all 0.2s;
}
.record-ring.recording { border-color: #ef4444; }   /* kayitta beyaz halka da KIRMIZI olsun (Vedat 06-18) */
.record-ring.recording .record-dot {
  width: 28px; height: 28px;
  border-radius: 7px;   /* kayıttayken kare (standart kamera) */
  animation: recpulse 1.2s infinite;
}
@keyframes recpulse { 50% { opacity: 0.45; } }
.rec-badge { color: #ef4444; font-weight: 700; animation: recpulse 1.2s infinite; }

/* Mod seçim kartları */
.mode-card {
  background: #1e293b; border: 2px solid #334155; border-radius: 14px;
  padding: 20px; margin-bottom: 14px; display: flex; align-items: center; gap: 16px;
  cursor: pointer; transition: all 0.15s;
}
.mode-card:active { transform: scale(0.98); border-color: #2563eb; }
.mode-icon { font-size: 38px; flex-shrink: 0; }
.mode-title { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.mode-desc { font-size: 13px; color: #94a3b8; line-height: 1.4; }
.h3-note { text-transform: none; color: #64748b; font-weight: 400; }

/* Temiz bildirim (toast) — WebView alert kutusu yerine */
#toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15,23,42,0.96);
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  max-width: 80%;
  text-align: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── JARVIS sesli asistan ekranı ─── */
#screen-jarvis { background: radial-gradient(circle at 50% 35%, #0b2a4a 0%, #060d1a 70%); align-items: center; }
.jarvis-close { position: absolute; top: max(env(safe-area-inset-top),16px); right: 16px; z-index: 20;
  background: rgba(255,255,255,0.08); color: #9fc5e8; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; }
.jarvis-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  width: 100%; height: 100%; padding-top: 12%; gap: 6px; }
.jarvis-title { color: #38bdf8; font-size: 26px; font-weight: 800; letter-spacing: 4px; text-shadow: 0 0 18px rgba(56,189,248,0.7); }
.jarvis-sub { color: #64a7cf; font-size: 13px; letter-spacing: 1px; margin-bottom: 18px; }
.jarvis-orb { width: 170px; height: 170px; border-radius: 50%; cursor: pointer; margin: 18px 0;
  background: radial-gradient(circle at 50% 40%, #22d3ee 0%, #0ea5e9 45%, #0c4a6e 100%);
  box-shadow: 0 0 40px rgba(34,211,238,0.6), inset 0 0 40px rgba(8,47,73,0.6);
  display: flex; align-items: center; justify-content: center; transition: all .3s;
  animation: jpulse 2.6s ease-in-out infinite; }
.jarvis-orb-core { font-size: 56px; filter: drop-shadow(0 0 6px rgba(0,0,0,0.4)); }
@keyframes jpulse { 0%,100% { box-shadow: 0 0 35px rgba(34,211,238,0.5), inset 0 0 40px rgba(8,47,73,0.6); }
  50% { box-shadow: 0 0 60px rgba(34,211,238,0.95), inset 0 0 40px rgba(8,47,73,0.6); } }
.jarvis-orb.listening { animation: jlisten .8s ease-in-out infinite; background: radial-gradient(circle at 50% 40%, #f87171 0%, #ef4444 50%, #7f1d1d 100%); }
@keyframes jlisten { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); box-shadow: 0 0 70px rgba(248,113,113,0.95); } }
.jarvis-orb.thinking { animation: jspin 1s linear infinite; background: radial-gradient(circle at 50% 40%, #fbbf24 0%, #f59e0b 50%, #78350f 100%); }
@keyframes jspin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }
.jarvis-status { color: #cbd5e1; font-size: 16px; font-weight: 600; min-height: 24px; margin-top: 6px; text-align: center; }
.jarvis-konusma { width: 100%; flex: 1; overflow-y: auto; margin-top: 16px; padding: 0 6px; display: flex; flex-direction: column; gap: 10px; }
.jbubble { max-width: 85%; padding: 11px 15px; border-radius: 14px; font-size: 15px; line-height: 1.45; }
.jbubble.siz { align-self: flex-end; background: #1e3a5f; color: #e0f2fe; border-bottom-right-radius: 4px; }
.jbubble.jarvis { align-self: flex-start; background: #0f2540; color: #bae6fd; border: 1px solid #1e4976; border-bottom-left-radius: 4px; }
.btn-jarvis { background: linear-gradient(90deg,#0ea5e9,#22d3ee); color: #042f49; font-weight: 800; letter-spacing: 1px; }
/* Ege'ye yazıyla soru çubuğu */
.jarvis-yaz { width: 100%; display: flex; gap: 8px; margin-top: 10px; padding: 0 6px 6px; }
.jarvis-yaz input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid #1e4976;
  background: #0b1a2e; color: #e0f2fe; font-size: 15px; outline: none; }
.jarvis-yaz input::placeholder { color: #5b7a9b; }
.jarvis-yaz button { padding: 0 18px; border: none; border-radius: 12px; font-weight: 800;
  background: linear-gradient(90deg,#0ea5e9,#22d3ee); color: #042f49; cursor: pointer; }
.jarvis-yaz button:active { transform: scale(0.94); }

/* ═══ JARVIS arc-reactor HUD (Iron Man tarzı segmentli halkalar) ═══ */
/* Ekran arka planı: koyu cyan + blueprint ızgara + tarama çizgileri */
#screen-jarvis {
  background:
    repeating-linear-gradient(0deg, rgba(56,189,248,0.035) 0 1px, transparent 1px 38px),
    repeating-linear-gradient(90deg, rgba(56,189,248,0.035) 0 1px, transparent 1px 38px),
    radial-gradient(circle at 50% 42%, #0e3354 0%, #07182b 55%, #04101d 100%) !important;
}

.jarvis-orb { position: relative; width: min(78vw, 320px); height: min(78vw, 320px);
  background: none !important; box-shadow: none !important; animation: none !important;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; }
@keyframes jcw  { to { transform: rotate(360deg); } }
@keyframes jccw { to { transform: rotate(-360deg); } }

/* Halka katmanları — hepsi orb'u doldurur, radial mask ile halkaya kesilir */
.jr { position: absolute; inset: 0; border-radius: 50%; }
.jr-ticks, .jr-sega, .jr-segb, .jr-dots, .jr-amber {
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }

/* Dış ölçek çizgileri (ince tik halkası) */
.jr-ticks {
  background: repeating-conic-gradient(from 0deg, rgba(125,211,252,0.55) 0 0.6deg, transparent 0.6deg 5deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 47.5%, #000 47.5% 50%, transparent 50%);
          mask: radial-gradient(circle closest-side, transparent 0 47.5%, #000 47.5% 50%, transparent 50%);
  animation: jcw 60s linear infinite; }

/* Ana kalın segmentli halka (boşluklu yaylar) */
.jr-sega {
  background: conic-gradient(from 0deg,
    #22d3ee 0 46deg, transparent 46deg 60deg,
    #38bdf8 60deg 150deg, transparent 150deg 168deg,
    #22d3ee 168deg 250deg, transparent 250deg 262deg,
    #38bdf8 262deg 360deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 38%, #000 38% 46%, transparent 46%);
          mask: radial-gradient(circle closest-side, transparent 0 38%, #000 38% 46%, transparent 46%);
  filter: drop-shadow(0 0 8px rgba(56,189,248,0.7));
  animation: jcw 16s linear infinite; }

/* İç ince segmentli halka (ters yön) */
.jr-segb {
  background: conic-gradient(from 30deg,
    #67e8f9 0 30deg, transparent 30deg 52deg,
    #22d3ee 52deg 120deg, transparent 120deg 140deg,
    #67e8f9 140deg 215deg, transparent 215deg 240deg,
    #22d3ee 240deg 330deg, transparent 330deg 360deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 30%, #000 30% 35%, transparent 35%);
          mask: radial-gradient(circle closest-side, transparent 0 30%, #000 30% 35%, transparent 35%);
  filter: drop-shadow(0 0 6px rgba(34,211,238,0.6));
  animation: jccw 11s linear infinite; }

/* Nokta işaretçiler (orta-iç halka) */
.jr-dots {
  background: repeating-conic-gradient(from 0deg, #bae6fd 0 1.4deg, transparent 1.4deg 30deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 36%, #000 36% 38%, transparent 38%);
          mask: radial-gradient(circle closest-side, transparent 0 36%, #000 36% 38%, transparent 38%);
  opacity: 0.85; animation: jcw 24s linear infinite; }

/* Sarı/amber aksan yayı (imza detay — sol tarafta parlayan yay) */
.jr-amber {
  background: conic-gradient(from 168deg, #fbbf24 0 78deg, transparent 78deg 360deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 39%, #000 39% 45%, transparent 45%);
          mask: radial-gradient(circle closest-side, transparent 0 39%, #000 39% 45%, transparent 45%);
  filter: drop-shadow(0 0 10px rgba(251,191,36,0.85));
  animation: jcw 16s linear infinite; }

/* Merkez radyal ışınlar (yelpaze) */
.jspokes { position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(125,211,252,0.26) 0 0.7deg, transparent 0.7deg 6deg);
  -webkit-mask: radial-gradient(circle closest-side, #000 0 27%, rgba(0,0,0,0.35) 27% 33%, transparent 33%);
          mask: radial-gradient(circle closest-side, #000 0 27%, rgba(0,0,0,0.35) 27% 33%, transparent 33%);
  animation: jccw 40s linear infinite; }

/* Merkez parıltı */
.jglow { position: absolute; width: 56%; height: 56%; border-radius: 50%;
  background: radial-gradient(circle, rgba(56,189,248,0.30) 0%, transparent 70%);
  animation: jglowpulse 3s ease-in-out infinite; }
@keyframes jglowpulse { 0%,100% { opacity: 0.5; transform: scale(0.95); } 50% { opacity: 1; transform: scale(1.05); } }

/* Merkez J.A.R.V.I.S yazısı */
.jlabel { position: absolute; color: #e0f2fe; font-weight: 800; letter-spacing: 2px;
  font-size: min(8vw, 34px); text-shadow: 0 0 14px rgba(56,189,248,0.9), 0 0 4px rgba(255,255,255,0.5);
  pointer-events: none; }

/* Ekolayzır (dinlerken görünür) */
.jeq { position: absolute; bottom: 22%; display: flex; gap: 4px; align-items: center; height: 34px; opacity: 0; transition: opacity .25s; }
.jeq i { width: 4px; height: 8px; background: #67e8f9; border-radius: 3px; box-shadow: 0 0 6px rgba(103,232,249,0.8); }

/* ── DİNLERKEN — hızlan + amber/cyan parla + ekolayzır + yazı gizli ── */
.jarvis-orb.listening .jr-sega  { animation-duration: 6s; filter: drop-shadow(0 0 14px rgba(56,189,248,1)); }
.jarvis-orb.listening .jr-segb  { animation-duration: 4.5s; }
.jarvis-orb.listening .jr-amber { filter: drop-shadow(0 0 18px rgba(251,191,36,1)); }
.jarvis-orb.listening .jglow    { background: radial-gradient(circle, rgba(103,232,249,0.45) 0%, transparent 70%); }
.jarvis-orb.listening .jlabel   { opacity: 0; }
.jarvis-orb.listening .jeq      { opacity: 1; }
.jarvis-orb.listening .jeq i    { animation: jbar .9s ease-in-out infinite; }
.jarvis-orb.listening .jeq i:nth-child(2){animation-delay:.12s} .jarvis-orb.listening .jeq i:nth-child(3){animation-delay:.24s}
.jarvis-orb.listening .jeq i:nth-child(4){animation-delay:.36s} .jarvis-orb.listening .jeq i:nth-child(5){animation-delay:.18s}
.jarvis-orb.listening .jeq i:nth-child(6){animation-delay:.30s} .jarvis-orb.listening .jeq i:nth-child(7){animation-delay:.06s}
@keyframes jbar { 0%,100% { height: 6px; } 50% { height: 32px; } }

/* ── DÜŞÜNÜRKEN — amber ağırlıklı, hızlı dönüş ── */
.jarvis-orb.thinking .jr-sega  { animation-duration: 3s;
  background: conic-gradient(from 0deg, #fbbf24 0 46deg, transparent 46deg 60deg, #fde68a 60deg 150deg, transparent 150deg 168deg, #fbbf24 168deg 250deg, transparent 250deg 262deg, #fde68a 262deg 360deg);
  filter: drop-shadow(0 0 12px rgba(251,191,36,0.9)); }
.jarvis-orb.thinking .jr-segb  { animation-duration: 2.4s; }
.jarvis-orb.thinking .jglow    { background: radial-gradient(circle, rgba(251,191,36,0.4) 0%, transparent 70%); }
.jarvis-orb.thinking .jlabel   { color: #fde68a; text-shadow: 0 0 14px rgba(251,191,36,0.9); }
