:root {
  color-scheme: dark;
  --bg: #111313;
  --panel: #1a2020;
  --panel-2: #202829;
  --ink: #f4f0df;
  --muted: #b8b19a;
  --line: #3b4646;
  --gold: #e5b958;
  --red: #d75d4c;
  --green: #67b56f;
  --blue: #65aee1;
  --violet: #b58ce3;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(229, 185, 88, 0.12), transparent 26rem),
    linear-gradient(145deg, #101313 0%, #151817 44%, #171511 100%);
  color: var(--ink);
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #253030;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  min-height: 42px;
  padding: 0.7rem 0.9rem;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  background: #303d3e;
  border-color: #65716e;
  transform: translateY(-1px);
}

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

#app {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: clamp(1rem, 2.5vw, 2.5rem);
}

.shell {
  margin: 0 auto;
  max-width: 1180px;
}

.topbar,
.battle-head,
.shop-head,
.result-head {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.brand {
  display: grid;
  gap: 0.2rem;
}

.brand h1,
.brand h2,
.result-head h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 4.8rem);
  letter-spacing: 0;
  line-height: 0.94;
  margin: 0;
}

.brand p,
.screen-copy,
.hint,
.fine {
  color: var(--muted);
  margin: 0;
}

.hero {
  align-items: end;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  min-height: calc(100vh - 5rem);
}

.hero-art {
  background:
    linear-gradient(rgba(14, 18, 17, 0.1), rgba(14, 18, 17, 0.46)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 900'%3E%3Crect width='900' height='900' fill='%23141918'/%3E%3Cpath d='M56 720 220 420l128 164 98-302 154 290 96-145 148 293Z' fill='%23344340'/%3E%3Cpath d='M372 610c-8-88 58-152 98-199 44 51 102 107 96 199-4 68-44 122-96 122s-92-54-98-122Z' fill='%23d98b4a'/%3E%3Cpath d='M404 613c-5-54 33-98 66-136 34 39 70 82 66 136-3 43-28 78-66 78-37 0-62-35-66-78Z' fill='%23f0c960'/%3E%3Cg fill='none' stroke='%23e9dba5' stroke-width='14' stroke-linecap='round'%3E%3Cpath d='M212 356 274 298l62 58M614 344l56-52 55 52M442 276l33-71 33 71'/%3E%3C/g%3E%3Cg fill='%238aa28f'%3E%3Ccircle cx='155' cy='620' r='35'/%3E%3Ccircle cx='744' cy='624' r='42'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  background-size: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 62vh;
}

.hero-panel {
  padding-bottom: 9vh;
}

.hero-panel h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.3rem, 10vw, 8rem);
  letter-spacing: 0;
  line-height: 0.82;
  margin: 0 0 1rem;
}

.hero-panel p {
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  line-height: 1.6;
  margin: 0 0 1.25rem;
  max-width: 42rem;
}

.primary {
  background: var(--gold);
  border-color: #f1d389;
  color: #20180b;
}

.primary:hover:not(:disabled),
.primary:focus-visible:not(:disabled) {
  background: #f1ca67;
  border-color: #ffe19c;
}

.grid {
  display: grid;
  gap: 1rem;
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two {
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.65fr);
}

.card,
.fighter,
.log,
.shop,
.rumor-panel,
.history,
.upgrade-card {
  background: rgba(26, 32, 32, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card,
.shop,
.rumor-panel,
.history,
.upgrade-card {
  padding: 1rem;
}

.card {
  display: grid;
  gap: 0.85rem;
}

.class-row,
.stat-grid,
.item-row,
.inventory-row,
.choice-actions,
.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.class-icon {
  align-items: center;
  aspect-ratio: 1;
  background: #2f3837;
  border: 1px solid #51605d;
  border-radius: 8px;
  display: inline-grid;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 800;
  height: 56px;
  justify-items: center;
}

.card h3,
.fighter h3,
.shop h3,
.rumor-panel h3,
.history h3,
.upgrade-card h3 {
  font-size: 1.1rem;
  margin: 0;
}

.rumor-panel {
  background: rgba(26, 32, 32, 0.96);
  border: 1px solid #4c5b59;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  padding: 1rem;
}

.rumor-panel p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0.35rem 0 0;
}

.stat,
.tag {
  background: #242d2d;
  border: 1px solid #3c4746;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  padding: 0.34rem 0.55rem;
}

.stat strong,
.tag strong {
  color: var(--ink);
}

.trait {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.shop-list,
.inventory-list,
.history-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.item-row,
.inventory-row {
  align-items: center;
  background: #202829;
  border: 1px solid #374343;
  border-radius: 8px;
  justify-content: space-between;
  padding: 0.7rem;
}

.item-row span,
.inventory-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.battlefield {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin-bottom: 1rem;
}

.fighter {
  min-height: 360px;
  overflow: hidden;
}

.fighter-portrait {
  align-items: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.14), transparent 9rem),
    linear-gradient(160deg, rgba(229, 185, 88, 0.18), rgba(101, 174, 225, 0.1));
  border-bottom: 1px solid var(--line);
  display: grid;
  min-height: 170px;
  place-items: center;
}

.monster .fighter-portrait {
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.12), transparent 9rem),
    linear-gradient(160deg, rgba(215, 93, 76, 0.2), rgba(103, 181, 111, 0.1));
}

.sprite {
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.35));
  max-width: min(70%, 240px);
  width: 100%;
}

.fighter-body {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.bars {
  display: grid;
  gap: 0.5rem;
}

.bar {
  display: grid;
  gap: 0.25rem;
}

.bar-label {
  color: var(--muted);
  display: flex;
  font-size: 0.84rem;
  justify-content: space-between;
}

.bar-track {
  background: #121616;
  border: 1px solid #33403f;
  border-radius: 999px;
  height: 13px;
  overflow: hidden;
}

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

.hp {
  background: linear-gradient(90deg, #a33d35, var(--red));
}

.mp {
  background: linear-gradient(90deg, #3478a8, var(--blue));
}

.battle-actions {
  display: flex;
  gap: 0.7rem;
}

.log {
  max-height: 260px;
  overflow: auto;
  padding: 1rem;
}

.log ol,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log li,
.history-list li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  line-height: 1.45;
  padding: 0.5rem 0;
}

.log li:first-child {
  color: var(--ink);
  padding-top: 0;
}

.result {
  align-items: center;
  display: grid;
  min-height: 100vh;
}

.result-panel {
  background: rgba(26, 32, 32, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 0 auto;
  max-width: 920px;
  padding: clamp(1rem, 3vw, 2rem);
  width: min(100%, 920px);
}

.result-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.upgrade-card {
  align-content: start;
  display: grid;
  gap: 0.7rem;
}

.upgrade-card .type {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

@media (max-width: 880px) {
  .hero,
  .two,
  .battlefield,
  .three {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-panel {
    padding-bottom: 1rem;
  }

  .hero-art {
    min-height: 36vh;
  }

  .topbar,
  .battle-head,
  .shop-head,
  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .screen {
    padding: 0.8rem;
  }

  .battle-actions,
  .choice-actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
