:root {
  --bg-night: #08131d;
  --bg-deep: #13293d;
  --panel: rgba(8, 19, 29, 0.78);
  --panel-border: rgba(244, 209, 141, 0.2);
  --text-main: #f7f3e8;
  --text-soft: #c5d3dc;
  --gold: #f4d18d;
  --crimson: #e45f5f;
  --emerald: #67d49c;
  --sky: #7fc6ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, rgba(244, 209, 141, 0.14), transparent 32%),
    linear-gradient(160deg, #041018 0%, #0d1d29 44%, #172b3a 100%);
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  transition:
    transform 120ms ease,
    opacity 120ms ease,
    box-shadow 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(127, 198, 255, 0.12), transparent 26%),
    radial-gradient(circle at 80% 15%, rgba(103, 212, 156, 0.14), transparent 23%),
    radial-gradient(circle at 50% 75%, rgba(228, 95, 95, 0.12), transparent 30%);
  pointer-events: none;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero-panel,
.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 28px;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, transparent 20%, rgba(244, 209, 141, 0.08) 48%, transparent 76%);
  pointer-events: none;
}

.kicker,
.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--gold);
}

h1,
h2,
h3 {
  font-family: "Cinzel", serif;
  margin: 0;
}

h1 {
  font-size: clamp(2.3rem, 4vw, 4.4rem);
  line-height: 1.02;
  max-width: 11ch;
}

.lead {
  max-width: 64ch;
  line-height: 1.65;
  color: var(--text-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.6fr;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border-radius: 24px;
  padding: 22px;
}

.combat-panel,
.shop-panel {
  grid-column: span 1;
}

.log-panel,
.shop-panel {
  min-height: 280px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.badge {
  border: 1px solid rgba(244, 209, 141, 0.35);
  color: var(--gold);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  white-space: nowrap;
}

.house-badge {
  color: var(--sky);
  border-color: rgba(127, 198, 255, 0.35);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card,
.summary-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 14px;
}

.stat-card span,
.summary-card span {
  display: block;
  color: var(--text-soft);
  font-size: 0.85rem;
}

.stat-card strong,
.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.4rem;
}

.ability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.ability-pill {
  border-radius: 999px;
  background: rgba(103, 212, 156, 0.1);
  color: #bef0d2;
  border: 1px solid rgba(103, 212, 156, 0.28);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

.encounter-stage {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.portrait-wrap {
  min-height: 220px;
}

.enemy-portrait {
  position: relative;
  height: 100%;
  min-height: 220px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(12, 31, 45, 0.32), rgba(6, 10, 15, 0.9)),
    linear-gradient(135deg, #25465b, #09131c 60%);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.enemy-portrait.defeated {
  background:
    linear-gradient(180deg, rgba(61, 17, 17, 0.4), rgba(24, 7, 7, 0.92)),
    linear-gradient(135deg, #6f2d2d, #12090a 60%);
}

.portrait-aura {
  position: absolute;
  inset: 12% 14%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(244, 209, 141, 0.48), rgba(244, 209, 141, 0) 60%);
  filter: blur(12px);
}

.enemy-portrait.defeated .portrait-aura {
  background:
    radial-gradient(circle, rgba(228, 95, 95, 0.5), rgba(228, 95, 95, 0) 60%);
}

.portrait-text {
  position: absolute;
  left: 22px;
  bottom: 18px;
  z-index: 1;
}

.portrait-text span {
  display: block;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.portrait-text strong {
  display: block;
  margin-top: 6px;
  font-size: 1.6rem;
  font-family: "Cinzel", serif;
}

.combat-summary {
  display: grid;
  gap: 12px;
}

.hands-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.hand-panel {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hand-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 110px;
}

.card {
  width: 72px;
  aspect-ratio: 5 / 7;
  border-radius: 16px;
  padding: 10px;
  background: linear-gradient(180deg, #f8f5ef, #e6dfd2);
  color: #162232;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-weight: 800;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
}

.card.hidden {
  background:
    linear-gradient(135deg, rgba(8, 19, 29, 0.9), rgba(32, 70, 99, 0.85)),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.08) 0,
      rgba(255, 255, 255, 0.08) 6px,
      transparent 6px,
      transparent 12px
    );
  color: #edf7ff;
}

.card-rank {
  font-size: 1.15rem;
}

.card-suit {
  align-self: flex-end;
  font-size: 1.6rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.primary-button,
.secondary-button,
.ghost-button,
.shop-button {
  border-radius: 16px;
  padding: 14px 16px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, #f4d18d, #e8a745);
  color: #19222c;
}

.secondary-button {
  background: rgba(127, 198, 255, 0.12);
  color: #d5ecff;
  border: 1px solid rgba(127, 198, 255, 0.22);
}

.ghost-button {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.log-output {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 8px;
}

.log-line {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  line-height: 1.5;
}

.shop-items {
  display: grid;
  gap: 12px;
}

.shop-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.shop-item h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.shop-item p {
  margin: 0 0 14px;
  color: var(--text-soft);
  line-height: 1.45;
}

.shop-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-button {
  background: rgba(103, 212, 156, 0.12);
  color: #bef0d2;
  border: 1px solid rgba(103, 212, 156, 0.22);
}

.accent-win {
  color: var(--emerald);
}

.accent-loss {
  color: var(--crimson);
}

@media (max-width: 980px) {
  .dashboard-grid,
  .encounter-stage,
  .hands-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 16px;
  }

  .hero-panel,
  .panel {
    border-radius: 20px;
    padding: 18px;
  }

  .card {
    width: 62px;
  }
}
