.game {
  position: relative;
  z-index: 1;
  height: 100vh;
  min-height: 0;
  padding: 14px 16px 16px;
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(620px, 1fr) minmax(260px, 340px);
  grid-template-rows: minmax(0, 1fr) clamp(168px, 23vh, 204px);
  gap: 14px 18px;
  overflow: hidden;
}

.hud-panel,
.log-panel,
.hint-panel,
.hand-dock,
.builder-card,
.modal-sheet {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(7, 20, 34, 0.92), rgba(4, 9, 16, 0.84));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 0 28px rgba(0, 0, 0, 0.44);
  clip-path: polygon(0 12px, 12px 0, calc(100% - 30px) 0, 100% 28px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 24px 100%, 0 calc(100% - 24px));
}

.hud-panel {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 12px 14px 11px;
  display: grid;
  grid-template-rows: auto auto minmax(22px, auto);
  align-content: start;
  isolation: isolate;
}

.hud-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.08), transparent 28% 72%, rgba(255, 255, 255, 0.05)),
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.14), transparent 30%),
    linear-gradient(135deg, rgba(4, 12, 23, 0.98), rgba(3, 8, 15, 0.9));
}

.hud-panel::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: inherit;
}

.hud-panel.enemy {
  border-color: rgba(255, 75, 67, 0.7);
  background:
    linear-gradient(135deg, rgba(34, 8, 12, 0.94), rgba(3, 8, 15, 0.88) 56%, rgba(8, 16, 27, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(255, 95, 90, 0.12),
    inset 0 0 32px rgba(255, 55, 48, 0.08),
    var(--shadow-red);
}

.hud-panel.player {
  border-color: rgba(80, 200, 255, 0.72);
  background:
    linear-gradient(135deg, rgba(4, 23, 38, 0.94), rgba(3, 8, 15, 0.88) 56%, rgba(7, 20, 34, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(117, 221, 255, 0.12),
    inset 0 0 32px rgba(60, 178, 255, 0.08),
    var(--shadow-blue);
}

.left-rail {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  display: grid;
  align-content: space-between;
  gap: 16px;
}

.hud-title {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.hud-avatar {
  position: relative;
  width: 68px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  color: var(--blue-soft);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.18), transparent 20%),
    linear-gradient(180deg, rgba(12, 30, 45, 0.96), rgba(1, 5, 10, 0.98));
  box-shadow:
    inset 0 0 20px rgba(255, 255, 255, 0.08),
    0 0 20px rgba(80, 200, 255, 0.22);
  clip-path: polygon(0 12px, 12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px));
  flex: 0 0 auto;
}

.enemy .hud-avatar {
  color: var(--red-soft);
  box-shadow:
    inset 0 0 20px rgba(255, 255, 255, 0.08),
    0 0 20px rgba(255, 75, 67, 0.24);
}

.hud-avatar::before {
  content: "";
  position: absolute;
  inset: 9px 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-color: rgba(255, 255, 255, 0.08);
  border-radius: 48% 48% 42% 42%;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.16), transparent 18%),
    linear-gradient(180deg, rgba(20, 28, 36, 0.92), rgba(2, 6, 12, 0.96));
  box-shadow:
    inset 0 -10px 16px rgba(0, 0, 0, 0.72),
    inset 0 0 14px rgba(255, 255, 255, 0.08);
}

.hud-avatar-profile {
  position: absolute;
  inset: 9px 13px 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50% 50% 44% 44%;
  color: #bdefff;
  background: #071522;
  font-size: 24px;
  font-weight: 900;
}

.hud-avatar-profile img[data-player-avatar-image] {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hud-avatar.has-profile-avatar::before {
  opacity: 0;
}

.hud-avatar.has-profile-avatar::after {
  z-index: 2;
}

.hud-avatar-core {
  position: absolute;
  inset: 0;
}

.hud-avatar-core::before,
.hud-avatar-core::after {
  content: "";
  position: absolute;
  top: 31px;
  width: 12px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.hud-avatar-core::before {
  left: 22px;
  transform: skewX(18deg);
}

.hud-avatar-core::after {
  right: 22px;
  transform: skewX(-18deg);
}

.faction-mark {
  position: absolute;
  right: -5px;
  bottom: -5px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  background: rgba(2, 7, 13, 0.94);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  font-size: 0.78rem;
  font-weight: 900;
  text-shadow: 0 0 12px currentColor;
}

.enemy .faction-mark {
  color: var(--red-soft);
}

.player .faction-mark {
  color: var(--blue-soft);
}

.hud-identity {
  min-width: 0;
  align-self: center;
}

.hud-name {
  font-size: clamp(1.42rem, 1.5vw, 2rem);
  line-height: 0.98;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--blue-soft);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 0 16px rgba(80, 200, 255, 0.35);
}

.enemy .hud-name {
  color: var(--red-soft);
  text-shadow: 0 0 16px rgba(255, 75, 67, 0.35);
}

.hud-reactor {
  flex: 0 0 auto;
  justify-self: end;
  min-width: 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 2px;
  border: 1px solid rgba(239, 184, 77, 0.5);
  background: linear-gradient(180deg, rgba(58, 42, 12, 0.78), rgba(7, 14, 20, 0.88));
  color: #fff4c9;
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(239, 184, 77, 0.14);
}

.hud-reactor.is-off {
  border-color: rgba(120, 150, 170, 0.34);
  background: rgba(8, 18, 28, 0.64);
  color: rgba(216, 238, 248, 0.58);
  box-shadow: none;
}

.hud-reactor-label {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: minmax(58px, 0.9fr) minmax(92px, 1.25fr);
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.stat {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 48%),
    rgba(2, 8, 15, 0.58);
  box-shadow:
    inset 0 0 14px rgba(255, 255, 255, 0.04),
    0 0 14px rgba(0, 0, 0, 0.24);
  clip-path: polygon(0 8px, 8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px));
}

.stat-label {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-icon {
  display: inline;
  line-height: 1;
  filter: drop-shadow(0 0 7px currentColor);
}

.stat-word {
  display: none;
}

.stat-value {
  margin-top: 0;
  display: flex;
  align-items: baseline;
  min-width: 0;
  color: var(--text);
  font-size: 1.22rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.hand-stat {
  border-color: rgba(255, 203, 99, 0.28);
}

.hand-stat .stat-label {
  color: #ffd47d;
}

.hull-stat {
  border-color: rgba(255, 85, 85, 0.32);
}

.hull-stat .stat-label {
  color: #ff5f5f;
}

.hull-stat {
  justify-content: center;
}

.hull-stat .stat-value {
  min-width: 0;
}

.hud-reactor-bar {
  position: relative;
  min-width: 0;
  min-height: 12px;
  margin-top: 9px;
  display: grid;
  grid-template-columns: repeat(var(--reactor-cells, 8), minmax(10px, 1fr));
  gap: 3px;
  padding: 2px;
  border: 1px solid rgba(80, 200, 255, 0.32);
  background: linear-gradient(90deg, rgba(3, 14, 24, 0.88), rgba(8, 34, 52, 0.58), rgba(3, 14, 24, 0.88));
  box-shadow: inset 0 0 12px rgba(80, 200, 255, 0.08), 0 0 12px rgba(80, 200, 255, 0.08);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 50%, calc(100% - 7px) 100%, 0 100%, 5px 50%);
}

.hud-reactor-bar.is-off {
  opacity: 0.42;
  filter: grayscale(0.8);
}

.reactor-charge-cell {
  min-width: 10px;
  height: 10px;
  background: linear-gradient(180deg, rgba(43, 89, 112, 0.3), rgba(10, 26, 38, 0.72));
  border: 1px solid rgba(117, 221, 255, 0.18);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.48);
}

.reactor-charge-cell.is-filled {
  background: linear-gradient(180deg, #baf6ff 0%, #62ddff 34%, #168bd1 100%);
  border-color: rgba(186, 246, 255, 0.82);
  box-shadow: 0 0 8px rgba(98, 221, 255, 0.5), inset 0 0 8px rgba(255, 255, 255, 0.2);
}

.reactor-charge-cell.is-current {
  filter: brightness(1.08);
  box-shadow: 0 0 10px rgba(98, 221, 255, 0.58), inset 0 0 8px rgba(255, 255, 255, 0.24);
}

.reactor-indicator,
.reactor-orb {
  --reactor-inactive: rgba(75, 88, 100, 0.58);
  --reactor-s1: var(--reactor-inactive);
  --reactor-s2: var(--reactor-inactive);
  --reactor-s3: var(--reactor-inactive);
  --reactor-core: rgba(120, 150, 170, 0.58);
  position: relative;
  width: 24px;
  aspect-ratio: 1;
  display: block;
  border-radius: 50%;
  filter: drop-shadow(0 0 8px rgba(255, 226, 138, 0.16));
}

.reactor-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(from -90deg,
      var(--reactor-s1) 0 108deg,
      transparent 108deg 120deg,
      var(--reactor-s2) 120deg 228deg,
      transparent 228deg 240deg,
      var(--reactor-s3) 240deg 348deg,
      transparent 348deg 360deg);
}

.reactor-indicator::before,
.reactor-orb::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(4, 10, 18, 0.94);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.reactor-indicator .reactor-core,
.reactor-orb .reactor-core {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--reactor-core);
  box-shadow: 0 0 8px var(--reactor-core);
}

.reactor-indicator.level-1,
.reactor-orb.level-1 {
  --reactor-s1: #69dcff;
  --reactor-core: #69dcff;
}

.reactor-indicator.level-2,
.reactor-orb.level-2 {
  --reactor-s1: #69dcff;
  --reactor-s2: #75ed95;
  --reactor-core: #75ed95;
}

.reactor-indicator.level-3,
.reactor-orb.level-3 {
  --reactor-s1: #69dcff;
  --reactor-s2: #75ed95;
  --reactor-s3: #ffe28a;
  --reactor-core: #ffe28a;
  filter: drop-shadow(0 0 10px rgba(255, 226, 138, 0.35));
}

.reactor-indicator.level-2 .reactor-core,
.reactor-indicator.level-3 .reactor-core,
.reactor-orb.level-2 .reactor-core,
.reactor-orb.level-3 .reactor-core {
  animation: reactorCorePulse 1.8s ease-in-out infinite;
}

.reactor-indicator.is-locked {
  --reactor-core: rgba(255, 116, 103, 0.78);
  filter: drop-shadow(0 0 8px rgba(255, 75, 67, 0.28));
}

.reactor-indicator.is-locked.level-1 {
  --reactor-s1: rgba(255, 116, 103, 0.88);
}

.reactor-indicator.is-locked.level-2 {
  --reactor-s1: rgba(255, 116, 103, 0.88);
  --reactor-s2: rgba(255, 116, 103, 0.72);
}

.reactor-indicator.is-locked.level-3 {
  --reactor-s1: rgba(255, 116, 103, 0.88);
  --reactor-s2: rgba(255, 116, 103, 0.72);
  --reactor-s3: rgba(255, 116, 103, 0.58);
}

.reactor-compact {
  width: 24px;
}

.reactor-tiny {
  width: 18px;
}

.reactor-tiny::before {
  inset: 3px;
}

.reactor-tiny .reactor-core {
  inset: 7px;
}

.effects {
  min-height: 24px;
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.effect-pill,
.mini-pill {
  border: 1px solid rgba(196, 92, 255, 0.64);
  background: rgba(68, 19, 94, 0.72);
  color: #f2c7ff;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mini-pill {
  border-color: rgba(80, 200, 255, 0.55);
  background: rgba(24, 74, 104, 0.58);
  color: var(--blue-soft);
  text-transform: none;
}

.trap-pill {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 25px;
  border: 1px solid rgba(255, 214, 94, 0.86);
  border-radius: 4px;
  background: rgba(83, 49, 8, 0.82);
  color: #ffe38b;
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 0 14px rgba(255, 186, 75, 0.34), inset 0 0 12px rgba(255, 214, 94, 0.14);
}

.trap-pill.is-hidden {
  border-color: rgba(255, 214, 94, 0.62);
  background: rgba(40, 31, 16, 0.78);
  color: #ffd66d;
}

.hint-panel {
  position: relative;
  overflow: hidden;
  min-height: 96px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-color: rgba(80, 200, 255, 0.5);
}

.hint-panel.is-attention {
  border-color: rgba(239, 184, 77, 0.66);
  box-shadow:
    inset 0 0 0 1px rgba(239, 184, 77, 0.08),
    0 0 26px rgba(239, 184, 77, 0.16),
    0 0 34px rgba(0, 0, 0, 0.42);
  animation: hintBreathe 2.8s ease-in-out infinite;
}

.hint-panel.is-targeting,
.hint-panel.is-decision {
  animation-duration: 1.7s;
}

.hint-panel.is-threat {
  border-color: rgba(255, 92, 92, 0.74);
  box-shadow:
    inset 0 0 0 1px rgba(255, 92, 92, 0.11),
    0 0 28px rgba(255, 72, 72, 0.18),
    0 0 34px rgba(0, 0, 0, 0.42);
}

.hint-panel.is-attention::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 0 35%, rgba(239, 184, 77, 0.16) 48%, transparent 62% 100%);
  transform: translateX(-115%);
  animation: hintSweep 2.8s ease-in-out infinite;
}

.hint-panel.is-targeting::after,
.hint-panel.is-decision::after {
  animation-duration: 1.7s;
}

.hint-panel.is-threat::after {
  background: linear-gradient(105deg, transparent 0 35%, rgba(255, 92, 92, 0.18) 48%, transparent 62% 100%);
}

.hint-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--blue-soft);
  border: 1px solid rgba(80, 200, 255, 0.7);
  background: rgba(32, 114, 170, 0.18);
  clip-path: polygon(50% 0, 100% 27%, 100% 73%, 50% 100%, 0 73%, 0 27%);
  text-shadow: var(--shadow-blue);
}

.hint-panel.is-attention .hint-icon {
  color: #ffe28a;
  border-color: rgba(239, 184, 77, 0.9);
  background: rgba(132, 90, 18, 0.34);
  text-shadow: 0 0 16px rgba(255, 226, 138, 0.86);
  animation: hintIconPulse 1.4s ease-in-out infinite;
}

.hint-panel.is-threat .hint-icon {
  color: #ffd0d0;
  border-color: rgba(255, 92, 92, 0.95);
  background: rgba(128, 28, 28, 0.38);
  text-shadow: 0 0 16px rgba(255, 92, 92, 0.86);
}

.hint-text {
  position: relative;
  z-index: 1;
  color: #d8f4ff;
  line-height: 1.35;
  font-size: 1rem;
}

.hint-panel.is-attention .hint-text {
  color: #fff4c9;
}

.hint-panel.is-threat .hint-text {
  color: #ffe1d6;
}

