:root {
  color-scheme: dark;
  --bg: #050607;
  --surface: rgba(9, 11, 13, 0.88);
  --surface-strong: rgba(12, 14, 17, 0.96);
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: #f1f0ed;
  --muted: #aaa7a0;
  --red: #d80d13;
  --red-dark: #7f0a0f;
  --gold: #d3a423;
  --gold-dark: #795b10;
  --green: #1e7f3b;
  --purple: #8e45d8;
  --purple-dark: #2a0d3d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.56);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family:
    Impact, Haettenschweiler, "Arial Narrow Bold", "Segoe UI Condensed",
    "Roboto Condensed", Arial, sans-serif;
  background:
    radial-gradient(circle at 72% 34%, rgba(76, 130, 158, 0.14), transparent 23rem),
    linear-gradient(rgba(0, 0, 0, 0.9), rgba(5, 6, 7, 0.98)),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: var(--text);
  cursor: pointer;
}

button,
.perk-slot,
.counter-panel,
.roulette-board,
.stats-card,
.challenge-board,
.editor-board {
  border-radius: 8px;
}

button {
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 58px;
  padding: 0 54px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  letter-spacing: 0;
  text-align: left;
}

.tally-mini {
  position: relative;
  width: 38px;
  height: 30px;
  margin-right: 8px;
}

.tally-mini::before {
  position: absolute;
  inset: 5px 2px;
  content: "";
  background:
    linear-gradient(75deg, transparent 0 44%, #fff 44% 54%, transparent 54%),
    repeating-linear-gradient(90deg, transparent 0 6px, #fff 6px 9px, transparent 9px 12px);
  opacity: 0.94;
}

.brand-r,
.brand-2,
.brand-p {
  font-size: 2rem;
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
}

.brand-r,
.brand-p {
  color: var(--red);
}

.brand-2 {
  color: #fff;
}

.main-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 44px;
  margin-left: 22px;
}

.nav-link {
  position: relative;
  min-width: 150px;
  padding: 0 22px;
  border: 1px solid #fff;
  border-left: 0;
  background: #fff;
  color: #000;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.88rem;
  text-transform: none;
}

.nav-link::after {
  display: none;
}

.nav-link.active {
  background: #080808;
  color: #fff;
}

.nav-link.active::after {
  background: currentColor;
  box-shadow: 0 0 18px currentColor;
}

.app-shell {
  width: min(1240px, calc(100% - 48px));
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  padding: 34px 0 28px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.home-view {
  position: relative;
  min-height: calc(100vh - 128px);
  overflow: hidden;
}

.home-view.active {
  display: grid;
  grid-template-columns: minmax(320px, 0.86fr) minmax(360px, 1.14fr);
  align-items: center;
  gap: 34px;
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding-left: 0;
}

.ready-logo {
  display: grid;
  margin-top: 8px;
  color: #f4f1eb;
  font-size: clamp(4.2rem, 12vw, 8.1rem);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 0.78;
  text-transform: uppercase;
  text-shadow: 0 16px 22px rgba(0, 0, 0, 0.72);
}

.ready-logo > span {
  display: block;
}

.ready-logo span span {
  color: var(--red);
}

.ready-line {
  position: relative;
}

.ready-line::after {
  position: absolute;
  right: 19%;
  top: 12%;
  width: 18%;
  height: 36%;
  content: "";
  background: #f4f1eb;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

.play-line {
  position: relative;
}

.play-line::after {
  position: absolute;
  left: 42%;
  top: -26%;
  width: 18%;
  height: 112%;
  content: "";
  background: #050607;
  clip-path: polygon(28% 0, 78% 0, 58% 44%, 94% 44%, 28% 100%, 43% 57%, 0 57%);
  filter: drop-shadow(8px 8px 0 rgba(255, 255, 255, 0.18));
}

.kicker {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1 {
  display: grid;
  gap: 0;
  margin: 0;
  max-width: 560px;
  color: #f3f1eb;
  font-size: clamp(5rem, 13vw, 10rem);
  line-height: 0.78;
  text-transform: uppercase;
  text-shadow: 0 12px 26px rgba(0, 0, 0, 0.9);
}

.hero-copy h1 span:first-child::first-letter,
.hero-copy h1 span:last-child::first-letter {
  color: var(--red);
}

.hero-text {
  max-width: 460px;
  margin: 26px 0 0;
  color: #f1eee8;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.95rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 32px;
}

.mode-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 216px;
  min-height: 46px;
  padding: 8px 18px;
  border: 1px solid #0d7cff;
  background: #030303;
  box-shadow: none;
  font-family: Consolas, "Courier New", monospace;
  text-transform: none;
}

.mode-card strong {
  max-width: none;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.08em;
}

.killer-card {
  border-color: var(--red);
}

.survivor-card {
  border-color: #0d7cff;
}

.compact-action,
.outline-button,
.ghost-button,
.danger-button,
.save-button,
.spin-button,
.wide-reset {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}

.compact-action,
.outline-button,
.ghost-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.compact-action {
  min-width: 170px;
  margin-left: 126px;
  margin-top: 12px;
  border-color: #7aa4bd;
  background: #030303;
  font-family: Consolas, "Courier New", monospace;
}

.hero-figure {
  position: relative;
  min-height: 390px;
}

.hero-banner-image {
  position: absolute;
  inset: 8% 0 8% 0;
  z-index: 2;
  width: 100%;
  height: 84%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  object-fit: cover;
  object-position: center;
  filter:
    saturate(0.82)
    contrast(1.08)
    drop-shadow(0 24px 30px rgba(0, 0, 0, 0.72));
}

.hero-figure::after {
  position: absolute;
  inset: 8% 0 8% 0;
  z-index: 3;
  content: "";
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 40%, rgba(0, 0, 0, 0.58)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.52), transparent 35%, rgba(0, 0, 0, 0.36));
}

.spark-field {
  position: absolute;
  right: 20%;
  bottom: 22%;
  width: 260px;
  height: 280px;
  background:
    radial-gradient(circle, rgba(255, 124, 30, 0.9) 0 2px, transparent 3px) 20px 30px / 44px 50px,
    radial-gradient(circle, rgba(216, 13, 19, 0.7) 0 1px, transparent 3px) 4px 6px / 36px 42px;
  opacity: 0.32;
}

.tally-mark,
.circle-mark {
  position: relative;
  flex: 0 0 58px;
  height: 48px;
}

.tally-mark::before {
  position: absolute;
  inset: 6px 6px;
  content: "";
  background:
    linear-gradient(78deg, transparent 0 42%, #eee 42% 53%, transparent 53%),
    repeating-linear-gradient(90deg, transparent 0 9px, #eee 9px 13px, transparent 13px 18px);
  opacity: 0.9;
}

.circle-mark {
  border: 3px solid #ddd;
  border-radius: 50%;
}

.circle-mark::before,
.circle-mark::after {
  position: absolute;
  top: 9px;
  width: 14px;
  height: 28px;
  content: "";
  background: #ddd;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.circle-mark::before {
  left: 12px;
}

.circle-mark::after {
  right: 12px;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 38px;
}

.page-title h2 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.page-title p:not(.kicker) {
  max-width: 820px;
  margin: 8px 0 0;
  color: #c4c1bb;
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.role-emblem {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid currentColor;
  color: var(--red);
  font-size: 2rem;
  transform: rotate(45deg);
  box-shadow: 0 0 22px color-mix(in srgb, currentColor 30%, transparent);
}

.role-emblem span {
  display: block;
  line-height: 1;
  transform: rotate(-45deg);
}

.role-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 34px;
  align-items: stretch;
}

.roulette-board,
.counter-panel,
.challenge-board,
.stats-card,
.editor-board {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015)),
    var(--surface);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.roulette-board {
  min-height: 440px;
  padding: 42px;
  text-align: center;
}

.killer-board,
.survivor-board {
  text-align: left;
}

.killer-stage,
.survivor-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 30px;
  align-items: stretch;
}

.perk-zone {
  min-width: 0;
  text-align: center;
}

.killer-stage .perk-diamonds,
.survivor-stage .perk-diamonds {
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  gap: 18px;
}

.killer-stage .perk-slot,
.survivor-stage .perk-slot {
  width: 92px;
}

.killer-stage .perk-slot .perk-content,
.survivor-stage .perk-slot .perk-content {
  font-size: 0.66rem;
}

.killer-portrait-card,
.survivor-portrait-card {
  position: relative;
  display: flex;
  min-height: 420px;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(216, 13, 19, 0.28);
  background:
    radial-gradient(circle at 50% 42%, rgba(216, 13, 19, 0.26), transparent 11rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.48)),
    rgba(6, 7, 8, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 20px 54px rgba(0, 0, 0, 0.42);
}

.survivor-portrait-card {
  border-color: rgba(211, 164, 35, 0.34);
  background:
    radial-gradient(circle at 50% 42%, rgba(211, 164, 35, 0.22), transparent 11rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.48)),
    rgba(6, 7, 8, 0.92);
}

.killer-portrait-card::before,
.survivor-portrait-card::before {
  position: absolute;
  inset: 12px;
  z-index: 0;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(216, 13, 19, 0.2) 46% 47%, transparent 47%),
    linear-gradient(45deg, transparent 0 52%, rgba(255, 255, 255, 0.08) 52% 53%, transparent 53%);
}

.survivor-portrait-card::before {
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(211, 164, 35, 0.18) 46% 47%, transparent 47%),
    linear-gradient(45deg, transparent 0 52%, rgba(255, 255, 255, 0.08) 52% 53%, transparent 53%);
}

.portrait-frame {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: end center;
  flex: 1;
  min-height: 300px;
  overflow: hidden;
}

.portrait-frame img {
  position: relative;
  z-index: 2;
  display: none;
  width: min(100%, 230px);
  max-height: 330px;
  object-fit: contain;
  filter:
    drop-shadow(0 18px 16px rgba(0, 0, 0, 0.78))
    drop-shadow(0 0 22px rgba(216, 13, 19, 0.18));
}

.killer-portrait-card.has-portrait .portrait-frame img,
.survivor-portrait-card.has-portrait .portrait-frame img {
  display: block;
  animation: portraitReveal 560ms cubic-bezier(0.2, 0.85, 0.18, 1) both;
}

.killer-portrait-card.is-rolling .portrait-frame img,
.survivor-portrait-card.is-rolling .portrait-frame img {
  display: block;
  animation: portraitRoll 95ms steps(2, end) infinite;
}

.portrait-placeholder {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 138px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.28);
  font-size: 5rem;
  transform: rotate(45deg);
}

.portrait-placeholder::first-letter {
  transform: rotate(-45deg);
}

.killer-portrait-card.has-portrait .portrait-placeholder,
.survivor-portrait-card.has-portrait .portrait-placeholder {
  display: none;
}

.killer-portrait-card span,
.killer-portrait-card strong,
.survivor-portrait-card span,
.survivor-portrait-card strong {
  position: relative;
  z-index: 2;
  display: block;
  text-align: center;
  text-transform: uppercase;
}

.killer-portrait-card span,
.survivor-portrait-card span {
  margin-top: 16px;
  color: var(--muted);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 900;
}

.killer-portrait-card strong,
.survivor-portrait-card strong {
  margin-top: 4px;
  color: #fff;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 0.95;
  text-shadow: 0 0 16px rgba(216, 13, 19, 0.28);
}

.survivor-portrait-card strong {
  text-shadow: 0 0 16px rgba(211, 164, 35, 0.28);
}

.killer-portrait-card.is-rolling strong,
.survivor-portrait-card.is-rolling strong {
  color: var(--red);
  animation: textFlicker 140ms linear infinite;
}

.survivor-portrait-card.is-rolling strong {
  color: var(--gold);
}

.roulette-board h3,
.counter-panel h3,
.stats-card h3,
.challenge-board h3 {
  margin: 0;
  color: #bbb7af;
  font-size: 1.6rem;
  text-transform: uppercase;
}

.perk-diamonds {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  gap: 28px;
  align-items: center;
  justify-items: center;
  min-height: 170px;
  margin: 28px auto 24px;
}

.perk-slot {
  position: relative;
  display: grid;
  place-items: center;
  width: min(112px, 100%);
  aspect-ratio: 1;
  border: 3px solid #bfbfc2;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.08), transparent 62%),
    linear-gradient(135deg, rgba(0, 0, 0, 0.92), rgba(15, 15, 17, 0.96));
  transform: rotate(45deg);
  box-shadow:
    0 0 0 8px rgba(0, 0, 0, 0.5),
    inset 0 0 24px rgba(255, 255, 255, 0.08);
}

.perk-slot.filled.killer-perk {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(135deg, #3e174a, #1a0a20 78%);
}

.perk-slot.filled.survivor-perk {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(135deg, #1f7c36, #0b2313 78%);
}

.perk-slot .perk-content {
  display: grid;
  place-items: center;
  width: 98%;
  height: 98%;
  padding: 10px;
  color: #f7f4ed;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.08;
  overflow-wrap: anywhere;
  text-align: center;
  transform: rotate(-45deg);
}

.perk-icon {
  width: 112%;
  height: 112%;
  object-fit: contain;
  filter:
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.82))
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.16));
}

.perk-diamonds.is-rolling .perk-slot {
  animation: perkSlotRoll 140ms steps(2, end) infinite;
}

.perk-diamonds.is-rolling .perk-icon {
  animation: perkIconFlicker 90ms linear infinite;
}

.perk-slot.empty {
  opacity: 0.42;
}

.chosen-character {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 68px;
  margin: 18px auto 0;
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.chosen-character span {
  color: var(--muted);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chosen-character strong {
  font-size: clamp(1.2rem, 2.6vw, 2.1rem);
  text-transform: uppercase;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
}

.action-row.centered {
  justify-content: center;
}

.spin-button,
.save-button {
  min-width: 196px;
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.killer-spin,
.killer-save {
  background: linear-gradient(180deg, #d5191f, #821015);
}

.survivor-spin,
.survivor-save {
  background: linear-gradient(180deg, #d8a92a, #8a6512);
}

.purple-spin {
  background: linear-gradient(180deg, #984ddb, #481160);
}

.outline-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.02));
  color: #d9d6cf;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.035);
  color: #aaa6a0;
}

.danger-button {
  background: rgba(216, 13, 19, 0.18);
  color: #ffb8b8;
}

.full-width {
  width: 100%;
}

.counter-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 34px 28px;
  text-align: center;
}

.counter-number {
  display: block;
  margin: 14px 0 18px;
  font-size: 4.2rem;
  line-height: 0.9;
}

.red-number,
.red-text {
  color: var(--red);
}

.gold-number,
.gold-text {
  color: var(--gold);
}

.purple-title .role-emblem,
.purple-title .kicker,
.purple-title h2 {
  color: var(--purple);
}

.killer-theme .page-title h2,
.killer-theme .role-emblem,
.killer-theme .kicker {
  color: var(--red);
}

.survivor-theme .page-title h2,
.survivor-theme .role-emblem,
.survivor-theme .kicker {
  color: var(--gold);
}

.counter-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.counter-line span,
.counter-line strong,
.survivor-breakdown span,
.survivor-breakdown strong,
.history-list small {
  font-family: "Segoe UI", Arial, sans-serif;
}

.counter-line span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
}

.counter-line strong {
  font-size: 1.55rem;
}

.kill-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 12px;
}

.kill-selector button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1rem;
}

.kill-selector button.active {
  border-color: var(--red);
  background: rgba(216, 13, 19, 0.2);
  color: #fff;
}

.survivor-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.survivor-breakdown div {
  min-height: 70px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
}

.survivor-breakdown span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.survivor-breakdown strong {
  display: block;
  margin-top: 4px;
  font-size: 1.4rem;
}

.counter-panel > button + button,
.counter-panel .survivor-breakdown + button,
.counter-panel .save-button + button {
  margin-top: 10px;
}

.challenge-board {
  width: min(980px, 100%);
  min-height: 390px;
  margin: 0 auto;
  padding: 54px;
  text-align: center;
}

.challenge-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(142, 69, 216, 0.5);
  color: #cf9fff;
  background: rgba(142, 69, 216, 0.12);
  text-transform: uppercase;
}

.challenge-board strong {
  display: block;
  max-width: 840px;
  margin: 44px auto 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1;
  text-transform: uppercase;
}

.stats-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.stats-card {
  padding: 28px 34px;
}

.stats-card dl {
  display: grid;
  gap: 14px;
  margin: 20px 0 0;
}

.stats-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.stats-card dt,
.stats-card dd,
.donut-wrap p,
.history-list li {
  font-family: "Segoe UI", Arial, sans-serif;
}

.stats-card dt {
  color: #c7c3bc;
  font-weight: 700;
  text-transform: uppercase;
}

.stats-card dd {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
}

.killer-summary {
  border-color: rgba(216, 13, 19, 0.34);
}

.survivor-summary {
  border-color: rgba(211, 164, 35, 0.34);
}

.total-summary,
.history-card {
  grid-column: 1 / -1;
}

.total-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: center;
}

.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.donut {
  display: grid;
  place-items: center;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0deg, var(--gold) 0deg, rgba(255, 255, 255, 0.08) 0deg);
}

.donut::before {
  position: absolute;
  content: "";
}

.donut span {
  display: grid;
  place-items: center;
  width: 74px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: #f7f4ed;
  background: #101215;
  font-size: 1.2rem;
}

.donut-wrap p {
  max-width: 170px;
  margin: 0;
  color: #c7c3bc;
  font-weight: 800;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.history-list {
  display: grid;
  max-height: 300px;
  margin: 18px 0 0;
  padding-left: 22px;
  gap: 10px;
  overflow: auto;
}

.history-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.26);
  color: #eee9df;
  line-height: 1.35;
}

.history-list small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.wide-reset {
  display: block;
  min-width: 330px;
  margin: 26px auto 0;
  border-color: rgba(142, 69, 216, 0.45);
  background: linear-gradient(180deg, rgba(142, 69, 216, 0.42), rgba(42, 13, 61, 0.78));
}

.danger-reset {
  border-color: rgba(216, 13, 19, 0.55);
  background: linear-gradient(180deg, rgba(216, 13, 19, 0.5), rgba(72, 8, 12, 0.86));
}

.editor-board {
  padding: 28px;
}

.editor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-tab {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  text-transform: uppercase;
}

.editor-tab.active {
  border-color: rgba(142, 69, 216, 0.72);
  background: rgba(142, 69, 216, 0.2);
}

.editor-label {
  display: block;
  margin: 22px 0 10px;
  color: var(--muted);
  font-family: "Segoe UI", Arial, sans-serif;
  font-weight: 800;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 340px;
  padding: 16px;
  resize: vertical;
  border: 1px solid var(--line);
  outline: none;
  color: var(--text);
  background: rgba(0, 0, 0, 0.32);
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

textarea:focus {
  border-color: rgba(142, 69, 216, 0.75);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 44px;
  border-top: 1px solid var(--line);
  color: #aaa7a0;
  background: rgba(0, 0, 0, 0.46);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.9rem;
}

@media (max-width: 1080px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 22px 0;
  }

  .main-nav {
    width: 100%;
    min-height: 54px;
    margin-left: 0;
    overflow-x: auto;
  }

  .nav-link {
    min-width: max-content;
  }

  .home-view.active,
  .role-layout,
  .total-summary {
    grid-template-columns: 1fr;
  }

  .hero-figure {
    min-height: 380px;
  }

  .role-layout {
    gap: 20px;
  }

  .counter-panel {
    max-width: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 24px, 620px);
    padding-top: 26px;
  }

  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .perk-diamonds,
  .stats-layout {
    grid-template-columns: 1fr;
  }

  .killer-stage,
  .survivor-stage {
    grid-template-columns: 1fr;
  }

  .perk-diamonds {
    grid-auto-rows: 154px;
    gap: 18px;
  }

  .killer-stage .perk-diamonds,
  .survivor-stage .perk-diamonds {
    grid-template-columns: 1fr;
  }

  .killer-stage .perk-slot,
  .survivor-stage .perk-slot {
    width: 112px;
  }

  .killer-portrait-card,
  .survivor-portrait-card {
    min-height: 360px;
  }

  .portrait-frame {
    min-height: 250px;
  }

  .roulette-board,
  .counter-panel,
  .challenge-board,
  .stats-card,
  .editor-board {
    padding: 24px;
  }

  .perk-slot {
    width: 112px;
  }

  .hero-copy h1 {
    font-size: clamp(4.4rem, 24vw, 7rem);
  }

  .hero-actions,
  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-card,
  .compact-action,
  .spin-button,
  .outline-button,
  .ghost-button,
  .danger-button,
  .save-button,
  .wide-reset {
    width: 100%;
  }

  .compact-action {
    margin-left: 0;
  }
}

@keyframes portraitReveal {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    filter:
      drop-shadow(0 18px 16px rgba(0, 0, 0, 0.78))
      drop-shadow(0 0 0 rgba(216, 13, 19, 0));
  }

  55% {
    opacity: 1;
    transform: translateY(-8px) scale(1.04);
    filter:
      drop-shadow(0 18px 16px rgba(0, 0, 0, 0.78))
      drop-shadow(0 0 34px rgba(216, 13, 19, 0.48));
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes portraitRoll {
  0% {
    opacity: 0.7;
    transform: translateX(-5px) skewX(-2deg);
  }

  100% {
    opacity: 1;
    transform: translateX(5px) skewX(2deg);
  }
}

@keyframes textFlicker {
  0%,
  100% {
    opacity: 0.62;
  }

  50% {
    opacity: 1;
  }
}

@keyframes perkSlotRoll {
  0% {
    filter: brightness(0.78) blur(0.3px);
    transform: rotate(45deg) scale(0.96);
  }

  100% {
    filter: brightness(1.3) blur(0);
    transform: rotate(45deg) scale(1.04);
  }
}

@keyframes perkIconFlicker {
  0%,
  100% {
    opacity: 0.58;
  }

  50% {
    opacity: 1;
  }
}

@media (max-width: 520px) {
  .site-header {
    padding-inline: 14px;
  }

  .brand-r,
  .brand-2,
  .brand-p {
    font-size: 1.35rem;
  }

  .tally-mini {
    width: 30px;
    margin-right: 4px;
  }

  .hero-figure {
    display: none;
  }

  .counter-line,
  .stats-card dl div,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .survivor-breakdown,
  .kill-selector {
    grid-template-columns: 1fr;
  }
}
