/* VANTA SHIFT — bodycam HUD + touch controls. Small, white, monospace, unobtrusive. */
#hud {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; color: rgba(255,255,255,0.92);
  font-size: clamp(10.5px, 1.05vw, 13.5px); letter-spacing: 0.06em;
  text-shadow: 0 0 2px rgba(0,0,0,0.9), 0 1px 3px rgba(0,0,0,0.8);
}
#hud .dim { color: rgba(255,255,255,0.55); }
.hud-tr { position: absolute; right: calc(18px + var(--sa-r)); top: calc(14px + var(--sa-t)); text-align: right; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; white-space: nowrap; }
.h-rec { display: flex; align-items: center; gap: 6px; }
.h-rec .rec-dot { width: 8px; height: 8px; }
#h-wave { margin-left: 10px; }
.hud-tl { position: absolute; left: calc(18px + var(--sa-l)); top: calc(14px + var(--sa-t)); display: flex; flex-direction: column; gap: 3px; max-width: 40vw; }
.hud-tl .mate { display: flex; gap: 8px; align-items: center; white-space: nowrap; overflow: hidden; }
.hud-tl .mate i { display: inline-block; width: 46px; height: 3px; background: rgba(255,255,255,0.18); position: relative; flex: 0 0 46px; }
.hud-tl .mate i b { position: absolute; inset: 0 auto 0 0; background: rgba(255,255,255,0.85); }
.hud-tl .mate.down { color: #ff6a5e; }
.hud-tl .mate.dead { color: rgba(255,255,255,0.35); text-decoration: line-through; }
.hud-tl .mate.off { color: rgba(255,255,255,0.35); }
.hud-bl { position: absolute; left: calc(18px + var(--sa-l)); bottom: calc(16px + var(--sa-b)); display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 30px 150px 34px; align-items: center; gap: 8px; }
.bar-row b { font-weight: 500; text-align: right; }
.bar { height: 4px; background: rgba(255,255,255,0.16); position: relative; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 100%; background: rgba(255,255,255,0.92); transition: width 0.15s linear; }
.bar.bat i { background: #f2e7c4; }
.bar.low i { background: #ff4d40; }
.bar.thin { height: 2px; }
.bar-row.sta { opacity: 0.6; }
.bar-row.sta.full { opacity: 0; transition: opacity 0.6s; }
.hud-br { position: absolute; right: calc(18px + var(--sa-r)); bottom: calc(16px + var(--sa-b)); text-align: right; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; white-space: nowrap; }
#h-pts { font-size: 1.15em; }
#h-pts.bump { animation: bump 0.3s ease-out; }
@keyframes bump { 0% { color: #ffe08a; } 100% { color: inherit; } }
.h-ammo { font-size: 1.9em; letter-spacing: 0.02em; line-height: 1.1; }
.h-ammo b { font-weight: 500; }
.h-ammo.low b { color: #ff5a4a; }
#h-cross { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#h-cross i { position: absolute; left: -1.5px; top: -1.5px; width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,0.75); box-shadow: 0 0 0 1px rgba(0,0,0,0.6); }
#h-hit { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; }
#h-hit i { position: absolute; width: 9px; height: 1.5px; background: #fff; box-shadow: 0 0 2px #000; }
#h-hit i:nth-child(1) { left: 5px; top: 5px; transform: rotate(45deg); }
#h-hit i:nth-child(2) { left: -14px; top: 5px; transform: rotate(-45deg); }
#h-hit i:nth-child(3) { left: 5px; top: -6px; transform: rotate(-45deg); }
#h-hit i:nth-child(4) { left: -14px; top: -6px; transform: rotate(45deg); }
#h-hit.on { animation: hit 0.22s ease-out; }
#h-hit.kill i { background: #ff4a3a; }
#h-hit.head i { width: 12px; }
@keyframes hit { 0% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(1); } }
#h-prompt {
  position: absolute; left: 50%; top: 62%; transform: translateX(-50%); padding: 6px 12px; background: rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.18); white-space: nowrap; font-size: 1.05em; opacity: 0; transition: opacity 0.15s; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis;
}
#h-prompt.on { opacity: 1; }
#h-prompt.deny { border-color: rgba(255,80,64,0.6); color: #ff9a90; }
#h-progress { position: absolute; left: 50%; top: calc(62% + 34px); transform: translateX(-50%); width: 160px; height: 3px; background: rgba(255,255,255,0.15); opacity: 0; }
#h-progress.on { opacity: 1; }
#h-progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: #7dff9a; }
#h-events { position: absolute; left: calc(18px + var(--sa-l)); bottom: calc(132px + var(--sa-b)); display: flex; flex-direction: column-reverse; gap: 3px; max-width: 46vw; }
#h-events div { animation: evIn 0.2s ease-out; transition: opacity 0.6s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#h-events div.gold { color: #ffd98a; }
#h-events div.red { color: #ff7d70; }
#h-events div.fade { opacity: 0; }
@keyframes evIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
#h-center { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); text-align: center; white-space: nowrap; opacity: 0; transition: opacity 0.4s; }
#h-center.on { opacity: 1; }
#h-center b { display: block; font-family: var(--disp); font-weight: 400; font-size: clamp(28px, 4.6vw, 58px); letter-spacing: 0.14em; color: #fff; text-shadow: -2px 0 rgba(224,38,27,0.55), 2px 0 rgba(80,180,255,0.4), 0 0 20px rgba(0,0,0,0.9); }
#h-center span { display: block; margin-top: 6px; color: rgba(255,255,255,0.7); letter-spacing: 0.25em; }
#h-dmg { position: absolute; inset: 0; }
#h-dmg .arc {
  position: absolute; left: 50%; top: 50%; width: 46vmin; height: 46vmin; margin: -23vmin 0 0 -23vmin; border-radius: 50%;
  background: radial-gradient(circle at 50% 0%, rgba(255,40,20,0.65), rgba(255,40,20,0) 28%); opacity: 0; animation: dmg 1.1s ease-out;
}
@keyframes dmg { 0% { opacity: 1; } 100% { opacity: 0; } }
#h-down { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); text-align: center; display: none; }
#h-down.on { display: block; }
#h-down b { display: block; font-family: var(--disp); font-weight: 400; font-size: clamp(26px, 4vw, 44px); letter-spacing: 0.14em; color: #ff5a4a; }
#h-net { position: absolute; right: calc(18px + var(--sa-r)); top: calc(92px + var(--sa-t)); color: #ffb08a; }
#h-board {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 32px));
  background: rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.18); padding: 14px 16px; text-shadow: none;
}
#h-board table { width: 100%; border-collapse: collapse; table-layout: fixed; }
#h-board th { font-size: 0.8em; color: rgba(255,255,255,0.55); text-align: right; font-weight: 500; padding: 4px 6px; }
#h-board td { text-align: right; padding: 5px 6px; border-top: 1px solid rgba(255,255,255,0.08); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#h-board th:first-child, #h-board td:first-child { text-align: left; width: 40%; }
#h-board .bt { display: flex; justify-content: space-between; margin-bottom: 8px; letter-spacing: 0.12em; }
#h-chat { position: absolute; left: calc(18px + var(--sa-l)); bottom: calc(190px + var(--sa-b)); width: min(380px, 50vw); display: flex; flex-direction: column; gap: 3px; }
#h-chat-log div { animation: evIn 0.2s ease-out; transition: opacity 1s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#h-chat-log div b { color: #9fd0ff; font-weight: 500; }
#h-chat-log div.fade { opacity: 0; }
#h-chat-in { pointer-events: auto; height: 30px; padding: 0 8px; background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.3); outline: none; font-size: 12.5px; width: 100%; }
body.low-hud #hud { font-size: 11px; }

/* Touch controls (v2) */
#touch { position: fixed; inset: 0; z-index: 25; touch-action: none; -webkit-user-select: none; user-select: none; --t-op: 0.5; }
#t-look { position: absolute; top: 0; right: 0; bottom: 0; left: 42%; }
#t-joyzone { position: absolute; left: 0; bottom: 0; width: 42%; height: 78%; }
#touch.mirror #t-look { left: 0; right: 42%; }
#touch.mirror #t-joyzone { left: auto; right: 0; }
#t-joy {
  position: absolute; left: calc(46px + var(--sa-l)); bottom: calc(40px + var(--sa-b)); width: 124px; height: 124px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.2); background: radial-gradient(circle, rgba(255,255,255,0.05), rgba(255,255,255,0.015) 70%);
  opacity: calc(var(--t-op) * 1.1); pointer-events: none; transition: opacity 0.15s;
}
#touch.mirror #t-joy { left: auto; right: calc(46px + var(--sa-r)); }
#t-joy.active { opacity: 1; }
#t-joy.run { border-color: rgba(255,214,120,0.75); }
#t-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,0.16); border: 1.5px solid rgba(255,255,255,0.42); }
.t-top { position: absolute; left: calc(12px + var(--sa-l)); top: calc(10px + var(--sa-t)); display: flex; gap: 8px; }
.tb {
  position: absolute; width: 58px; height: 58px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.32); background: rgba(10,10,12,0.3);
  color: rgba(255,255,255,0.92); font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; font-weight: 600;
  display: grid; place-items: center; padding: 0; touch-action: none; opacity: var(--t-op); transition: opacity 0.12s, transform 0.08s;
}
.tb span { pointer-events: none; }
.t-top .tb { position: static; }
.tb.small { width: 40px; height: 40px; font-size: 15px; border-radius: 10px; opacity: max(0.45, var(--t-op)); }
.tb.on { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.75); opacity: max(0.75, var(--t-op)); }
.tb.press { transform: scale(0.93); background: rgba(255,255,255,0.26); opacity: 1; }
.tb.fire { border-color: rgba(255,90,74,0.75); background: rgba(120,20,14,0.32); }
.tb.fire.press, .tb.fire.auto { background: rgba(224,38,27,0.45); opacity: 1; }
#t-aim.on { background: rgba(224,38,27,0.35); border-color: rgba(224,38,27,0.85); }
#t-stance[data-mode=prone] { border-color: rgba(255,214,120,0.85); }
.tb.use { border-color: rgba(125,255,154,0.85); background: rgba(20,80,40,0.45); opacity: max(0.85, var(--t-op)); }
.tb.heal { border-color: rgba(90,220,120,0.9); background: rgba(16,70,34,0.5); opacity: max(0.85, var(--t-op)); }
.tb.ctx { border-color: rgba(255,214,120,0.8); background: rgba(60,46,14,0.4); opacity: max(0.8, var(--t-op)); }
.tb[hidden] { display: none; }

#t-menu { position: absolute; inset: 0; background: rgba(0,0,0,0.45); display: grid; place-items: center; z-index: 3; }
#t-menu[hidden] { display: none; }
.tm-card {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: min(92vw, 480px); padding: 14px;
  background: rgba(14,14,16,0.92); border: 1px solid rgba(255,255,255,0.14); border-radius: 14px;
}
.tm-card button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 74px; padding: 8px 4px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.16); border-radius: 10px; color: #fff; font-size: 12px; line-height: 1.2; text-align: center;
}
.tm-card button b { font-size: 20px; font-weight: 600; }
.tm-card button.on { background: rgba(224,38,27,0.28); border-color: rgba(224,38,27,0.8); }
@media (max-height: 360px) { .tm-card button { min-height: 58px; } .tm-card { gap: 7px; padding: 10px; } }

#touch.editing { background: rgba(0,0,0,0.5); }
#touch.editing #t-look, #touch.editing #t-joyzone { pointer-events: none; }
#touch.editing .tb { opacity: 1; outline: 1px dashed rgba(255,255,255,0.35); outline-offset: 3px; }
#touch.editing .tb.sel { outline: 2px solid #e0261b; }
#touch.editing .t-top { display: none; }
#t-edit { position: absolute; left: 0; right: 0; top: 0; z-index: 4; display: flex; justify-content: center; padding: calc(6px + var(--sa-t)) calc(8px + var(--sa-r)) 0 calc(8px + var(--sa-l)); pointer-events: none; }
#t-edit[hidden] { display: none; }
.t-edit-bar {
  pointer-events: auto; display: flex; flex-direction: column; gap: 6px; max-width: 100%; padding: 8px 10px;
  background: rgba(14,14,16,0.94); border: 1px solid rgba(255,255,255,0.16); border-radius: 12px; font-size: 12px;
}
.te-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; }
.te-row label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.te-row input[type=range] { width: 96px; }
.te-row button { padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); color: #fff; font-size: 12px; }
.te-row button.on { border-color: #e0261b; background: rgba(224,38,27,0.25); }
.te-row .te-done { background: #e0261b; border-color: #e0261b; font-weight: 600; }
.te-sel { min-width: 92px; text-align: center; color: rgba(255,255,255,0.75); }
.te-chk input { accent-color: #e0261b; }

body.is-touch #hud .hud-br { bottom: calc(256px + var(--sa-b)); }
body.is-touch #h-prompt { top: 30%; }
body.is-touch #h-progress { top: calc(30% + 34px); }
body.is-touch #h-center { top: 22%; }
body.is-touch #h-events { bottom: calc(180px + var(--sa-b)); }
body.is-touch .hud-tl { top: calc(64px + var(--sa-t)); }
@media (max-height: 440px) {
  #t-joy { width: 108px; height: 108px; left: calc(28px + var(--sa-l)); bottom: calc(22px + var(--sa-b)); }
  body.is-touch #hud .hud-br { bottom: auto; top: calc(100px + var(--sa-t)); }
  body.is-touch #h-events { bottom: auto; top: calc(96px + var(--sa-t)); left: calc(122px + var(--sa-l)); max-width: 40vw; }
  body.is-touch .hud-bl { bottom: auto; top: calc(12px + var(--sa-t)); left: calc(122px + var(--sa-l)); gap: 4px; }
  body.is-touch .hud-tl { top: calc(70px + var(--sa-t)); }
  body.is-touch #h-center { top: 40%; }
  body.is-touch #h-center b { font-size: clamp(22px, 5vw, 34px); }
  body.is-touch #h-prompt { top: 24%; }
  body.is-touch #h-progress { top: calc(24% + 34px); }
  .bar-row { grid-template-columns: 28px 110px 30px; }
}
@media (max-width: 520px) {
  .bar-row { grid-template-columns: 28px 96px 30px; }
  .hud-tr { font-size: 10px; }
}

@media (orientation: portrait) and (max-width: 560px) {
  #t-joy { width: 110px; height: 110px; left: calc(14px + var(--sa-l)); bottom: calc(24px + var(--sa-b)); }
  body.is-touch .hud-bl { bottom: auto; top: calc(100px + var(--sa-t)); }
  body.is-touch .hud-tl { top: calc(170px + var(--sa-t)); }
  body.is-touch #hud .hud-br { bottom: auto; top: calc(100px + var(--sa-t)); }
  body.is-touch #h-center { top: 44%; }
  body.is-touch #h-center b { font-size: 24px; }
  body.is-touch #h-events { bottom: calc(220px + var(--sa-b)); }
}

/* magnified optic overlay (ADS with prism / scope) */
#h-scope { position: absolute; inset: 0; display: grid; place-items: center; background: #000; pointer-events: none; z-index: 0; }
#h-scope canvas { width: min(100vh, 100vw); height: min(100vh, 100vw); }
#h-scope { background: radial-gradient(circle at 50% 50%, transparent 0 calc(min(50vh, 50vw) - 2px), #000 calc(min(50vh, 50vw) - 1px)); }
#h-cross { transition: opacity 0.12s; }
#t-aim.on { background: rgba(224,38,27,0.35); border-color: rgba(224,38,27,0.8); }

/* Med items, status and the revir dolabı panel */
.h-med { font-size: 11px; color: rgba(255,255,255,0.75); letter-spacing: 0.04em; min-height: 14px; max-width: min(260px, 44vw); white-space: normal; line-height: 1.35; }
.h-med b { color: #8fe3a4; font-weight: 600; }
.h-med i { font-style: normal; opacity: 0.35; }
.h-status { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; min-height: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.h-status .bl { color: #ff5a4a; animation: blBlink 0.9s steps(2) infinite; }
.h-status .ad { color: #ffd98a; }
.h-status .mo { color: #9ec3ff; }
@keyframes blBlink { 50% { opacity: 0.35; } }
#h-medbar { position: absolute; left: 50%; top: 55%; transform: translateX(-50%); width: min(240px, 60vw); text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: #bff5cb; }
#h-medbar[hidden] { display: none; }
#h-medbar div { margin-top: 5px; height: 4px; background: rgba(255,255,255,0.15); }
#h-medbar i { display: block; height: 100%; width: 0; background: #5ddc7f; }
#med-shop {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(380px, 92vw); max-height: 86vh; overflow-y: auto;
  background: rgba(10,12,11,0.92); border: 1px solid rgba(93,220,127,0.45); border-radius: 12px; padding: 12px; pointer-events: auto; z-index: 30;
}
#med-shop[hidden] { display: none; }
.ms-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ms-head b { font-size: 14px; letter-spacing: 0.12em; color: #dfffe6; }
.ms-head small { margin-left: auto; color: #ffd98a; font-size: 12px; }
.ms-cross { width: 18px; height: 18px; position: relative; flex: none; }
.ms-cross::before, .ms-cross::after { content: ''; position: absolute; background: #2fbf5a; border-radius: 2px; }
.ms-cross::before { left: 6px; top: 0; width: 6px; height: 18px; }
.ms-cross::after { left: 0; top: 6px; width: 18px; height: 6px; }
.ms-list { display: flex; flex-direction: column; gap: 6px; }
.ms-list button {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; text-align: left; width: 100%; padding: 9px 10px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; color: #fff; font-family: var(--mono); font-size: 12px;
}
.ms-list button kbd { grid-row: span 2; font-size: 11px; color: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.25); border-radius: 4px; text-align: center; padding: 1px 0; }
.ms-list button b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-list button em { font-style: normal; color: #ffd98a; white-space: nowrap; }
.ms-list button small { grid-column: 2 / 4; color: rgba(255,255,255,0.55); font-size: 10.5px; line-height: 1.3; }
.ms-list button:disabled { opacity: 0.4; }
.ms-list button.full em { color: rgba(255,255,255,0.5); }
.ms-foot { margin-top: 8px; font-size: 10.5px; text-align: center; }
body.is-touch .ms-list kbd { display: none; }
body.is-touch .ms-list button { grid-template-columns: minmax(0, 1fr) auto; padding: 11px 12px; }
body.is-touch .ms-list button small { grid-column: 1 / 3; }
.tm-card button em { font-style: normal; color: #ffd98a; }
.tm-card button:disabled { opacity: 0.35; }
@media (max-height: 460px) {
  #med-shop { width: min(560px, 94vw); padding: 10px; }
  .ms-head { margin-bottom: 6px; }
  .ms-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .ms-list button { padding: 8px 10px; }
  .ms-list button small { font-size: 10px; }
  .ms-foot { margin-top: 6px; }
}
#perf { position: fixed; left: 50%; bottom: calc(4px + var(--sa-b)); transform: translateX(-50%); z-index: 60; font-size: 10.5px; color: #b6ffc6; background: rgba(0,0,0,0.55); padding: 2px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
#perf[hidden] { display: none; }
