/* Mother's Watch — desert gold, lapis blue, bone on weathered stone */
:root {
  --gold: #d9a441;
  --gold-soft: #e8c57a;
  --lapis: #1c2a4a;
  --lapis-deep: #0e1526;
  --bone: #ede3cf;
  --stone: #8a7a5e;
  --heal: #ffd977;
  --harm: #ff6d5a;
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: var(--lapis-deep); }
body { font-family: var(--serif); color: var(--bone); }
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
button { font-family: var(--serif); cursor: pointer; }

/* ---------- title ---------- */
#title-screen, #end-screen {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 115%, rgba(217,164,65,0.22), transparent 55%),
    linear-gradient(180deg, rgba(10,14,26,0.88), rgba(14,21,38,0.94));
  text-align: center;
}
.title-inner, .end-inner { max-width: 640px; padding: 24px; }
.title-glyphs { color: var(--gold); font-size: 28px; letter-spacing: 24px; padding-left: 24px; margin-bottom: 12px; opacity: 0.9; }
h1 {
  font-size: clamp(44px, 9vw, 84px); font-weight: 500; letter-spacing: 0.14em;
  color: var(--bone); line-height: 1.02;
  text-shadow: 0 0 34px rgba(217,164,65,0.35);
}
h2 { font-size: clamp(34px, 7vw, 60px); font-weight: 500; letter-spacing: 0.16em; color: var(--bone); }
.title-sub { color: var(--gold); font-style: italic; font-size: clamp(17px, 2.6vw, 22px); margin-top: 10px; letter-spacing: 0.08em; }
.title-story { margin: 22px auto 0; color: #cfc3a8; font-size: clamp(14px, 2vw, 17px); line-height: 1.65; }
.title-controls { margin: 22px auto 4px; color: #b6ab90; font-size: clamp(12px, 1.7vw, 15px); line-height: 1.9; }
.title-controls b { color: var(--gold-soft); font-weight: 600; }
#btn-start, #btn-restart {
  margin-top: 26px; padding: 14px 46px; font-size: 19px; letter-spacing: 0.22em;
  color: var(--lapis-deep); background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border: none; border-radius: 2px; box-shadow: 0 0 28px rgba(217,164,65,0.35);
}
#btn-start:hover, #btn-restart:hover { filter: brightness(1.1); }
.title-foot { margin-top: 26px; color: #7d7460; font-style: italic; font-size: 14px; }
.end-epitaph { margin-top: 14px; color: #cfc3a8; font-style: italic; font-size: 17px; line-height: 1.6; }
#end-stats { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 34px; text-align: left; max-width: 420px; margin-left: auto; margin-right: auto; font-size: 15px; color: #b6ab90; }
#end-stats .stat-v { color: var(--gold-soft); text-align: right; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#hud-top-left { position: absolute; top: 14px; left: 16px; }
#wave-label { font-size: 22px; letter-spacing: 0.28em; color: var(--gold-soft); text-shadow: 0 1px 6px #000; }
#sanctum-wrap { margin-top: 8px; width: 190px; }
.bar-label { font-size: 11px; letter-spacing: 0.3em; color: #a99e83; }
.bar { height: 8px; background: rgba(0,0,0,0.55); border: 1px solid rgba(217,164,65,0.4); margin-top: 3px; }
#sanctum-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #b98c2e, var(--gold)); transition: width .25s; }
#hud-top-right { position: absolute; top: 14px; right: 18px; text-align: right; }
#score { font-size: 34px; color: var(--bone); text-shadow: 0 0 14px rgba(217,164,65,0.5); }
#score-label { font-size: 11px; letter-spacing: 0.34em; color: #a99e83; }

#ally-cards { position: absolute; left: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.ally-card { width: 196px; background: rgba(10,14,26,0.62); border: 1px solid rgba(217,164,65,0.28); padding: 7px 10px 8px; }
.ally-card .ac-name { font-size: 14px; letter-spacing: 0.12em; color: var(--bone); display: flex; justify-content: space-between; }
.ally-card .ac-role { font-size: 10px; letter-spacing: 0.2em; color: #8f8468; }
.ally-card .bar { margin-top: 5px; height: 7px; }
.ally-card .ac-hp { height: 100%; background: linear-gradient(90deg, #4f7fb8, #7fb0e0); transition: width .2s; }
.ally-card.hurt .ac-hp { background: linear-gradient(90deg, #b8552e, #e08a5f); }
.ally-card.dead { opacity: 0.42; filter: grayscale(0.8); }
.ally-card.nano { border-color: var(--gold); box-shadow: 0 0 14px rgba(217,164,65,0.55); }
.ally-card .ac-status { font-size: 11px; color: var(--gold-soft); font-style: italic; min-height: 13px; }

#kit { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; }
.kit-slot {
  position: relative; width: 86px; padding: 8px 6px 7px; text-align: center;
  background: rgba(10,14,26,0.62); border: 1px solid rgba(217,164,65,0.28);
}
.kit-key { font-size: 13px; color: var(--gold-soft); letter-spacing: 0.12em; }
.kit-name { font-size: 9.5px; letter-spacing: 0.12em; color: #a99e83; margin-top: 3px; }
.kit-ammo { font-size: 21px; color: var(--bone); margin-top: 2px; }
.ammo-max { font-size: 12px; color: #8f8468; }
.kit-sub { font-size: 9.5px; color: #8f8468; }
.kit-cd { position: absolute; inset: 0; background: rgba(10,14,26,0.78); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--bone); }
.kit-slot.ready { border-color: rgba(217,164,65,0.7); box-shadow: 0 0 10px rgba(217,164,65,0.25); }

#event-feed { position: absolute; top: 76px; right: 18px; text-align: right; font-size: 14px; }
.feed-item { margin-top: 4px; color: var(--gold-soft); text-shadow: 0 1px 4px #000; animation: feedfade 3.2s forwards; }
.feed-item small { color: #a99e83; }
@keyframes feedfade { 0% { opacity: 0; transform: translateX(12px);} 8% {opacity:1; transform:none;} 75% {opacity:1;} 100% { opacity: 0; } }

#banner {
  position: absolute; top: 26%; left: 50%; transform: translateX(-50%);
  font-size: clamp(22px, 4.4vw, 40px); letter-spacing: 0.3em; color: var(--bone);
  text-shadow: 0 0 22px rgba(217,164,65,0.6), 0 2px 8px #000; text-align: center;
  animation: bannerin 3.4s forwards; pointer-events: none;
}
#banner small { display: block; font-size: 0.42em; letter-spacing: 0.4em; color: var(--gold-soft); margin-top: 6px; }
@keyframes bannerin { 0% {opacity:0; transform:translateX(-50%) scale(0.94);} 12% {opacity:1; transform:translateX(-50%) scale(1);} 80% {opacity:1;} 100% {opacity:0;} }

/* ---------- reticle / scope ---------- */
#reticle { position: absolute; z-index: 18; width: 0; height: 0; pointer-events: none; }
.ret-dot { position: absolute; width: 4px; height: 4px; left: -2px; top: -2px; background: var(--bone); border-radius: 50%; box-shadow: 0 0 6px rgba(0,0,0,0.8); }
.ret-arm { position: absolute; background: var(--bone); box-shadow: 0 0 4px rgba(0,0,0,0.8); }
.ret-arm.n { width: 1.5px; height: 9px; left: -0.75px; top: -16px; }
.ret-arm.s { width: 1.5px; height: 9px; left: -0.75px; top: 7px; }
.ret-arm.e { width: 9px; height: 1.5px; top: -0.75px; left: 7px; }
.ret-arm.w { width: 9px; height: 1.5px; top: -0.75px; left: -16px; }
#reticle.scoped { display: none; }

#hitmarker { position: absolute; z-index: 19; width: 0; height: 0; pointer-events: none; opacity: 0; }
#hitmarker::before, #hitmarker::after { content: ""; position: absolute; width: 18px; height: 2px; left: -9px; top: -1px; background: currentColor; }
#hitmarker::before { transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }
#hitmarker.show { animation: hm .3s forwards; }
@keyframes hm { 0% {opacity:1; transform:scale(1.25);} 100% {opacity:0; transform:scale(0.8);} }

#scope { position: absolute; inset: 0; z-index: 17; pointer-events: none; }
#scope::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 50%), transparent 0, transparent var(--sr, 220px), rgba(4,6,12,0.97) calc(var(--sr, 220px) + 3px));
}
.scope-ring { position: absolute; left: var(--sx, 50%); top: var(--sy, 50%); width: calc(var(--sr, 220px) * 2); height: calc(var(--sr, 220px) * 2); transform: translate(-50%, -50%); border: 1.5px solid rgba(237,227,207,0.75); border-radius: 50%; }
.scope-cross-h { position: absolute; left: var(--sx, 50%); top: var(--sy, 50%); width: calc(var(--sr, 220px) * 2); height: 1px; transform: translate(-50%, -50%); background: rgba(237,227,207,0.55); }
.scope-cross-v { position: absolute; left: var(--sx, 50%); top: var(--sy, 50%); width: 1px; height: calc(var(--sr, 220px) * 2); transform: translate(-50%, -50%); background: rgba(237,227,207,0.55); }
.scope-tick { position: absolute; left: var(--sx, 50%); top: var(--sy, 50%); background: rgba(237,227,207,0.55); }
.scope-tick.t1 { width: 1px; height: 10px; transform: translate(-50%, 34px); }
.scope-tick.t2 { width: 1px; height: 10px; transform: translate(-50%, 68px); }
.scope-label { position: absolute; left: var(--sx, 50%); top: var(--sy, 50%); transform: translate(-50%, calc(var(--sr, 220px) * 0.72)); font-size: 10px; letter-spacing: 0.4em; color: rgba(217,164,65,0.85); }

/* ---------- floaters (barks, damage numbers) ---------- */
#floaters { position: absolute; inset: 0; z-index: 16; pointer-events: none; overflow: hidden; }
.floater { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font-size: 15px; text-shadow: 0 1px 4px #000, 0 0 10px rgba(0,0,0,0.6); animation: floatup var(--fd, 2.2s) forwards; }
.floater.bark { color: var(--bone); font-style: italic; }
.floater.bark b { color: var(--gold-soft); font-style: normal; }
.floater.heal { color: var(--heal); font-size: 17px; }
.floater.harm { color: var(--harm); font-size: 17px; }
.floater.event { color: var(--gold); font-size: 18px; letter-spacing: 0.14em; }
@keyframes floatup { 0% {opacity:0; margin-top: 6px;} 10% {opacity:1;} 70% {opacity:1;} 100% { opacity: 0; margin-top: -26px; } }

/* ---------- touch ---------- */
#touch-ui { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
.t-btn {
  position: absolute; pointer-events: auto; min-width: 56px; min-height: 56px;
  border-radius: 50%; border: 1.5px solid rgba(217,164,65,0.55);
  background: rgba(10,14,26,0.55); color: var(--gold-soft);
  font-size: 11px; letter-spacing: 0.08em;
}
.t-btn:active { background: rgba(217,164,65,0.4); }
#t-fire { right: 18px; bottom: 108px; width: 88px; height: 88px; font-size: 15px; }
#t-scope { right: 122px; bottom: 84px; }
#t-sleep { right: 26px; bottom: 216px; }
#t-grenade { right: 96px; bottom: 196px; }
#t-nano { right: 160px; bottom: 158px; }
#t-reload { right: 26px; bottom: 292px; }

#btn-mute {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 45;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(217,164,65,0.4);
  background: rgba(10,14,26,0.5); color: var(--gold-soft); font-size: 16px;
}
#btn-mute.muted { color: #6b6350; text-decoration: line-through; }

@media (max-width: 720px) {
  #ally-cards { width: auto; left: 8px; bottom: 8px; gap: 5px; }
  .ally-card { width: 138px; padding: 5px 7px 6px; }
  .ally-card .ac-name { font-size: 11px; }
  #kit { display: none; }
  #hud-top-left { top: 8px; left: 8px; }
  #sanctum-wrap { width: 130px; }
  #wave-label { font-size: 16px; }
  #hud-top-right { top: 8px; right: 10px; }
  #score { font-size: 24px; }
  #event-feed { top: 56px; right: 10px; font-size: 12px; }
  .title-controls { font-size: 12px; }
}
