:root {
  --bg: #0b0a0d;
  --panel: rgba(18, 14, 18, 0.9);
  --panel-soft: rgba(34, 22, 30, 0.78);
  --red: #d53445;
  --red-dark: #6f1827;
  --text: #f6ebee;
  --muted: #baa9b0;
  --green: #7cffad;
  --line: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(rgba(5, 4, 7, 0.82), rgba(11, 8, 10, 0.9)),
    url("Room.png") center / cover no-repeat fixed;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.app-card {
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(213, 52, 69, 0.22) inset;
  backdrop-filter: blur(4px);
}

.header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.9vw, 2.2rem);
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.hero-wrap {
  margin: 0.9rem 0;
  border-radius: 1rem;
  background: radial-gradient(circle at 50% 15%, rgba(213, 52, 69, 0.3), rgba(0, 0, 0, 0));
  display: flex;
  justify-content: center;
}

.kawaii-art {
  width: min(100%, 300px);
  max-height: 260px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.58));
}

.quest-panel {
  background: var(--panel-soft);
  border: 1px solid rgba(213, 52, 69, 0.3);
  border-radius: 1rem;
  padding: 0.85rem;
  transition: transform 180ms ease, opacity 180ms ease;
}

.quest-panel.roll {
  transform: translateY(-3px) scale(1.01);
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

#questTitle {
  margin: 0.45rem 0;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
}

.meta,
.quest-text,
.commentary {
  margin: 0.45rem 0;
}

.quest-text {
  line-height: 1.35;
}

.commentary {
  color: #ffd4d9;
  font-style: italic;
}

.chaos-wrap {
  margin-top: 0.8rem;
}

.meter-track {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 0.3rem;
}

.meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #ff6f7f, var(--green));
  transition: width 220ms ease;
}

.controls {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.btn {
  min-height: 2.75rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #2a1b21;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.btn:hover,
.btn:focus-visible {
  border-color: rgba(213, 52, 69, 0.8);
  outline: none;
}

.btn.primary {
  background: linear-gradient(180deg, #e44558, #9e2534);
}

.btn.danger {
  background: linear-gradient(180deg, #6b1b28, #471018);
}

.footer {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 480px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .app-card {
    padding: 0.85rem;
  }
}
