/* Shadow Blade: 水墨居合 - Eastern Cyber Sumi-e UI */
:root {
  --ink-black: #08090f;
  --paper-bg: #10121c;
  --blade-frost: #ffffff;
  --blade-blue: #38bdf8;
  --crimson-red: #ef4444;
  --imperial-gold: #fbbf24;
  --jade-green: #10b981;
  --ink-dim: #64748b;
  --hud-bg: rgba(16, 18, 28, 0.78);
  --hud-border: rgba(251, 191, 36, 0.25);
  --text-main: #f8fafc;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--ink-black);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  overscroll-behavior: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* Screen Flash Overlay for 一闪 (Issho) and Damage */
#screen-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  z-index: 15;
  transition: opacity 0.08s ease;
}

#screen-flash.flash-issho {
  background-color: #ffffff;
  opacity: 0.85;
}

#screen-flash.flash-hurt {
  background-color: var(--crimson-red);
  opacity: 0.45;
}

/* Top HUD */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qi-container {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}

.qi-orb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--crimson-red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  border: 1.5px solid #ffffff;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.qi-orb.broken {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  transform: scale(0.8);
}

.score-display {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
  font-family: -apple-system, sans-serif;
}

.score-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--imperial-gold);
}

.stats-row {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-dim);
  font-weight: 600;
}

.stats-row span {
  color: var(--text-main);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

/* Omni-Slash Special Gauge */
.omni-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  margin-right: 6px;
}

.omni-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--blade-blue);
  text-transform: uppercase;
}

.omni-bar-bg {
  width: 80px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  overflow: hidden;
}

.omni-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  box-shadow: 0 0 8px #38bdf8;
  transition: width 0.2s ease;
}

.omni-bar-fill.ready {
  background: linear-gradient(90deg, #fbbf24, #ef4444);
  box-shadow: 0 0 12px #fbbf24;
  animation: pulseReady 1s infinite alternate;
}

@keyframes pulseReady {
  from { filter: brightness(1); }
  to { filter: brightness(1.5); }
}

.hud-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--imperial-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.hud-btn:active {
  transform: scale(0.92);
  background: rgba(251, 191, 36, 0.2);
}

.hud-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Combo Banner */
#combo-container {
  position: absolute;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
}

#combo-container.active {
  opacity: 1;
  transform: translateX(-50%) scale(1.12);
}

.combo-text {
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #fbbf24, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.7));
}

.combo-sub {
  font-size: 11px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.8);
}

/* Modals & Screens */
.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 9, 15, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.screen-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.card-modal {
  width: 90%;
  max-width: 440px;
  background: linear-gradient(135deg, rgba(24, 27, 42, 0.9) 0%, rgba(12, 14, 24, 0.98) 100%);
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: 0 0 35px rgba(251, 191, 36, 0.15), 0 25px 50px rgba(0, 0, 0, 0.7);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: floatUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes floatUp {
  from {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.game-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #ffffff 0%, #fbbf24 50%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.5));
}

.game-tagline {
  font-size: 13px;
  color: var(--imperial-gold);
  letter-spacing: 4px;
  text-transform: uppercase;
  font-weight: 700;
}

.instructions-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  width: 100%;
  font-size: 13px;
  line-height: 1.6;
  color: #cbd5e1;
  text-align: left;
}

.instructions-box p {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions-box p:last-child {
  margin-bottom: 0;
}

.key-badge {
  display: inline-block;
  padding: 2px 7px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid var(--imperial-gold);
  border-radius: 6px;
  color: var(--imperial-gold);
  font-weight: 700;
  font-size: 11px;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #fbbf24 0%, #ef4444 100%);
  border: none;
  border-radius: 12px;
  color: #08090f;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.6);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.result-item {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.result-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--imperial-gold);
}

.result-val.highlight {
  color: var(--crimson-red);
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.result-lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-top: 2px;
}

/* Touch Control Indicator */
#touch-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--imperial-gold);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 600;
  pointer-events: none;
  opacity: 0.75;
  transition: opacity 0.3s ease;
  z-index: 10;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}
