/* Hanzo: Shadow of the Shimada — ink & lantern UI */
@font-face {
  font-family: 'Ma Shan Zheng';
  src: url('../fonts/mashanzheng-subset.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-weight: 300;
  src: url('../fonts/cormorant-light.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-weight: 500;
  src: url('../fonts/cormorant-medium.woff2') format('woff2');
  font-display: swap;
}

:root {
  --ink: #0b0e1a;
  --indigo: #1c2a4a;
  --bone: #e8e2d0;
  --teal: #3fd0c0;
  --vermillion: #c33a2a;
  --lantern: #ffb46b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--ink); }
body {
  font-family: 'Cormorant Garamond', 'Songti SC', 'Hiragino Mincho ProN', Georgia, serif;
  color: var(--bone);
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 55%, rgba(5,7,14,0.55) 100%),
    linear-gradient(to bottom, rgba(5,7,14,0.35), transparent 12%, transparent 88%, rgba(5,7,14,0.5));
}

/* ============ HUD ============ */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.hud-label {
  font-family: Georgia, serif; font-size: 10px; letter-spacing: 0.28em;
  color: rgba(232,226,208,0.55); text-transform: uppercase;
}
#hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 26px 0;
}
#hud-score #score-value, #hud-targets #targets-value {
  font-size: 34px; font-weight: 300; letter-spacing: 0.06em; color: var(--bone);
  text-shadow: 0 0 18px rgba(63,208,192,0.25);
}
#hud-objective { text-align: center; }
#objective-text { font-size: 17px; letter-spacing: 0.12em; color: rgba(232,226,208,0.85); }
#alarm-wrap { margin-top: 6px; display: flex; align-items: center; gap: 8px; justify-content: center; }
#alarm-bar {
  width: 130px; height: 4px; background: rgba(232,226,208,0.14);
  border-radius: 2px; overflow: hidden;
}
#alarm-fill {
  height: 100%; width: 0%; background: var(--vermillion);
  box-shadow: 0 0 8px rgba(195,58,42,0.8); transition: width 0.4s ease;
}
#hud-targets { text-align: right; }

#hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 0 26px 20px;
}
#health-bar {
  width: 180px; height: 6px; margin: 6px 0 10px;
  background: rgba(232,226,208,0.12); border-radius: 3px; overflow: hidden;
}
#health-fill {
  height: 100%; width: 100%; background: linear-gradient(90deg, var(--bone), var(--teal));
  box-shadow: 0 0 10px rgba(63,208,192,0.5); transition: width 0.25s ease;
}
#arrow-count #arrows-value { font-size: 26px; color: var(--bone); }
#arrow-count.low #arrows-value { color: var(--vermillion); }

#hud-abilities { display: flex; gap: 14px; }
.ability {
  min-width: 74px; padding: 8px 10px 6px; text-align: center;
  border: 1px solid rgba(232,226,208,0.22); border-radius: 3px;
  background: rgba(11,14,26,0.55); backdrop-filter: blur(3px);
}
.ability .ab-count { font-size: 22px; color: var(--teal); }
.ability .ab-key {
  display: inline-block; margin-top: 3px; padding: 1px 7px;
  border: 1px solid rgba(232,226,208,0.4); border-radius: 2px;
  font-size: 11px; letter-spacing: 0.1em; color: var(--bone);
}
.ability .ab-name { margin-top: 4px; font-size: 9px; letter-spacing: 0.22em; color: rgba(232,226,208,0.55); }
.ability.armed { border-color: var(--teal); box-shadow: 0 0 14px rgba(63,208,192,0.35); }
.ability.empty { opacity: 0.35; }
.ability.empty .ab-count { color: var(--vermillion); }

#crosshair {
  position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  pointer-events: none; left: 50%; top: 50%;
}
#draw-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(232,226,208,0.5);
  transition: none;
}
#draw-dot {
  position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px; border-radius: 50%; background: var(--bone);
}
#crosshair.drawing #draw-ring { border-color: var(--teal); box-shadow: 0 0 12px rgba(63,208,192,0.4); }
#crosshair.full #draw-ring { border-color: var(--vermillion); box-shadow: 0 0 16px rgba(195,58,42,0.55); }

#popups { position: absolute; inset: 0; overflow: hidden; }
.popup {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 19px; letter-spacing: 0.12em; color: var(--bone);
  text-shadow: 0 0 10px rgba(63,208,192,0.6); white-space: nowrap;
  animation: pop-rise 1.5s ease-out forwards;
}
.popup.headshot { color: var(--teal); }
.popup.longshot { color: var(--lantern); }
.popup.dragon { color: var(--vermillion); font-size: 23px; }
.popup.bonus { color: var(--bone); font-size: 15px; opacity: 0.9; }
@keyframes pop-rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  25% { transform: translate(-50%, -55%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -160%); }
}

#mute-btn {
  position: absolute; top: 64px; right: 26px; pointer-events: auto; cursor: pointer;
  width: 30px; height: 30px; text-align: center; line-height: 28px;
  border: 1px solid rgba(232,226,208,0.25); border-radius: 3px;
  color: rgba(232,226,208,0.6); background: rgba(11,14,26,0.5); font-size: 14px;
}
#mute-btn.muted { color: var(--vermillion); text-decoration: line-through; }

/* ============ Touch UI ============ */
#touch-ui { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 55%; pointer-events: auto; }
#stick-base {
  position: absolute; left: 60px; bottom: 90px; width: 110px; height: 110px;
  border: 1px solid rgba(232,226,208,0.3); border-radius: 50%;
  background: rgba(11,14,26,0.35); opacity: 0.8;
}
#stick-nub {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  margin: -22px 0 0 -22px; border-radius: 50%;
  background: rgba(232,226,208,0.35); border: 1px solid rgba(232,226,208,0.5);
}
#draw-btn {
  position: absolute; right: 34px; bottom: 96px; width: 108px; height: 108px;
  border-radius: 50%; border: 2px solid rgba(63,208,192,0.6);
  background: rgba(11,14,26,0.5); color: var(--teal);
  font-family: Georgia, serif; font-size: 15px; letter-spacing: 0.25em;
  pointer-events: auto;
}
#draw-btn.drawing { background: rgba(63,208,192,0.25); box-shadow: 0 0 24px rgba(63,208,192,0.5); }
#touch-abilities {
  position: absolute; right: 26px; bottom: 220px; display: flex; flex-direction: column; gap: 10px;
  pointer-events: auto;
}
.touch-ab {
  width: 64px; height: 44px; border-radius: 4px;
  border: 1px solid rgba(232,226,208,0.35); background: rgba(11,14,26,0.55);
  color: var(--bone); font-family: Georgia, serif; font-size: 11px; letter-spacing: 0.15em;
}
.touch-ab.empty { opacity: 0.3; }

/* ============ Screens ============ */
.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 45%, rgba(11,14,26,0.62) 0%, rgba(7,9,17,0.92) 100%);
}
#title-screen { flex-direction: column; }
.title-ink { text-align: center; max-width: 640px; padding: 0 24px; }
#title-kanji {
  font-family: 'Ma Shan Zheng', 'Hiragino Mincho ProN', serif;
  font-size: 130px; line-height: 1; color: var(--bone);
  text-shadow: 0 0 40px rgba(63,208,192,0.3), 0 4px 0 rgba(195,58,42,0.35);
}
#title-name {
  font-size: 44px; font-weight: 300; letter-spacing: 0.55em; margin: 14px 0 4px 0.55em;
}
#title-sub {
  font-family: Georgia, serif; font-size: 12px; letter-spacing: 0.42em;
  color: rgba(232,226,208,0.55);
}
.title-rule {
  width: 210px; height: 1px; margin: 26px auto;
  background: linear-gradient(90deg, transparent, var(--vermillion), transparent);
}
#title-flavor {
  font-size: 17px; font-style: italic; line-height: 1.75;
  color: rgba(232,226,208,0.78); margin-bottom: 30px;
}
.brush-btn {
  pointer-events: auto; cursor: pointer;
  font-family: Georgia, serif; font-size: 15px; letter-spacing: 0.35em;
  color: var(--bone); background: transparent;
  border: 1px solid rgba(232,226,208,0.4); padding: 14px 38px 14px calc(38px + 0.35em);
  transition: all 0.25s ease; border-radius: 2px;
}
.brush-btn:hover, .brush-btn:focus-visible {
  border-color: var(--teal); color: var(--teal);
  box-shadow: 0 0 22px rgba(63,208,192,0.25), inset 0 0 22px rgba(63,208,192,0.08);
}
#controls-list {
  margin-top: 34px; font-size: 14px; line-height: 2.1; color: rgba(232,226,208,0.6);
}
#controls-list .ck {
  display: inline-block; padding: 0 7px; margin: 0 2px;
  border: 1px solid rgba(232,226,208,0.3); border-radius: 2px;
  font-size: 11px; letter-spacing: 0.12em; color: var(--bone);
}

.panel {
  text-align: center; max-width: 620px; padding: 40px 34px;
  border: 1px solid rgba(232,226,208,0.18); border-radius: 4px;
  background: rgba(9,12,22,0.72); backdrop-filter: blur(4px);
  margin: 0 20px;
}
.panel-kanji {
  font-family: 'Ma Shan Zheng', 'Hiragino Mincho ProN', serif;
  font-size: 64px; color: var(--vermillion); line-height: 1;
  text-shadow: 0 0 26px rgba(195,58,42,0.45);
}
.panel h2 {
  font-weight: 300; font-size: 26px; letter-spacing: 0.35em;
  margin: 16px 0 18px 0.35em; color: var(--bone);
}
.panel p { font-size: 16px; line-height: 1.8; color: rgba(232,226,208,0.78); margin-bottom: 16px; }
.brief-tips { font-style: italic; color: rgba(63,208,192,0.75) !important; }
.breakdown {
  margin: 6px auto 18px; max-width: 340px; text-align: left;
  font-size: 15px; line-height: 2; color: rgba(232,226,208,0.85);
}
.breakdown .row { display: flex; justify-content: space-between; }
.breakdown .row.total {
  border-top: 1px solid rgba(232,226,208,0.25); margin-top: 8px; padding-top: 8px;
  color: var(--teal); font-size: 18px;
}
.end-flavor { font-style: italic; }

@media (max-width: 720px) {
  #title-kanji { font-size: 84px; }
  #title-name { font-size: 28px; }
  #title-flavor { font-size: 14px; }
  #controls-list { font-size: 12px; line-height: 1.9; }
  .panel { padding: 26px 20px; }
  .panel p { font-size: 14px; }
  #hud-top { padding: 10px 14px 0; }
  #hud-bottom { padding: 0 14px 14px; }
  #hud-score #score-value, #hud-targets #targets-value { font-size: 24px; }
  #health-bar { width: 120px; }
  #hud-abilities { display: none; }
  #mute-btn { top: 52px; right: 14px; }
  #objective-text { font-size: 13px; }
}
