:root {
  --bg-1: #1a0f12;
  --bg-2: #382026;
  --panel: rgba(24, 18, 22, 0.84);
  --panel-border: rgba(255, 219, 179, 0.14);
  --ink: #f8efe0;
  --muted: #d9baa1;
  --ember: #ffb15c;
  --ember-hot: #ff6d3d;
  --gold: #f7d39a;
  --mercy: #ffe07d;
  --player: #ff4f6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 132, 77, 0.2), transparent 32%),
    radial-gradient(circle at 20% 20%, rgba(255, 222, 170, 0.08), transparent 20%),
    linear-gradient(160deg, var(--bg-2), var(--bg-1) 55%, #120b0d);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 34rem;
  height: 34rem;
  top: -10rem;
  right: -10rem;
  background: radial-gradient(circle, rgba(255, 176, 117, 0.18), transparent 70%);
  filter: blur(8px);
}

body::after {
  width: 26rem;
  height: 26rem;
  bottom: -12rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(255, 90, 63, 0.12), transparent 68%);
}

.game-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  padding: 2rem;
  place-items: center;
}

.scene-card {
  width: min(1100px, 100%);
  padding: 1.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: rise-in 700ms ease-out;
}

.scene-header,
.turn-row,
.status-line,
.actions,
.act-menu,
.scene-grid {
  display: flex;
  gap: 1rem;
}

.scene-header,
.turn-row,
.status-line {
  justify-content: space-between;
  align-items: center;
}

.scene-header {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

h1 {
  margin: 0;
  font-family: Baskerville, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ghost-button,
.action-button,
.act-option {
  appearance: none;
  border: 1px solid rgba(255, 234, 207, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.ghost-button {
  padding: 0.85rem 1.25rem;
  font-size: 0.92rem;
}

.ghost-button:hover,
.action-button:hover,
.act-option:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 214, 170, 0.42);
  background: rgba(255, 255, 255, 0.08);
}

.ghost-button:disabled,
.action-button:disabled,
.act-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.scene-grid {
  align-items: stretch;
  flex-wrap: wrap;
}

.boss-panel,
.arena-panel,
.log-panel {
  min-width: 0;
  border-radius: 24px;
  border: 1px solid rgba(255, 232, 204, 0.1);
  background: rgba(10, 8, 10, 0.38);
}

.boss-panel,
.log-panel {
  flex: 1 1 280px;
}

.arena-panel {
  flex: 1.2 1 360px;
}

.boss-panel,
.arena-panel,
.log-panel {
  padding: 1.2rem;
}

.toriel-stage {
  display: grid;
  gap: 1.25rem;
  height: 100%;
}

.portrait-frame {
  position: relative;
  min-height: 290px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 215, 143, 0.22), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #2d1c1f, #130d10 72%);
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(transparent 55%, rgba(255, 114, 64, 0.08)),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 22px,
      rgba(255, 255, 255, 0.02) 22px,
      rgba(255, 255, 255, 0.02) 23px
    );
  mix-blend-mode: screen;
}

.portrait-glow {
  position: absolute;
  inset: 20% 22% 16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 176, 90, 0.55), transparent 68%);
  filter: blur(24px);
  animation: pulse 3.8s ease-in-out infinite;
}

.toriel-silhouette {
  position: absolute;
  inset: auto 50% 0;
  width: 185px;
  height: 255px;
  transform: translateX(-50%);
}

.horn,
.ears,
.face,
.robe,
.eyes {
  position: absolute;
  display: block;
}

.horn {
  top: 16px;
  width: 46px;
  height: 80px;
  border-radius: 40px 40px 10px 10px;
  background: linear-gradient(180deg, #f3ecdf, #b9b1a5 70%);
  box-shadow: inset 0 -12px 18px rgba(0, 0, 0, 0.2);
}

.horn-left {
  left: 18px;
  transform: rotate(-25deg);
}

.horn-right {
  right: 18px;
  transform: rotate(25deg);
}

.ears {
  top: 78px;
  left: 50%;
  width: 118px;
  height: 110px;
  transform: translateX(-50%);
  border-radius: 58% 58% 46% 46%;
  background: linear-gradient(180deg, #fbf4e6, #cdc5b8 80%);
}

.face {
  top: 100px;
  left: 50%;
  width: 104px;
  height: 84px;
  transform: translateX(-50%);
  border-radius: 42% 42% 50% 50%;
  background: linear-gradient(180deg, #181112, #0f0a0b 75%);
  box-shadow: 0 0 0 12px rgba(19, 13, 16, 0.98);
}

.eyes {
  top: 132px;
  left: 50%;
  width: 72px;
  height: 12px;
  transform: translateX(-50%);
  background:
    radial-gradient(circle, var(--ember) 0 36%, transparent 37%) left center / 12px 12px no-repeat,
    radial-gradient(circle, var(--ember) 0 36%, transparent 37%) right center / 12px 12px no-repeat;
  filter: drop-shadow(0 0 6px rgba(255, 176, 92, 0.5));
}

.robe {
  left: 50%;
  bottom: 0;
  width: 182px;
  height: 172px;
  transform: translateX(-50%);
  border-radius: 50% 50% 14px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%),
    linear-gradient(180deg, #ede0c6, #b89f73 56%, #7c5d44);
  clip-path: polygon(14% 10%, 28% 0, 72% 0, 86% 10%, 100% 100%, 0 100%);
  box-shadow: inset 0 -26px 22px rgba(0, 0, 0, 0.18);
}

.boss-status,
.status-notes {
  display: grid;
  gap: 0.8rem;
}

.boss-mood,
.touch-hint,
.status-notes,
.mode-text {
  color: var(--muted);
}

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

.meter-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 220ms ease;
}

.meter-fill.boss {
  background: linear-gradient(90deg, var(--ember), var(--ember-hot));
}

.meter-fill.player {
  background: linear-gradient(90deg, #ff8598, var(--player));
}

.arena-panel {
  display: grid;
  gap: 1rem;
}

.arena-frame {
  position: relative;
  padding: 0.85rem;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(12, 10, 12, 0.66);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 227, 0.06);
}

.arena-frame.fight-active {
  display: grid;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 173, 103, 0.08), transparent 28%),
    #0f0a0d;
}

.fight-minigame {
  display: grid;
}

.fight-screen {
  position: relative;
  display: grid;
  min-height: 240px;
  padding: 1rem;
  place-items: center;
  border: 4px solid rgba(247, 242, 237, 0.96);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03), transparent 36%),
    linear-gradient(180deg, #101012, #060507);
  overflow: hidden;
}

.fight-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 2px,
      transparent 2px,
      transparent 7px
    );
  pointer-events: none;
}

.fight-caption,
.fight-prompt {
  position: relative;
  z-index: 1;
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.fight-caption {
  color: rgba(255, 232, 204, 0.62);
  font-size: 0.72rem;
}

.fight-prompt {
  color: rgba(255, 232, 204, 0.82);
  font-size: 0.78rem;
}

.fight-bar {
  position: relative;
  z-index: 1;
  width: min(92%, 720px);
  height: 140px;
}

.fight-line {
  position: absolute;
  inset: 50% 0 auto;
  height: 18px;
  transform: translateY(-50%);
  background: #f4f2f1;
}

.fight-target {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14%;
  height: 86px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ffe09d, #d9a54d);
  box-shadow: 0 0 20px rgba(255, 219, 142, 0.35);
}

.fight-cursor {
  position: absolute;
  left: 5%;
  top: 50%;
  width: 18px;
  height: 140px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ff8d87, #ef6f78);
  box-shadow: 0 0 18px rgba(255, 124, 124, 0.32);
}

.touch-hint {
  margin: 0.8rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.player-strip {
  display: grid;
  gap: 0.7rem;
}

.log-panel {
  display: grid;
  gap: 1rem;
}

.turn-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 190, 102, 0.12);
  color: var(--gold);
  font-size: 0.9rem;
}

.dialogue-box {
  min-height: 180px;
  padding: 1.1rem 1.15rem;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent),
    rgba(8, 7, 8, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 236, 213, 0.06);
}

.dialogue-box p {
  margin: 0;
  line-height: 1.65;
  font-size: 1.04rem;
}

.actions,
.act-menu {
  flex-wrap: wrap;
}

.action-button,
.act-option {
  flex: 1 1 calc(50% - 0.5rem);
  min-height: 3.4rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.action-button.fight {
  border-color: rgba(255, 132, 117, 0.28);
}

.action-button.mercy {
  border-color: rgba(255, 224, 125, 0.28);
  color: var(--mercy);
}

.act-option.muted {
  color: var(--muted);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@media (max-width: 960px) {
  .game-shell {
    padding: 1rem;
  }

  .scene-card {
    padding: 1rem;
  }

  .scene-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 620px) {
  .boss-panel,
  .arena-panel,
  .log-panel {
    flex-basis: 100%;
  }

  .action-button,
  .act-option {
    flex-basis: 100%;
  }

  .dialogue-box {
    min-height: 150px;
  }

  .fight-bar {
    height: 116px;
  }

  .fight-line {
    height: 15px;
  }

  .fight-target {
    height: 72px;
  }

  .fight-cursor {
    height: 116px;
  }

  .turn-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
