:root {
  --bg-top: #102127;
  --bg-bottom: #071013;
  --panel: rgba(8, 25, 33, 0.78);
  --panel-border: rgba(131, 195, 206, 0.28);
  --accent: #f2b641;
  --danger: #d85f4a;
  --ok: #69c17d;
  --text: #f2efe3;
  --muted: #b7c4c8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Merriweather", serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 5%, #1d3d47 0%, transparent 38%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 70%);
}

.sky-glow {
  position: fixed;
  width: 48vw;
  height: 48vw;
  border-radius: 50%;
  top: -18vw;
  right: -16vw;
  background: rgba(242, 182, 65, 0.09);
  filter: blur(22px);
  pointer-events: none;
}

.hero {
  text-align: center;
  padding: 1.2rem 1rem 0.5rem;
  animation: rise 0.6s ease;
}

.hero h1 {
  font-family: "Bebas Neue", cursive;
  letter-spacing: 0.08em;
  font-size: clamp(2.3rem, 4.7vw, 4rem);
  margin: 0;
  color: #f4dca3;
}

.hero p {
  margin: 0.35rem auto 0;
  color: var(--muted);
  max-width: 72ch;
  font-size: 0.92rem;
}

.layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(250px, 320px) minmax(350px, 1fr) minmax(250px, 320px);
  padding: 1rem;
}

.panel,
.battle-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(4px);
}

.panel {
  padding: 1rem;
}

h2 {
  font-family: "Bebas Neue", cursive;
  letter-spacing: 0.06em;
  margin: 0 0 0.6rem;
  color: #f6dea3;
}

.small {
  margin-top: -0.1rem;
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.controls-help {
  margin: 0.5rem 0 0.2rem;
}

.class-list,
.stack {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.battle-panel {
  padding: 0.8rem;
}

.hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}

.hud div {
  background: rgba(6, 20, 28, 0.72);
  border: 1px solid rgba(131, 195, 206, 0.24);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  text-align: center;
}

.hud span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.hud strong {
  font-size: 1rem;
  color: #f5e6bf;
}

.battle-scene {
  width: 100%;
  min-height: 420px;
  border-radius: 12px;
  background: linear-gradient(180deg, #264452, #152b34 42%, #2f3222 42%, #202615 100%);
  border: 1px solid rgba(242, 182, 65, 0.25);
  overflow: hidden;
}

.battle-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.battle-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}

button {
  border: 1px solid #e3bb61;
  background: linear-gradient(180deg, #f0c65f, #d69f39);
  color: #2e1d08;
  border-radius: 8px;
  padding: 0.48rem 0.6rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

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

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary {
  border-color: #67aeb8;
  background: linear-gradient(180deg, #8ec8ce, #5f9ea7);
  color: #061a20;
}

.danger {
  border-color: #e18172;
  background: linear-gradient(180deg, #dc7f6f, #bb5f4f);
  color: #fff0eb;
}

.card {
  border: 1px solid rgba(144, 203, 213, 0.3);
  border-radius: 10px;
  padding: 0.52rem;
  background: rgba(8, 27, 36, 0.8);
}

.card strong {
  display: block;
  margin-bottom: 0.2rem;
}

.card p {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.log {
  max-height: 520px;
  overflow: auto;
  display: grid;
  gap: 0.42rem;
  padding-right: 0.2rem;
}

.log-entry {
  font-size: 0.74rem;
  border-left: 2px solid rgba(242, 182, 65, 0.55);
  padding-left: 0.45rem;
  color: #d6e2e5;
}

.relic-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.52);
  z-index: 20;
}

.hidden {
  display: none;
}

.relic-card {
  width: min(760px, 94vw);
  background: #10262f;
  border: 1px solid rgba(243, 195, 95, 0.45);
  border-radius: 14px;
  padding: 1rem;
}

.relic-card h3 {
  font-family: "Bebas Neue", cursive;
  letter-spacing: 0.07em;
  margin: 0;
  font-size: 1.5rem;
}

.relic-card p {
  margin-top: 0.35rem;
  color: var(--muted);
}

.relic-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

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

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

  .log {
    max-height: 280px;
  }
}

@media (max-width: 640px) {
  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .relic-choices {
    grid-template-columns: 1fr;
  }
}
