:root {
  color-scheme: dark;
  --ink: #f3ead8;
  --muted: #b9ad99;
  --panel: rgba(18, 17, 15, 0.88);
  --line: rgba(221, 194, 127, 0.24);
  --gold: #d7a742;
  --red: #c64b43;
  --green: #8ba866;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #090b09;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#app {
  position: relative;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
  background: #10120f;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 45%, rgba(63, 73, 48, 0.22), rgba(5, 6, 5, 0.78) 58%);
}

.screen-active {
  display: grid;
}

.start-layout {
  width: min(1100px, 92vw);
  min-height: min(560px, 84vh);
  position: relative;
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 24px;
  padding: 42px 46px;
  background:
    linear-gradient(90deg, rgba(7, 8, 7, 0.78) 0%, rgba(7, 8, 7, 0.42) 34%, rgba(7, 8, 7, 0.08) 72%),
    url("./assets/runtime/terrain/terrain_moss_green_v1.png") center / cover;
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
}

.title-block {
  position: relative;
  z-index: 2;
  grid-column: 1;
  grid-row: 1;
}

.class-art-stage {
  position: absolute;
  left: 56%;
  bottom: 84px;
  z-index: 1;
  width: min(38vw, 420px);
  height: min(64vh, 430px);
  pointer-events: none;
  transform: translateX(-50%);
}

.class-art {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: none;
  max-width: 100%;
  max-height: 100%;
  transform: translateX(-50%);
  object-fit: contain;
  object-position: center bottom;
}

.class-art-sister {
  max-height: none;
  height: 98%;
}

.start-layout-hunter .class-art-hunter,
.start-layout-sister .class-art-sister {
  display: block;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(42px, 5.8vw, 72px);
  line-height: 0.96;
}

h2 {
  font-size: 30px;
}

.subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.menu-panel,
.level-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.42);
}

.menu-panel {
  position: relative;
  z-index: 2;
  grid-column: 1;
  grid-row: 2;
  align-self: center;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.start-help {
  position: relative;
  z-index: 2;
  grid-column: 1;
  grid-row: 3;
  max-width: 380px;
  padding: 14px 16px;
  background: rgba(10, 10, 9, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.start-help-title {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.start-help-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  display: grid;
  gap: 6px;
}

.class-options {
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
}

button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.class-card {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.12);
  text-align: left;
}

.class-card span {
  color: var(--ink);
  font-size: 15px;
}

.class-card strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.class-card-active {
  background: rgba(184, 128, 47, 0.22);
  border-color: rgba(255, 217, 127, 0.52);
}

.primary-btn {
  background: linear-gradient(180deg, #b68131, #72501e);
  border-color: rgba(255, 217, 127, 0.48);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.primary-btn:hover,
.ghost-btn:hover,
.class-card:hover,
.upgrade-card:hover {
  filter: brightness(1.12);
}

.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  pointer-events: none;
  display: grid;
  grid-template-columns: minmax(240px, 292px) minmax(180px, 238px);
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.hud-left,
.hud-right,
.battle-tip {
  background: rgba(12, 13, 11, 0.72);
  border: 1px solid rgba(221, 194, 127, 0.18);
  border-radius: 8px;
  padding: 12px;
  backdrop-filter: blur(8px);
}

.hud-right {
  justify-self: end;
  width: 238px;
  padding: 9px 10px;
  background: rgba(12, 13, 11, 0.38);
  border-color: rgba(221, 194, 127, 0.12);
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.bar {
  height: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.hp-fill,
.xp-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
}

.hp-fill {
  background: linear-gradient(90deg, #7ba45b, #d34f46);
}

.xp-fill {
  background: linear-gradient(90deg, #d6a13a, #f4d86a);
}

.timer {
  text-align: right;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.weapon-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.weapon-pill {
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.battle-tip {
  align-self: end;
  justify-self: center;
  margin-top: calc(100vh - 104px);
  color: var(--muted);
  text-align: center;
}

.level-panel {
  width: min(920px, 94vw);
  padding: 24px;
}

.card-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.upgrade-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(221, 194, 127, 0.24);
  text-align: left;
}

.upgrade-type {
  color: var(--gold);
  font-size: 12px;
}

.upgrade-card h3 {
  margin: 8px 0;
  font-size: 22px;
  letter-spacing: 0;
}

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

.result-panel {
  width: min(520px, 92vw);
  padding: 26px;
}

.result-stats {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  color: var(--muted);
}

.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 760px) {
  .start-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 24px;
    padding: 28px;
    background-size: auto, cover;
    background-position: center, center;
  }

  .class-art-stage {
    left: auto;
    right: 18px;
    bottom: 34px;
    width: min(46vw, 240px);
    height: min(48vh, 300px);
    transform: none;
    opacity: 0.72;
  }

  .menu-panel {
    align-self: start;
  }

  .start-help {
    max-width: none;
  }

  .hud {
    grid-template-columns: 1fr;
  }

  .hud-right {
    justify-self: stretch;
    width: auto;
  }

  .battle-tip {
    display: none;
  }

  .card-row {
    grid-template-columns: 1fr;
  }
}
