@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@400;700;900&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: radial-gradient(ellipse at center, #1a0c10 0%, #060408 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Noto Serif JP', 'Georgia', 'Times New Roman', serif;
  color: #e8dcc8;
  overflow: hidden;
}

#game-container {
  position: relative;
  box-shadow:
    0 0 40px rgba(100, 60, 40, 0.25),
    0 0 80px rgba(0, 0, 0, 0.92),
    inset 0 0 60px rgba(0, 0, 0, 0.35);
  border: 3px solid #3a2218;
  outline: 1px solid #6a4030;
  outline-offset: 4px;
  background: linear-gradient(145deg, #1a100c 0%, #0a0604 100%);
}

#game-canvas {
  display: block;
  background: #120810;
  cursor: crosshair;
}

#ui-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#ui-overlay .screen {
  pointer-events: auto;
}

.hidden {
  display: none !important;
}

/* HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  animation: hud-fade-in 0.6s ease;
}

#hud .hud-controls {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

#hud .mute-btn {
  position: static;
}

.lite-btn {
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(22, 12, 8, 0.92), rgba(10, 5, 5, 0.88));
  border: 2px solid #4a2820;
  border-radius: 2px;
  color: #c9a86c;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
  height: 36px;
  min-width: 36px;
  padding: 0 8px;
  cursor: pointer;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.lite-btn:hover {
  background: linear-gradient(180deg, rgba(40, 22, 14, 0.95), rgba(20, 10, 8, 0.9));
  border-color: #8a5040;
}

.lite-btn.active {
  color: #80c0ff;
  border-color: #406080;
  background: linear-gradient(180deg, rgba(16, 24, 36, 0.95), rgba(8, 12, 20, 0.9));
}

@keyframes hud-fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

#player-bars {
  min-width: 240px;
}

.hp-label,
.stamina-label {
  font-size: 10px;
  letter-spacing: 4px;
  color: #c9a86c;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px;
  text-shadow: 0 0 10px rgba(200, 80, 40, 0.5);
}

.stamina-label {
  margin-top: 8px;
  color: #8090a8;
  letter-spacing: 3px;
}

.bar-track {
  width: 240px;
  height: 16px;
  background:
    linear-gradient(180deg, rgba(8, 4, 4, 0.95), rgba(18, 8, 8, 0.88)),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(60, 35, 20, 0.15) 3px, rgba(60, 35, 20, 0.15) 4px);
  border: 2px solid #4a2820;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.65),
    0 1px 0 rgba(255, 120, 60, 0.12),
    inset 0 0 0 1px rgba(120, 70, 40, 0.2);
}

.bar-track::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 23px,
    rgba(0, 0, 0, 0.15) 23px,
    rgba(0, 0, 0, 0.15) 24px
  );
  pointer-events: none;
}

#player-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #e05040 0%, #c03028 40%, #801818 100%);
  transition: width 0.2s ease;
  box-shadow: inset 0 2px 0 rgba(255, 160, 120, 0.5);
  position: relative;
}

#player-hp-fill.hp-damage {
  animation: hp-pulse 0.3s ease;
  filter: brightness(1.4);
}

@keyframes hp-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.6) saturate(1.3); }
}

#player-stamina-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(180deg, #6080b0, #304060);
  transition: width 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(160, 200, 255, 0.3);
}

#player-stamina-fill.stamina-low {
  background: linear-gradient(180deg, #a06040, #603020);
  animation: stamina-warn 0.8s ease infinite;
}

#player-hp-fill.hp-danger {
  animation: hp-danger-pulse 1s ease infinite;
}

@keyframes hp-danger-pulse {
  0%, 100% { filter: brightness(1); box-shadow: none; }
  50% { filter: brightness(1.3); box-shadow: 0 0 12px rgba(255, 40, 20, 0.6); }
}

#onimusha-stats {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.stat-item {
  font-size: 11px;
  color: #a09080;
  letter-spacing: 1px;
}

.stat-label {
  color: #807060;
  font-size: 10px;
}

#soul-count {
  color: #80d0ff;
  font-weight: bold;
}

#weapon-level {
  color: #ffd060;
  font-weight: bold;
}

#herb-count {
  color: #50e060;
  font-weight: bold;
}

.element-icon {
  font-size: 14px;
}

.element-icon.element-fire {
  filter: drop-shadow(0 0 4px rgba(255, 100, 40, 0.8));
}

.element-icon.element-wind {
  filter: drop-shadow(0 0 4px rgba(100, 180, 255, 0.8));
}

.lockon-indicator {
  color: #605040;
  font-size: 12px;
  opacity: 0.4;
}

.lockon-indicator.active {
  color: #ffd060;
  opacity: 1;
  animation: lockon-pulse 0.8s ease infinite;
}

@keyframes lockon-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.story-lore {
  font-size: 13px;
  color: #908070;
  max-width: 420px;
  line-height: 1.8;
  margin: -16px 0 24px;
  font-style: normal;
  letter-spacing: 0.5px;
}

.stage-name-jp {
  display: block;
  font-size: 11px;
  color: #a08060;
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.transition-chapter {
  display: block;
  font-size: 28px;
  font-weight: 900;
  color: #c9a040;
  letter-spacing: 8px;
  margin-bottom: 12px;
  text-shadow: 0 0 20px rgba(200, 160, 64, 0.4);
}

.transition-subtitle {
  display: block;
  font-size: 13px;
  color: #807060;
  letter-spacing: 2px;
  margin-top: 16px;
  font-style: italic;
}

.transition-lore {
  display: block;
  font-size: 12px;
  color: #a05040;
  letter-spacing: 1px;
  margin-top: 10px;
  max-width: 360px;
  line-height: 1.6;
}

@keyframes stamina-warn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.stamina-track {
  height: 8px;
  border-color: #3a4050;
}

#stage-hud {
  font-size: 12px;
  letter-spacing: 3px;
  color: #c9a86c;
  background:
    linear-gradient(180deg, rgba(22, 12, 8, 0.92), rgba(10, 5, 5, 0.88)),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(80, 50, 30, 0.08) 2px, rgba(80, 50, 30, 0.08) 3px);
  padding: 8px 16px;
  border: 2px solid #4a2820;
  border-radius: 2px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(180, 120, 60, 0.1);
  text-align: center;
}

#stage-current {
  color: #ffd060;
  font-weight: bold;
  font-size: 18px;
}

.mute-btn {
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(22, 12, 8, 0.92), rgba(10, 5, 5, 0.88));
  border: 2px solid #4a2820;
  border-radius: 2px;
  color: #c9a86c;
  font-size: 16px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
  transition: background 0.2s, border-color 0.2s;
}

.mute-btn:hover {
  background: linear-gradient(180deg, rgba(40, 22, 14, 0.95), rgba(20, 10, 8, 0.9));
  border-color: #8a5040;
}

.mute-btn.muted {
  color: #605040;
  opacity: 0.75;
}

#enemy-count {
  font-size: 12px;
  letter-spacing: 3px;
  color: #a08060;
  background:
    linear-gradient(180deg, rgba(22, 12, 8, 0.92), rgba(10, 5, 5, 0.88)),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(80, 50, 30, 0.08) 2px, rgba(80, 50, 30, 0.08) 3px);
  padding: 8px 16px;
  border: 2px solid #4a2820;
  border-radius: 2px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(180, 120, 60, 0.1);
}

#enemies-left {
  color: #e06040;
  font-weight: bold;
  font-size: 16px;
}

.special-hint {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 18px;
  font-size: 13px;
  letter-spacing: 1px;
  color: #ffd060;
  background: rgba(20, 8, 4, 0.88);
  border: 1px solid #806030;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.3s;
}

.special-hint.hidden {
  display: none;
}

#rank-hud {
  font-size: 11px;
  letter-spacing: 2px;
  color: #807060;
  background: linear-gradient(180deg, rgba(22, 12, 8, 0.92), rgba(10, 5, 5, 0.88));
  padding: 6px 12px;
  border: 2px solid #4a2820;
  border-radius: 2px;
  text-align: center;
}

.rank-label {
  display: block;
  font-size: 9px;
  letter-spacing: 3px;
  margin-bottom: 2px;
}

.stage-rank-hud {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 2px;
}

.stage-rank-hud.rank-s { color: #ffe060; text-shadow: 0 0 12px rgba(255, 220, 80, 0.7); }
.stage-rank-hud.rank-a { color: #80d0ff; }
.stage-rank-hud.rank-b { color: #a0c080; }
.stage-rank-hud.rank-c { color: #908070; }
.stage-rank-hud.rank-d { color: #804040; text-shadow: 0 0 8px rgba(120, 40, 40, 0.5); }

.weapon-style-icon {
  font-size: 14px;
  color: #ffd060;
}

.buff-icons {
  font-size: 11px;
  color: #c0a080;
  letter-spacing: 1px;
}

.clash-hint {
  color: #e0e0ff;
  font-weight: bold;
  letter-spacing: 1px;
}

.weapon-select-section {
  margin-bottom: 20px;
  max-width: 440px;
}

.weapon-select-section h3 {
  font-size: 11px;
  letter-spacing: 4px;
  color: #807060;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.weapon-select-note {
  font-size: 11px;
  color: #706050;
  margin-bottom: 10px;
}

.weapon-select-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.weapon-card {
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(30, 18, 14, 0.95), rgba(18, 10, 8, 0.9));
  border: 2px solid #5a4030;
  border-radius: 4px;
  padding: 12px 16px;
  min-width: 100px;
  cursor: pointer;
  font-family: inherit;
  color: #c0b0a0;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.weapon-card:hover {
  border-color: #a06040;
  transform: translateY(-2px);
}

.weapon-card.selected {
  border-color: #ffd060;
  box-shadow: 0 0 16px rgba(255, 200, 80, 0.35);
  color: #ffe0a0;
}

.weapon-card-icon {
  font-size: 22px;
}

.weapon-card-name {
  font-size: 14px;
  font-weight: bold;
  color: #c9a040;
}

.weapon-card-sub {
  font-size: 10px;
  letter-spacing: 1px;
  color: #807060;
}

.item-legend {
  margin-bottom: 24px;
  max-width: 440px;
}

.item-legend h3 {
  font-size: 11px;
  letter-spacing: 4px;
  color: #807060;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.item-legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 11px;
  color: #908070;
  text-align: left;
}

.victory-rank-requirements {
  font-size: 11px;
  color: #807060;
  line-height: 1.7;
  margin: 0 0 16px;
  text-align: left;
}

.victory-weapon-select {
  margin-top: 12px;
  margin-bottom: 12px;
}

.victory-rank.rank-d { color: #804040; }

.wave-indicator {
  display: block;
  font-size: 10px;
  color: #ffd060;
  margin-top: 4px;
  letter-spacing: 1px;
}

.wave-indicator.hidden {
  display: none !important;
}

#victory-rank-panel {
  margin-bottom: 24px;
  padding: 16px 24px;
  border: 1px solid #5a4030;
  background: rgba(20, 10, 8, 0.6);
  min-width: 280px;
}

.victory-rank-label {
  font-size: 11px;
  letter-spacing: 4px;
  color: #807060;
  margin-bottom: 8px;
}

.victory-rank {
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 16px;
}

.victory-rank.rank-s { color: #ffe060; text-shadow: 0 0 30px rgba(255, 220, 80, 0.8); }
.victory-rank.rank-a { color: #80d0ff; text-shadow: 0 0 20px rgba(100, 180, 255, 0.6); }
.victory-rank.rank-b { color: #a0c080; }
.victory-rank.rank-c { color: #908070; }

.victory-rank-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  text-align: left;
  font-size: 12px;
  color: #a09080;
  margin-bottom: 12px;
}

.rank-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid rgba(80, 60, 40, 0.3);
  padding-bottom: 4px;
}

.victory-best {
  font-size: 12px;
  color: #807060;
  margin: 0;
}

.stage-btn[data-rank="S"] { border-color: #ffd060; color: #ffe080; }
.stage-btn[data-rank="A"] { border-color: #80c0ff; }
.stage-btn[data-rank="B"] { border-color: #80a060; }

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at center, rgba(35, 12, 18, 0.94) 0%, rgba(5, 2, 4, 0.98) 100%);
  text-align: center;
  padding: 40px;
  animation: screen-fade-in 0.8s ease;
  overflow-y: auto;
}

@keyframes screen-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.screen::before,
.screen::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.screen::before {
  inset: 20px;
  border: 1px solid rgba(180, 100, 60, 0.25);
  border-radius: 2px;
}

.screen::after {
  inset: 28px;
  border: 1px solid rgba(120, 60, 40, 0.15);
}

.screen h1 {
  font-size: 64px;
  font-weight: 900;
  color: #d04030;
  text-shadow:
    0 0 40px rgba(200, 40, 20, 0.7),
    0 0 80px rgba(120, 20, 10, 0.4),
    0 3px 6px #000;
  letter-spacing: 12px;
  margin-bottom: 6px;
  position: relative;
}

.screen h2 {
  font-size: 20px;
  color: #c9a86c;
  letter-spacing: 8px;
  font-weight: 400;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(200, 160, 80, 0.3);
}

.screen h2.title-jp {
  font-size: 18px;
  color: #a08050;
  letter-spacing: 6px;
  margin-top: -4px;
}

.game-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(90, 48, 32, 0.5);
  font-size: 12px;
  color: #706050;
  text-align: center;
}

.game-footer .hire-link {
  display: inline-block;
  margin-top: 8px;
  color: #c9a86c;
  text-decoration: none;
  letter-spacing: 1px;
  pointer-events: auto;
}

.game-footer .hire-link:hover {
  color: #ffd080;
  text-decoration: underline;
}

.subtitle {
  font-size: 14px;
  color: #807060;
  margin-bottom: 32px;
  font-style: italic;
  letter-spacing: 1px;
}

.controls-box {
  background: linear-gradient(180deg, rgba(25, 12, 10, 0.9), rgba(15, 8, 6, 0.85));
  border: 1px solid #5a3020;
  border-left: 3px solid #8a4030;
  padding: 22px 30px;
  margin-bottom: 28px;
  max-width: 440px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.controls-box h3 {
  font-size: 11px;
  letter-spacing: 5px;
  color: #a08060;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.control-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 13px;
  color: #c0b0a0;
  text-align: left;
}

.counter-hint {
  color: #ffe060;
  font-weight: bold;
  letter-spacing: 1px;
}

.parry-hint {
  color: #ffd080;
  font-weight: bold;
  letter-spacing: 1px;
}

kbd {
  display: inline-block;
  background: linear-gradient(180deg, #3a2018, #2a1810);
  border: 1px solid #6a4830;
  border-bottom-color: #4a3020;
  border-radius: 3px;
  padding: 2px 8px;
  font-family: monospace;
  font-size: 11px;
  color: #e8c8a0;
  margin: 0 2px;
  box-shadow: 0 2px 0 #1a1008;
}

.game-btn {
  background: linear-gradient(180deg, #9a3525, #501010);
  color: #f0e0c0;
  border: 2px solid #c06040;
  padding: 14px 44px;
  font-size: 15px;
  letter-spacing: 5px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  transition: all 0.25s;
  box-shadow: 0 4px 24px rgba(180, 40, 20, 0.45);
  position: relative;
}

.game-btn:hover {
  background: linear-gradient(180deg, #b04535, #601818);
  box-shadow: 0 4px 36px rgba(220, 60, 30, 0.65);
  transform: translateY(-2px);
}

.game-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px rgba(180, 40, 20, 0.4);
}

#screen-victory h1 {
  color: #d4a830;
  text-shadow:
    0 0 40px rgba(220, 180, 40, 0.8),
    0 0 80px rgba(180, 140, 20, 0.4);
}

#screen-victory h1::after {
  content: '勝';
  display: block;
  font-size: 28px;
  letter-spacing: 20px;
  color: #a08040;
  margin-top: 8px;
  text-shadow: 0 0 20px rgba(200, 160, 40, 0.5);
}

#screen-defeat h1::after {
  content: '敗';
  display: block;
  font-size: 28px;
  letter-spacing: 20px;
  color: #604040;
  margin-top: 8px;
}

#screen-victory p,
#screen-defeat p {
  font-size: 15px;
  color: #908070;
  margin-bottom: 28px;
  max-width: 400px;
  line-height: 1.7;
}

#screen-defeat h1 {
  color: #604040;
  text-shadow: 0 0 30px rgba(80, 30, 30, 0.6);
}

.stage-select-label {
  font-size: 11px;
  letter-spacing: 4px;
  color: #807060;
  text-transform: uppercase;
  margin: 20px 0 10px;
}

#stage-select-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  max-width: 420px;
  margin-top: 4px;
}

.stage-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  color: #e8c8a0;
  background: linear-gradient(180deg, #3a2018, #2a1810);
  border: 1px solid #6a4830;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
}

.stage-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #5a3020, #401818);
  border-color: #a06040;
  transform: translateY(-1px);
}

.stage-btn.boss {
  border-color: #c09040;
  color: #ffd060;
}

.stage-btn.current {
  box-shadow: 0 0 10px rgba(255, 180, 60, 0.5);
  border-color: #ffd060;
}

.stage-btn.locked {
  opacity: 0.35;
  cursor: not-allowed;
  color: #605040;
}

#stage-transition {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(4, 2, 6, 0.94);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
}

#stage-transition::before,
#stage-transition::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 36px;
  background: linear-gradient(180deg, rgba(0,0,0,0.85), transparent);
  pointer-events: none;
}

#stage-transition::before { top: 0; }
#stage-transition::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.85), transparent);
}

#stage-transition.fade-in {
  opacity: 1;
}

#stage-transition.fade-out {
  opacity: 0;
}

.transition-inner {
  text-align: center;
}

.transition-label {
  display: block;
  font-size: 14px;
  letter-spacing: 12px;
  color: #807060;
  margin-bottom: 8px;
}

.transition-num {
  display: block;
  font-size: 72px;
  font-weight: 900;
  color: #d04030;
  text-shadow: 0 0 40px rgba(200, 40, 20, 0.7);
  line-height: 1;
}

.transition-name {
  display: block;
  font-size: 16px;
  letter-spacing: 6px;
  color: #c9a86c;
  margin-top: 12px;
}

.screen-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.game-btn-secondary {
  background: linear-gradient(180deg, #3a2830, #201018);
  border-color: #6a5040;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.game-btn-secondary:hover {
  background: linear-gradient(180deg, #4a3840, #302028);
  box-shadow: 0 4px 20px rgba(80, 60, 40, 0.4);
}

#screen-complete h1 {
  color: #d4a830;
  text-shadow:
    0 0 40px rgba(220, 180, 40, 0.8),
    0 0 80px rgba(180, 140, 20, 0.4);
}

#screen-complete h1::after {
  content: '全';
  display: block;
  font-size: 28px;
  letter-spacing: 20px;
  color: #a08040;
  margin-top: 8px;
}

#screen-complete p {
  font-size: 15px;
  color: #908070;
  margin-bottom: 28px;
  max-width: 420px;
  line-height: 1.7;
}
