:root {
  color-scheme: dark;
  --bg: #0e1320;
  --bg-elevated: #151d2f;
  --panel: rgba(21, 29, 47, 0.92);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #ecf2ff;
  --muted: #9caccc;
  --accent: #7cc5ff;
  --accent-strong: #52a7ff;
  --success: #59d695;
  --danger: #ff6b7a;
  --warning: #ffcb6b;
  --monster: #7f5af0;
  --weapon: #2cb67d;
  --potion: #ef476f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --focus: 0 0 0 3px rgba(124, 197, 255, 0.25);
  --card-back: linear-gradient(135deg, #253252, #18213b);
  --transition: 200ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(124, 197, 255, 0.12), transparent 30%),
    radial-gradient(circle at right, rgba(127, 90, 240, 0.14), transparent 26%),
    var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: #fff;
  color: #111;
  border-radius: 999px;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 1rem;
}

.app-shell {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.topbar,
.panel {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.topbar-actions,
.controls-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

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

.hud-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 18px;
  padding: 1rem;
}

.hud-label-row,
.weapon-meta,
.stat-pair,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.hud-label,
.section-heading p,
.controls-copy p,
.weapon-meta,
.log-list {
  color: var(--muted);
}

.hud-value,
.weapon-summary {
  font-size: 1.15rem;
  font-weight: 700;
}

.meter {
  margin-top: 0.75rem;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
  transition: width 260ms ease;
}

.stats-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.stat-pair {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.75rem;
  border-radius: 14px;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.btn,
.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  transition:
    transform var(--transition),
    background var(--transition),
    border-color var(--transition),
    opacity var(--transition);
}

.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--monster));
  border-color: transparent;
}

.btn-warning {
  background: linear-gradient(135deg, #af7b00, #d49a16);
  border-color: transparent;
}

.room-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card-slot {
  min-height: 260px;
}

.game-card {
  position: relative;
  width: 100%;
  min-height: 260px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  padding: 0;
  perspective: 1200px;
}

.game-card[aria-pressed="true"] {
  outline: 2px solid rgba(124, 197, 255, 0.7);
  outline-offset: 4px;
}

.game-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.game-card.is-revealed .game-card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
}

.card-front {
  background: var(--card-back);
}

.card-front::after {
  content: "Scoundrel";
  display: grid;
  place-items: center;
  flex: 1;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.08em;
}

.card-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.card-back.monster {
  box-shadow: inset 0 0 0 2px rgba(127, 90, 240, 0.28);
}

.card-back.weapon {
  box-shadow: inset 0 0 0 2px rgba(44, 182, 125, 0.3);
}

.card-back.potion {
  box-shadow: inset 0 0 0 2px rgba(239, 71, 111, 0.3);
}

.card-type {
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.card-symbol {
  font-size: 4rem;
  line-height: 1;
}

.card-back.monster .card-symbol,
.card-back.monster .card-value {
  color: #b6a1ff;
}

.card-back.weapon .card-symbol,
.card-back.weapon .card-value {
  color: #8ef0c5;
}

.card-back.potion .card-symbol,
.card-back.potion .card-value {
  color: #ff9ab1;
}

.card-value {
  font-size: 2.1rem;
  font-weight: 800;
}

.card-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.card-badge {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}

.log-list {
  max-height: 220px;
  overflow: auto;
  padding-left: 1.25rem;
  margin-bottom: 0;
}

.log-list li + li {
  margin-top: 0.65rem;
}

.modal {
  border: none;
  padding: 0;
  width: min(760px, calc(100% - 1.5rem));
  background: transparent;
}

.modal::backdrop {
  background: rgba(7, 10, 18, 0.7);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: #121a2b;
  color: var(--text);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.modal-header,
.modal-body {
  padding: 1rem 1.2rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.prose ul {
  padding-left: 1.15rem;
}

.empty-room {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 20px;
}

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

  .controls,
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 1rem, 100%);
  }

  .hud,
  .room-grid,
  .stats-card {
    grid-template-columns: 1fr;
  }

  .game-card,
  .game-card-inner {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* === Card Images (Assets System) === */

.card-art-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-art {
  display: block !important;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
}

.card-art-fallback {
  display: none;
  place-items: center;
  min-height: 110px;
  width: 100%;
}

.card-back-art {
  display: block !important;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 14px;
}

.card-front {
  overflow: hidden;
}

.card-symbol {
  font-size: 4rem;
  line-height: 1;
}
.card-front::after {
  display: none;
}
/* === FORCE IMAGE VISIBILITY FIX === */

.card-front::after {
  display: none !important;
}

.card-art,
.card-back-art {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}
/* === Layout tuning: desktop + mobile fit === */

.app-shell {
  width: min(1120px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 0.75rem 0 1.25rem;
}

.topbar {
  margin-bottom: 0.75rem;
}

.panel {
  padding: 0.85rem;
}

.hud {
  gap: 0.75rem;
}

.room-grid {
  gap: 0.75rem;
}

.card-slot {
  min-height: 220px;
}

.game-card,
.game-card-inner {
  min-height: 220px;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 0.7rem;
  overflow: hidden;
}

.card-type {
  font-size: 0.72rem;
}

.card-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-top: 0.35rem;
}

.card-hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.log-list {
  max-height: 160px;
}

@media (min-width: 1200px) {
  .app-shell {
    width: min(1240px, calc(100% - 2rem));
  }

  .card-slot {
    min-height: 240px;
  }

  .game-card,
  .game-card-inner {
    min-height: 0;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 0.75rem, 100%);
    padding: 0.5rem 0 1rem;
  }

  .panel {
    padding: 0.75rem;
    border-radius: 18px;
  }

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

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

  .card-slot {
    min-height: 200px;
  }

  .game-card,
  .game-card-inner {
    min-height: 0;
  }

  .topbar-actions,
  .controls-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn {
    width: 100%;
    padding: 0.75rem 0.85rem;
  }

  .controls {
    align-items: stretch;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 2.1rem;
  }

  .eyebrow {
    font-size: 0.68rem;
  }

  .topbar-actions,
  .controls-actions {
    grid-template-columns: 1fr;
  }

  .room-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }

  .card-slot {
  min-height: auto;
  }

  .game-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 0;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  padding: 0;
  perspective: 1200px;
  }

  .card-face {
    padding: 0.6rem;
  }

  .card-type {
    font-size: 0.64rem;
  }

  .card-value {
    font-size: 1.35rem;
  }

  .card-hint {
    font-size: 0.76rem;
  }

  .card-badge {
    font-size: 0.64rem;
    padding: 0.25rem 0.45rem;
  }

  .log-list {
    max-height: 120px;
  }
}
/* === Card art fit === */

.card-art-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 84px;
  flex: 1;
}

.card-art {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 100px;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
}

.card-back-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 14px;
  padding: 0.35rem;
}

.card-front {
  overflow: hidden;
}

.card-front::after {
  display: none !important;
}

@media (min-width: 1200px) {
  .card-art {
    max-height: 120px;
  }
}

@media (max-width: 560px) {
  .card-art {
    max-height: 78px;
  }

  .card-back-art {
    padding: 0.2rem;
  }
}
.card-front::after {
  display: none !important;
}

@media (max-width: 560px) {
  .room-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .card-face {
    padding: 0.55rem;
  }

  .card-value {
    font-size: 1.2rem;
  }

  .card-hint {
    font-size: 0.72rem;
  }

  .card-type {
    font-size: 0.62rem;
  }
}
/* === FIX CARD SIZE + IMAGE FIT === */

.game-card {
  width: 100%;
  aspect-ratio: 3 / 4;
}

.game-card-inner {
  width: 100%;
  height: 100%;
}

.card-face {
  padding: 0.6rem;
  overflow: hidden;
}

.card-art-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-back-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* === FORCE IMAGE TO FILL CARD === */

.card-art-wrap {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 0 !important;
}

.card-art {
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
}

.game-card {
  display: flex;
  flex-direction: column;
}

.game-card-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.card-type {
  font-size: 0.6rem !important;
}

.card-value {
  font-size: 1.2rem !important;
  margin: 0.2rem 0 !important;
}

.card-hint {
  font-size: 0.7rem !important;
}



































































































































































