/* RYUJIN — a Genji minigame. Black, gunmetal, neon green on indigo night. Sharp geometric sans. */
:root {
  --green: #8dff2f;
  --green-dim: #57b31d;
  --indigo: #0a0d1a;
  --indigo-2: #121728;
  --gun: #2a2f3a;
  --red: #ff4a3d;
  --warm: #ffb35c;
  --font: "Avenir Next", Futura, "Century Gothic", "Trebuchet MS", "Segoe UI", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--indigo); }
body { font-family: var(--font); color: #dfe6dd; -webkit-user-select: none; user-select: none; }
#app { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }
.hud-label { font-size: 10px; letter-spacing: 3px; color: #7c8a80; font-weight: 600; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#hud-top-left { position: absolute; top: 18px; left: 20px; }
#health-bar { width: 210px; height: 12px; background: rgba(10,13,26,.75); border: 1px solid #3a4353; margin-top: 5px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
#health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--green-dim), var(--green));
  transition: width .15s ease-out; }
#health-fill.low { background: linear-gradient(90deg, #b3271d, var(--red)); }
#health-num { font-size: 20px; font-weight: 700; color: var(--green); margin-top: 3px; letter-spacing: 1px; }

#hud-top-center { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
#wave-label { font-size: 20px; font-weight: 700; letter-spacing: 6px; color: #e8f2e2; text-shadow: 0 0 14px rgba(141,255,47,.4); }
#enemies-left { font-size: 11px; letter-spacing: 3px; color: #93a096; margin-top: 4px; }

#hud-top-right { position: absolute; top: 18px; right: 20px; text-align: right; }
#score-num { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: 1px; text-shadow: 0 0 12px rgba(141,255,47,.5); }
#chain-indicator { font-size: 13px; font-weight: 700; color: var(--green); letter-spacing: 2px; margin-top: 2px;
  animation: chain-pulse .5s ease-in-out infinite alternate; }
@keyframes chain-pulse { from { opacity: .75; } to { opacity: 1; text-shadow: 0 0 10px var(--green); } }

#hud-bottom-center { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); text-align: center; }
#blade-bar { width: 260px; height: 9px; background: rgba(10,13,26,.75); border: 1px solid #3a4353; margin-top: 5px;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
#blade-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #1f5c14, var(--green)); box-shadow: 0 0 12px rgba(141,255,47,.6); }
#blade-bar.active #blade-fill { animation: blade-burn .4s linear infinite; }
@keyframes blade-burn { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.7); } }
#blade-ready { font-size: 12px; font-weight: 700; letter-spacing: 3px; color: var(--green); margin-top: 6px;
  animation: chain-pulse .6s ease-in-out infinite alternate; }

#hud-bottom-right { position: absolute; bottom: 20px; right: 20px; display: flex; gap: 10px; }
.cooldown { position: relative; width: 58px; height: 58px; background: rgba(10,13,26,.8); border: 1px solid #3a4353;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.cooldown .cd-fill { position: absolute; left: 0; bottom: 0; width: 100%; height: 0%; background: rgba(141,255,47,.22); }
.cooldown .cd-key { font-size: 13px; font-weight: 700; color: var(--green); z-index: 1; }
.cooldown .cd-name { font-size: 6.5px; letter-spacing: 1px; color: #93a096; z-index: 1; margin-top: 2px; }
.cooldown.ready { border-color: var(--green); box-shadow: 0 0 10px rgba(141,255,47,.35); }

#announce { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-size: 30px; font-weight: 700;
  letter-spacing: 8px; color: #fff; text-shadow: 0 0 20px rgba(141,255,47,.8); white-space: nowrap;
  animation: announce-in 2.4s ease-out forwards; }
@keyframes announce-in { 0% { opacity: 0; transform: translateX(-50%) scale(1.3); } 12% { opacity: 1; transform: translateX(-50%) scale(1); } 78% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- Floaters ---------- */
#floaters { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
.floater { position: absolute; font-size: 14px; font-weight: 700; letter-spacing: 1px; color: #fff;
  text-shadow: 0 0 8px rgba(141,255,47,.7); transform: translate(-50%, -50%); white-space: nowrap;
  transition: opacity .1s; }
.floater.style { color: var(--green); font-size: 16px; }
.floater.returned { color: var(--warm); font-size: 15px; }

/* ---------- Overlays ---------- */
.overlay { position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 65%, rgba(10,13,26,.42) 0%, rgba(10,13,26,.88) 100%); }
.title-inner, .panel { text-align: center; max-width: 640px; padding: 24px; }
.title-kanji { font-size: 74px; color: var(--green); text-shadow: 0 0 34px rgba(141,255,47,.65); line-height: 1;
  font-family: "Hiragino Sans", "Yu Gothic", var(--font); }
.game-title { font-size: 58px; font-weight: 700; letter-spacing: 18px; margin: 10px 0 2px 18px; color: #fff;
  text-shadow: 0 0 24px rgba(141,255,47,.45); }
.title-sub { font-size: 11px; letter-spacing: 5px; color: #8fa094; margin-bottom: 18px; }
.title-story { font-size: 14px; line-height: 1.65; color: #b9c4b6; max-width: 480px; margin: 0 auto 26px; }
.big-btn { font-family: var(--font); font-size: 16px; font-weight: 700; letter-spacing: 4px; color: var(--indigo);
  background: var(--green); border: none; padding: 15px 38px; cursor: pointer; pointer-events: auto;
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
  transition: transform .12s, box-shadow .12s; }
.big-btn:hover { transform: translateY(-2px); box-shadow: 0 0 26px rgba(141,255,47,.55); }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 26px; margin-top: 28px; text-align: left;
  font-size: 12px; color: #9aa79c; }
.ctl { display: inline-block; min-width: 108px; font-weight: 700; color: var(--green); letter-spacing: 1px; }
.title-foot { margin-top: 18px; font-size: 10.5px; letter-spacing: 2px; color: #67736b; }
.panel h2 { font-size: 38px; letter-spacing: 10px; color: #fff; margin-bottom: 8px; }
.go-title { color: var(--red) !important; text-shadow: 0 0 22px rgba(255,74,61,.5); }
.win-title { color: var(--green) !important; text-shadow: 0 0 22px rgba(141,255,47,.6); }
.panel-sub { font-size: 13px; color: #9aa79c; font-style: italic; margin-bottom: 20px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 8px 30px; margin: 0 auto 26px;
  max-width: 420px; font-size: 13px; text-align: left; }
.stats .stat-row { display: flex; justify-content: space-between; border-bottom: 1px solid #26303f; padding: 5px 0; }
.stats .stat-k { color: #8fa094; letter-spacing: 2px; font-size: 11px; }
.stats .stat-v { font-weight: 700; color: var(--green); }

/* ---------- Touch ---------- */
#touch-ui { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 55%; pointer-events: auto; }
#stick-base { position: absolute; width: 118px; height: 118px; border-radius: 50%; border: 2px solid rgba(141,255,47,.4);
  background: rgba(10,13,26,.35); display: none; }
#stick-nub { position: absolute; width: 48px; height: 48px; border-radius: 50%; background: rgba(141,255,47,.5);
  left: 35px; top: 35px; }
#touch-buttons { position: absolute; right: 12px; bottom: 18px; display: grid; grid-template-columns: 64px 64px;
  gap: 10px; pointer-events: auto; }
.tbtn { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(141,255,47,.55);
  background: rgba(10,13,26,.55); color: var(--green); font-family: var(--font); font-weight: 700;
  font-size: 12px; letter-spacing: 1px; pointer-events: auto; }
.tbtn:active { background: rgba(141,255,47,.35); }
.tbtn-fire { border-color: rgba(255,255,255,.6); color: #fff; }

#mute-btn { position: absolute; top: 14px; right: 14px; z-index: 20; width: 36px; height: 36px;
  background: rgba(10,13,26,.6); border: 1px solid #3a4353; color: var(--green); font-size: 16px; cursor: pointer; }
#hud:not(.hidden) ~ #mute-btn { top: 64px; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .game-title { font-size: 34px; letter-spacing: 10px; margin-left: 10px; }
  .title-kanji { font-size: 48px; }
  .controls-grid { grid-template-columns: 1fr; gap: 5px; font-size: 11px; }
  .ctl { min-width: 92px; }
  .title-story { font-size: 12.5px; }
  #health-bar { width: 140px; }
  #wave-label { font-size: 15px; letter-spacing: 3px; }
  #hud-top-center { top: 66px; }
  #score-num { font-size: 20px; }
  #blade-bar { width: 170px; }
  #hud-bottom-center { bottom: 118px; }
  #hud-bottom-right { top: 118px; bottom: auto; right: auto; left: 20px; flex-direction: row; }
  .cooldown { width: 46px; height: 46px; }
  .panel h2 { font-size: 24px; letter-spacing: 5px; }
  #announce { font-size: 20px; letter-spacing: 4px; }
}
