/* Bagua Break: 破阵八卦 Stylesheet */
:root {
  --bg-dark: #0a0c10;
  --ink-black: #12151c;
  --xuan-paper: #f5ede0;
  --gold-accent: #e5b85c;
  --gold-glow: rgba(229, 184, 92, 0.35);
  --cinnabar-red: #d9383a;
  --jade-green: #2ecc71;
  --water-cyan: #3498db;
  --glass-bg: rgba(18, 22, 32, 0.85);
  --glass-border: rgba(229, 184, 92, 0.28);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Serif SC", serif;
  color: var(--xuan-paper);
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at center, #181d29 0%, #080a0e 100%);
}

#game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

/* --- HUD Overlay --- */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 14px) 16px env(safe-area-inset-bottom, 14px) 16px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.sector-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.sector-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-accent);
  letter-spacing: 1px;
}

.sector-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.merit-card {
  text-align: right;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 8px 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.merit-num {
  font-size: 18px;
  font-weight: 900;
  color: var(--xuan-paper);
}

.combo-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--cinnabar-red);
  margin-top: 2px;
}

/* Tai Chi Energy Gauge & Formation Shield */
.center-meters {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 90vw);
}

.meter-title {
  font-size: 11px;
  font-weight: 800;
  width: 58px;
  text-align: right;
  letter-spacing: 0.5px;
}

.meter-track {
  flex: 1;
  height: 7px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.15s ease-out;
}

.meter-fill.taichi {
  background: linear-gradient(90deg, #d4af37, #ffffff);
  box-shadow: 0 0 10px #d4af37;
}

.meter-fill.shield {
  background: linear-gradient(90deg, #d9383a, #2ecc71);
  box-shadow: 0 0 10px #2ecc71;
}

/* Touch Control Guide Hint */
.touch-guidance {
  text-align: center;
  font-size: 12px;
  color: rgba(245, 237, 224, 0.5);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

/* Mobile Screen Rotation & Action Zone */
.touch-action-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: auto;
  width: 100%;
  margin-bottom: 6px;
}

.btn-rotate {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  color: var(--gold-accent);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.15s ease;
}

.btn-rotate:active {
  transform: scale(0.9);
  background: rgba(229, 184, 92, 0.2);
}

.btn-taichi-burst {
  padding: 10px 22px;
  border-radius: 999px;
  background: radial-gradient(circle at center, #2a241e, #12100d);
  border: 2px solid var(--gold-accent);
  color: var(--gold-accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 1.5px;
  box-shadow: 0 0 15px var(--gold-glow);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-taichi-burst.ready {
  animation: pulse-gold 1s infinite alternate;
  background: radial-gradient(circle at center, #e5b85c, #a87922);
  color: #0d0f12;
}

@keyframes pulse-gold {
  from { box-shadow: 0 0 15px #e5b85c; transform: scale(1); }
  to { box-shadow: 0 0 30px #ffffff; transform: scale(1.06); }
}

/* Quick Corner Utility Buttons */
.utility-btns {
  position: absolute;
  top: 96px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  z-index: 15;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--xuan-paper);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-icon:active {
  transform: scale(0.92);
}

/* --- Modals --- */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 10, 14, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  width: min(440px, 92vw);
  background: linear-gradient(135deg, rgba(24, 28, 40, 0.96), rgba(12, 14, 20, 0.98));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px var(--gold-glow);
  animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes pop-in {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-accent);
  margin-bottom: 8px;
}

.modal-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff, var(--gold-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  line-height: 1.6;
  color: #94a3b8;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
}

.stat-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
}

.stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-accent);
  margin-top: 2px;
}

.btn-primary {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, var(--gold-accent), #a87922);
  border: none;
  border-radius: 14px;
  color: #0e1014;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--gold-glow);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(1.15);
}

.btn-secondary {
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: var(--xuan-paper);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
}

.controls-hint {
  font-size: 11px;
  color: rgba(245, 237, 224, 0.45);
  margin-top: 14px;
}
