:root {
  --bg: #3B2A1A;
  --paper: #FFFDF7;
  --cream: #F2EEE3;
  --ink: #1B1F24;
  --muted: #667085;
  --gold: #FFC933;
  --t: #E09A3A;
  --ct: #5B8BEA;
  --red: #E0433B;
  --display: 'Secular One', 'Assistant', 'Arial Hebrew', sans-serif;
  --body: 'Assistant', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html, body, button { touch-action: manipulation; }
body {
  background: var(--bg) linear-gradient(180deg, #7A5A36 0%, #3B2A1A 100%) fixed;
  color: var(--ink); font: 16px/1.5 var(--body);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
input, select { font-size: 16px; border: 2px solid #d8d3c4; border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%; color: var(--ink); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.error { color: var(--red); min-height: 1.5em; margin: 8px 0 0; font-weight: 600; text-align: center; }
.note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; text-align: center; }

.btn {
  border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 12px;
  padding: 9px 16px; font-weight: 700; cursor: pointer; line-height: 1.2;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--gold); }
.btn.big { font-size: 1.1rem; padding: 12px 22px; width: 100%; }
.btn.small { font-size: .85rem; padding: 5px 12px; box-shadow: 0 2px 0 var(--ink); }
.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; padding: 4px; font-size: .9rem; }

/* דף הבית */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.card-panel { width: min(420px, 100%); background: var(--paper); border-radius: 20px; padding: 28px 22px; border: 3px solid var(--ink); box-shadow: 0 8px 0 #1e150c; }
.back-link { display: inline-block; margin: -10px 0 14px; font-size: .9rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); text-decoration: underline; }
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(2.8rem, 13vw, 3.8rem); line-height: 1; margin: 0; text-align: center; text-shadow: 3px 3px 0 var(--t); }
.logo.small { font-size: 1.8rem; text-shadow: 2px 2px 0 var(--t); }
.tagline { text-align: center; margin: 10px 0 22px; color: var(--muted); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 700; margin-bottom: 4px; font-size: .9rem; }
.or { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; color: var(--muted); font-size: .9rem; }
.or::before, .or::after { content: ''; flex: 1; height: 2px; background: #e4ddca; }
.join-row { display: flex; gap: 8px; }
.code-input { text-transform: uppercase; letter-spacing: .25em; font-weight: 800; text-align: center; }

/* משחק */
.game { position: fixed; inset: 0; overflow: hidden; background: #000; user-select: none; -webkit-user-select: none; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hud { position: absolute; inset: 0; pointer-events: none; color: #fff; text-shadow: 0 1px 2px #000a; }
.topbar {
  position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; direction: ltr; background: #000000a0; border-radius: 10px; padding: 3px; font-family: var(--display);
}
.tsc { min-width: 42px; text-align: center; font-size: 1.3rem; border-radius: 8px; padding: 0 8px; }
.tsc.t { background: var(--t); } .tsc.ct { background: var(--ct); }
.clock { min-width: 64px; text-align: center; font-size: 1.1rem; }
.feed { position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: 10px; list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; justify-items: end; font-size: .9rem; }
.feed li { background: #000000a0; border-radius: 6px; padding: 1px 8px; direction: rtl; }
.feed li.mine { outline: 2px solid var(--gold); }
.feed b.t, .log b.t { color: #FFC37A; } .feed b.ct, .log b.ct { color: #A9C4FF; }

.crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.crosshair i { position: absolute; background: #7CFF7C; box-shadow: 0 0 0 1px #0008; }
.crosshair i { background:var(--crosshair-color,#7cff7c); }
.radar-panel.overview { width:220px; }
#radarToggle { display:block; width:100%; margin-top:6px; padding:5px 0; background:#26383e; color:#d6e1d9; border:1px solid #7c93933d; border-radius:3px; font-size:10px; cursor:pointer; pointer-events:auto; position:relative; z-index:5; }
#crosshairDynamic { width:18px; height:18px; accent-color:#d6b66e; }
@media(max-height:600px),(max-width:600px) { .radar-panel.overview {width:150px;} #radarToggle {font-size:9px;padding:3px 0;} }
.crosshair i:nth-child(1) { width: 2px; height: 8px; left: -1px; top: -13px; }
.crosshair i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: 5px; }
.crosshair i:nth-child(3) { width: 8px; height: 2px; left: -13px; top: -1px; }
.crosshair i:nth-child(4) { width: 8px; height: 2px; left: 5px; top: -1px; }
.hitmark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); font-size: 26px; font-weight: 800; color: #fff; }
.hitmark.head { color: #FFD84D; } .hitmark.kill { color: #FF4B4B; font-size: 34px; }
.combat-notice { position:absolute; left:50%; top:43%; transform:translate(-50%,-50%) scale(.82); opacity:0; font:800 16px/1 var(--display); letter-spacing:.08em; color:#e6e8dc; text-shadow:0 2px 10px #000; pointer-events:none; transition:opacity .12s,transform .12s; }
.combat-notice.show { opacity:1; transform:translate(-50%,-50%) scale(1); }
.combat-notice.head { color:#f0c86f; }.combat-notice.kill { color:#f07f65; font-size:22px; }
.scope {
  position: absolute; inset: 0;
  background: radial-gradient(circle at center, transparent 0, transparent min(34vh, 34vw), #000 calc(min(34vh, 34vw) + 2px));
}
.scope::before, .scope::after { content: ''; position: absolute; background: #000; }
.scope::before { left: 0; right: 0; top: 50%; height: 1px; }
.scope::after { top: 0; bottom: 0; left: 50%; width: 1px; }
.dmg { position: absolute; inset: 0; box-shadow: inset 0 0 120px #ff000000; }
.dmg.on { animation: hurt .5s ease-out; }
.low-health-vignette { position:absolute; inset:0; pointer-events:none; box-shadow:inset 0 0 150px #b20f0f99; animation: lowPulse 1.15s ease-in-out infinite; }
@keyframes lowPulse { 0%,100% { opacity:.45; } 50% { opacity:.9; } }
@keyframes hurt { from { box-shadow: inset 0 0 140px #ff0000c0; } to { box-shadow: inset 0 0 140px #ff000000; } }
.dmg-dir {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  border-left: 18px solid transparent; border-right: 18px solid transparent; border-bottom: 26px solid #ff3030cc;
  transform-origin: 50% 50%; margin-top: -130px;
}
.dmg-dir { margin-top: 0; }
.dmg-dir::before { content: ''; position: absolute; }

.bottom { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-end; direction: ltr; }
.hp { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 1.8rem; }
.hp .bar { width: 160px; height: 12px; background: #0008; border-radius: 6px; overflow: hidden; border: 1px solid #fff6; }
#hpBar { height: 100%; width: 100%; background: #6DE08C; transition: width .15s; }
#hpBar.low { background: var(--red); }
.ammo { font-family: var(--display); font-size: 1.1rem; direction: rtl; }
.ammo b { font-size: 2rem; }
.ammo small { opacity: .7; }

.dead, .end-banner {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  display: grid; justify-items: center; gap: 2px; background: #000000b0; border-radius: 16px; padding: 14px 28px; text-align: center;
}
.dead b, .end-banner b { font-family: var(--display); font-size: 2rem; font-weight: 400; }
.end-banner.t b { color: #FFC37A; } .end-banner.ct b { color: #A9C4FF; }
.end-banner span { font-family: var(--display); font-size: 1.6rem; }

.chat-box { position: absolute; left: 10px; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); width: min(340px, 55vw); pointer-events: auto; opacity: .6; transition: opacity .3s; direction: rtl; }
.chat-box.fresh, .chat-box:focus-within { opacity: 1; }
.log { list-style: none; margin: 0; padding: 4px 8px; max-height: 120px; overflow-y: auto; font-size: .85rem; background: #0000006a; border-radius: 8px 8px 0 0; }
.log-sys { opacity: .75; } .log-big { color: var(--gold); font-weight: 800; }
#chatForm input { padding: 4px 8px; border-radius: 0 0 8px 8px; border: 0; background: #ffffffdd; }

/* לוח תוצאות */
.board { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, 94vw); background: #111c; color: #fff; border-radius: 16px; padding: 14px; }
.bcols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bcol h3 { margin: 0 0 6px; display: flex; justify-content: space-between; font-family: var(--display); font-weight: 400; }
.bcol.t h3 { color: #FFC37A; } .bcol.ct h3 { color: #A9C4FF; }
.bcol table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.bcol th { font-weight: 600; opacity: .6; font-size: .78rem; text-align: center; }
.bcol td { padding: 3px 4px; border-top: 1px solid #ffffff1a; text-align: center; }
.bcol td:first-child { text-align: start; font-weight: 700; }
.bcol tr.me td { background: #ffffff1a; }
.bcol tr.off td { opacity: .45; }
.specs { margin: 8px 0 0; opacity: .7; font-size: .85rem; }

/* תפריט */
.menu { position: absolute; inset: 0; background: #0009; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.menu-card { width: min(560px, 100%); background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; padding: 16px; display: grid; gap: 12px; }
.menu-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.menu-head .room { margin-inline-start: auto; font-size: .9rem; color: var(--muted); }
.menu-head .room b { color: var(--ink); letter-spacing: .12em; font-size: 1.1rem; }
.pick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick > span { font-weight: 800; min-width: 80px; font-size: .92rem; }
.pick select { width: auto; padding: 5px 8px; }
.pick small { color: var(--muted); }
.sens input { flex: 1; padding: 0; }
.chip { border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: 4px 14px; font-weight: 700; cursor: pointer; }
.chip.on { background: var(--ink); color: #fff; }
.chip.t.on { background: var(--t); color: var(--ink); } .chip.ct.on { background: var(--ct); color: #fff; }
#menuBoard .bcols { background: #1d1a16; color: #fff; border-radius: 12px; padding: 10px; }
#menuBoard .specs { color: var(--muted); }
.keys { font-size: .85rem; color: var(--muted); }
.keys summary { cursor: pointer; font-weight: 700; }
.keys p { margin: 6px 0 0; }
.menu-foot { display: flex; justify-content: space-between; align-items: center; }
.menu-foot .back-link { margin: 0; }

/* מגע */
.touch { position: absolute; inset: 0; pointer-events: none; }
.move-zone { position: absolute; left: 0; top: 0; bottom: 0; width: 40%; pointer-events: auto; touch-action: none; }
.look-zone { position: absolute; right: 0; top: 0; bottom: 0; width: 60%; pointer-events: auto; touch-action: none; }
.stick-base { position: absolute; left: 90px; top: 70%; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; background: #ffffff22; border: 2px solid #ffffff55; opacity: .5; }
.stick-base.on { opacity: 1; }
.stick-knob { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: #ffffffbb; }
.tbtn { position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; border: 2px solid #fff; background: #ffffff30; color: #fff; font-size: 1.4rem; width: 58px; height: 58px; }
.tbtn.on { background: #ffffffa0; }
.tbtn.fire { right: 22px; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); width: 82px; height: 82px; font-size: 2rem; }
.tbtn.jump { right: 116px; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
.tbtn.scope-b { right: 30px; bottom: calc(186px + env(safe-area-inset-bottom, 0px)); width: 48px; height: 48px; font-size: 1.1rem; }
.tbtn.swap { right: 90px; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); width: 48px; height: 48px; font-size: 1.1rem; }
.tbtn.menu-b { right: 10px; top: calc(60px + env(safe-area-inset-top, 0px)); width: 40px; height: 40px; font-size: 1rem; border-radius: 10px; }
@media (hover: none) and (pointer: coarse) {
  .chat-box { bottom: auto; top: calc(56px + env(safe-area-inset-top, 0px)); width: min(240px, 40vw); }
  .chat-box .log { max-height: 60px; font-size: .75rem; }
  .hp .bar { width: 90px; }
  .feed { top: calc(8px + env(safe-area-inset-top, 0px)); right: 56px; font-size: .75rem; }
}

.conn { position: fixed; top: 0; inset-inline: 0; z-index: 90; text-align: center; background: var(--red); color: #fff; font-weight: 700; padding: 6px; }
.toast { position: fixed; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); z-index: 95; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 600; max-width: min(90vw, 460px); text-align: center; }
@media (max-width: 560px) { .bcols { grid-template-columns: 1fr; } }

.crosshair i:nth-child(1) { top: calc(-8px - var(--gap, 5px)); }
.crosshair i:nth-child(2) { top: var(--gap, 5px); }
.crosshair i:nth-child(3) { left: calc(-8px - var(--gap, 5px)); }
.crosshair i:nth-child(4) { left: var(--gap, 5px); }

.radar-panel { position:absolute; top:18px; left:18px; width:180px; padding:10px; background:#111a20d9; border:1px solid #d9d9bc40; border-radius:8px; color:#e5e6d4; direction:ltr; box-shadow:0 5px 25px #0005; }
.radar-panel span { font:600 10px sans-serif; letter-spacing:2px; }
.radar-panel canvas { display:block; width:100%; height:auto; }
.radar-panel small { display:block; text-align:center; font-size:10px; color:#c0cec6; }
.stance { position:absolute; bottom:82px; left:24px; font-size:12px; color:#dce6d2; text-shadow:0 1px 3px #000; }
.tbtn.crouch-b { right:184px; bottom:75px; font-size:13px; width:50px; height:50px; }
.tbtn.reload-b { right:184px; bottom:135px; font-size:18px; width:50px; height:50px; }
@media (max-height:600px), (max-width:600px) { .radar-panel { width:112px; left:8px; top:8px; padding:6px; } .radar-panel small { display:none; } .radar-panel span {font-size:8px;} }
@media (hover:none) and (pointer:coarse) { .chat-box { top:160px; } }

.reload-progress { position:absolute; left:50%; bottom:110px; transform:translateX(-50%); width:120px; text-align:center; color:#f2e4c1; font-size:12px; text-shadow:0 1px 4px #000; }
.reload-progress>div { height:3px; margin-top:6px; background:#ffffff30; }
.reload-progress i { display:block; height:100%; background:#edcb72; }
/* Tactical presentation: strong contrast, compact HUD, readable Hebrew. */
:root { --paper:#172126; --cream:#202c31; --ink:#e8e9dd; --muted:#9ca9a9; --gold:#d6b66e; --t:#b79557; --ct:#668a9d; }
body { background:radial-gradient(ellipse at 12% 18%,#4c5147 0%,#212e32 43%,#101a20 100%); }
.center-screen { background:repeating-linear-gradient(0deg,transparent 0 79px,#c9cebf05 80px),repeating-linear-gradient(90deg,transparent 0 79px,#c9cebf05 80px); }
.card-panel { width:min(470px,100%); border:1px solid #a3b6b43b; border-top:3px solid var(--gold); border-radius:6px; padding:36px 30px; background:linear-gradient(155deg,#243035f2,#121d22f5); box-shadow:0 28px 90px #0006; }
.logo { font-family:Impact,'Arial Narrow',Arial,sans-serif; font-weight:900; letter-spacing:.055em; font-size:clamp(3.4rem,13vw,5.2rem); color:#eee9da; text-shadow:none; }
.logo.small { font-size:1.9rem; text-shadow:none; }
.eyebrow { text-align:center; font-size:9px; letter-spacing:2px; color:#c1ac7e; margin:10px 0 16px; }
.home-rule { height:1px; background:linear-gradient(90deg,transparent,#d6b66e,transparent); margin:22px 10px 8px; }
.tagline { font-size:14px; color:#acb7b5; }
input,select { border:1px solid #7a8c8d55; border-radius:4px; background:#0f191e; color:#f1eee2; }
input::placeholder { color:#7d8c8d; }
.btn { border:1px solid #81959770; border-radius:4px; background:#29383e; color:#e4e8df; box-shadow:none; padding:11px 16px; }
.btn.primary { background:#d6b66e; color:#172126; border-color:#d6b66e; }
.btn:hover { filter:brightness(1.12); }
.btn:active:not(:disabled) { transform:translateY(1px); }
.btn.small { box-shadow:none; }
.or::before,.or::after { height:1px; background:#53656855; }
.menu { background:#091116b0; backdrop-filter:blur(5px); }
.menu-card { background:#172126f5; border:1px solid #a3b6b445; border-radius:7px; color:#e5e9de; box-shadow:0 25px 80px #0007; }
.chip { background:#26353c; color:#d6ded9; border:1px solid #657b8070; border-radius:4px; }
.chip.on { box-shadow:inset 0 -2px #d6b66e; }
.menu-head { border-color:#64787b55; }
.board { color:#e5e9de; }
.settings { padding:8px 0; border-top:1px solid #71817b35; font-size:13px; }
.settings summary { color:#d5c08b; cursor:pointer; }
.settings .pick { margin-top:10px; }
.settings select { width:auto; flex:1; padding:5px; }
.topbar { border-radius:3px; padding:0; gap:0; border:1px solid #bcc5bc35; background:#142127dc; box-shadow:0 4px 15px #0003; }
.tsc { border-radius:0; padding:4px 15px; font:700 22px 'Segoe UI',sans-serif; background:transparent!important; }
.tsc.t { color:#e0bd76; border-bottom:2px solid #b79557; }.tsc.ct { color:#91bed7; border-bottom:2px solid #668a9d; }
.clock { padding:4px 12px; font:600 17px 'Segoe UI',sans-serif; }
.radar-panel { border-radius:3px; background:#101c22e8; box-shadow:0 8px 25px #0004; }
.bottom .hp,.bottom .ammo { padding:9px 14px; background:#142127b8; border-bottom:2px solid #d6b66e70; border-radius:3px; }
.hp .bar { width:95px; height:5px; border:0; border-radius:0; }
#hpBar { background:#c4d8bd; }
.ammo b { color:#eee7cf; }
.feed li { border-radius:2px; background:#102029dd; border-right:2px solid #7c9297; padding:4px 10px; }
.chat-box { opacity:.58; }.chat-box:focus-within,.chat-box.fresh { opacity:1; }
#chatInput { background:#152329c9; color:#e9ece4; border:1px solid #6c858644; border-radius:3px; }
@media(max-width:600px) { .card-panel {padding:24px 20px;} .bottom .hp,.bottom .ammo {padding:6px 8px;} .hp .bar {width:50px;} .tsc{padding:3px 10px;} }

.chip.on { background:#bfa467; color:#152026; border-color:#d2bb87; }
.loadout { position:absolute; right:18px; bottom:96px; display:grid; gap:5px; width:168px; direction:ltr; pointer-events:auto; z-index:5; }
.weapon-slot { display:flex; align-items:center; gap:9px; padding:9px 10px; border:1px solid #74888d38; border-radius:3px; color:#a7b6b8; background:#132028d9; cursor:pointer; text-align:left; }
.weapon-slot span { flex:1; font:600 12px 'Segoe UI',sans-serif; }
.weapon-slot small { font:600 12px monospace; color:#e3e7de; }
.weapon-slot kbd { font:11px monospace; opacity:.65; }
.weapon-slot.active { color:#f5e9cb; border-color:#d6b66e; background:#30382bdd; box-shadow:inset 3px 0 #d6b66e; }
.weapon-slot:hover { border-color:#a0b4b7; }
.ammo-warning { position:absolute; bottom:84px; left:50%; transform:translateX(-50%); color:#f0bf74; font-size:12px; background:#201d16bf; padding:4px 10px; border-radius:3px; }
.ammo.low-ammo b { color:#ffc171; }
@media (hover:none) and (pointer:coarse), (max-height:600px) {
  .loadout { right:auto; left:50%; bottom:12px; transform:translateX(-50%); display:flex; width:220px; gap:3px; }
  .weapon-slot { flex:1; min-width:0; flex-direction:column; gap:3px; padding:5px 3px; }
  .weapon-slot span { font-size:9px; white-space:nowrap; }.weapon-slot small {display:none;}
  .ammo-warning {bottom:74px; font-size:10px;}
}
@media (max-width:500px) and (min-height:601px) { .loadout {width:124px;} .weapon-slot {padding:7px;} }
#chatBox input { background:#152329c9; color:#e9ece4; border:1px solid #6c858644; }
