:root {
  color-scheme: dark;
  --ink: #f7f1e8;
  --muted: #c6b9aa;
  --panel: rgba(20, 18, 18, 0.78);
  --panel-solid: #171414;
  --line: rgba(255, 241, 220, 0.16);
  --red: #e14242;
  --red-dark: #8e1f2c;
  --amber: #f5b84a;
  --teal: #25b7a1;
  --violet: #bb66e6;
  --green: #7fd76e;
  --shadow: rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #100f0f;
  color: var(--ink);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 320px;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 18%, rgba(225, 66, 66, 0.2), transparent 28%),
    linear-gradient(135deg, #1c1714 0%, #111010 46%, #191315 100%);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 40px);
  background:
    linear-gradient(90deg, rgba(11, 10, 10, 0.88), rgba(11, 10, 10, 0.48)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 90px);
  backdrop-filter: blur(3px);
}

.select-panel {
  width: min(1120px, 100%);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--red), var(--amber) 48%, var(--teal));
  box-shadow: 0 18px 44px rgba(225, 66, 66, 0.24);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 8px;
  width: 12px;
  height: 32px;
  border-radius: 99px;
  background: rgba(17, 15, 15, 0.72);
  transform: rotate(28deg);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 5.1rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.brand-row p {
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.8vw, 1.2rem);
}

.killer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.round-options {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
}

.bot-count-option {
  min-width: 86px;
  min-height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.bot-count-option.active {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(225,66,66,0.16);
}

.killer-card {
  min-height: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
    var(--panel);
  box-shadow: 0 18px 44px var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.killer-portrait {
  height: 122px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(225,66,66,0.32), rgba(37,183,161,0.12)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0 8px, transparent 8px 18px);
}

.killer-portrait::before,
.killer-portrait::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.killer-portrait::before {
  width: 70px;
  height: 70px;
  left: 28px;
  top: 22px;
  background: currentColor;
  box-shadow: 0 0 34px currentColor;
}

.killer-portrait::after {
  width: 220px;
  height: 18px;
  right: -28px;
  top: 54px;
  background: rgba(255,255,255,0.28);
  transform: rotate(-12deg);
}

.killer-card h2 {
  font-size: 1.32rem;
}

.killer-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.killer-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(0, 0, 0, 0.17);
}

.killer-abilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 68px;
}

.ability-chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 6px 9px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  font-size: 0.78rem;
  white-space: nowrap;
}

.select-killer {
  width: 100%;
  min-height: 44px;
  margin-top: auto;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  box-shadow: 0 14px 26px rgba(225,66,66,0.2);
  cursor: pointer;
  font-weight: 800;
}

.select-killer:hover {
  filter: brightness(1.08);
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-top {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: calc(100vw - 24px);
}

.pill,
.stat-block,
.survivor-card,
.ability-slot,
.feed-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px var(--shadow);
  backdrop-filter: blur(8px);
}

.pill {
  min-width: 110px;
  padding: 8px 12px;
}

.pill-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pill strong {
  font-size: 1.02rem;
}

.pill--killer {
  min-width: 150px;
}

.hud-left {
  position: absolute;
  left: 14px;
  bottom: 112px;
  width: min(340px, calc(100vw - 28px));
}

.stat-block {
  padding: 12px;
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.stat-head strong {
  color: var(--amber);
}

.meter {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.meter span,
.meter i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
}

.meter span {
  background: linear-gradient(90deg, var(--amber), var(--green));
}

.meter i {
  background: linear-gradient(90deg, rgba(187,102,230,0.74), rgba(245,184,74,0.9));
  opacity: 0.82;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.status-chip {
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  color: var(--muted);
  font-size: 0.78rem;
}

.survivor-panel {
  position: absolute;
  right: 14px;
  top: 74px;
  display: grid;
  gap: 8px;
  width: min(292px, calc(100vw - 28px));
}

.survivor-card {
  padding: 10px;
}

.survivor-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.survivor-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 18px currentColor;
  flex: 0 0 auto;
}

.survivor-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.survivor-state {
  color: var(--muted);
  font-size: 0.78rem;
}

.mini-meters {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.mini-meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.mini-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
}

.mini-meter--hp span {
  background: linear-gradient(90deg, var(--red), var(--amber));
}

.mini-meter--stamina span {
  background: linear-gradient(90deg, var(--teal), var(--green));
}

.ability-bar {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(118px, 152px);
  gap: 8px;
  max-width: calc(100vw - 28px);
  overflow: visible;
}

.ability-slot {
  height: 82px;
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.ability-slot.ready {
  border-color: rgba(245, 184, 74, 0.48);
}

.ability-slot.disabled {
  opacity: 0.48;
}

.ability-key {
  color: var(--amber);
  font-weight: 900;
  font-size: 0.72rem;
}

.ability-name {
  display: block;
  margin-top: 3px;
  font-weight: 800;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ability-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cooldown-fill {
  position: absolute;
  inset: auto 0 0 0;
  height: 0%;
  background: rgba(0, 0, 0, 0.52);
}

.feed {
  position: absolute;
  left: 14px;
  top: 74px;
  width: min(330px, calc(100vw - 28px));
  display: grid;
  gap: 7px;
}

.feed-line {
  padding: 9px 11px;
  color: var(--ink);
  font-size: 0.84rem;
  animation: feedIn 170ms ease-out;
}

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

.screen--end {
  background: rgba(10, 9, 9, 0.74);
}

.end-panel {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--panel-solid);
  box-shadow: 0 24px 70px rgba(0,0,0,0.48);
}

.end-panel h2 {
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: 0.9;
}

.end-panel p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.end-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.end-actions button {
  min-height: 44px;
  flex: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  cursor: pointer;
  font-weight: 900;
}

.end-actions .button-secondary {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
}

@media (max-width: 880px) {
  .killer-grid {
    grid-template-columns: 1fr;
    max-height: 72vh;
    overflow: auto;
    padding-right: 4px;
  }

  .killer-card {
    min-height: 0;
  }

  .killer-portrait {
    height: 88px;
  }

  .hud-top {
    left: 14px;
    right: 14px;
    transform: none;
    overflow-x: auto;
  }

  .pill {
    min-width: 98px;
  }

  .survivor-panel {
    top: 66px;
    width: 210px;
  }

  .survivor-card {
    padding: 8px;
  }

  .ability-bar {
    grid-auto-columns: minmax(88px, 1fr);
    width: calc(100vw - 20px);
    gap: 6px;
  }

  .ability-slot {
    height: 74px;
    padding: 8px;
  }

  .ability-name {
    font-size: 0.78rem;
  }

  .ability-meta {
    font-size: 0.68rem;
  }

  .hud-left {
    bottom: 94px;
  }

  .feed {
    display: none;
  }
}

@media (min-width: 881px) and (max-width: 1180px) {
  .killer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .brand-row {
    align-items: flex-start;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .survivor-panel {
    display: none;
  }

  .hud-left {
    width: calc(100vw - 28px);
  }
}
