* {
  box-sizing: border-box;
}

:root {
  /* Backgrounds */
  --bg-main: #0f1720;        /* deep blue-black */
  --bg-card: #1b2430;        /* slate/stone */
  --bg-panel: #111827;

  /* Primary accents (gold) */
  --gold: #d4a84a;
  --gold-hi: #f5d27a;
  --gold-dim: #a67c2e;

  /* Secondary accents (teal glow from logo gem) */
  --teal: #2c7a7b;
  --teal-glow: #38bdf8;

  /* Text */
  --text-main: #f9fafb;
  --text-dim: #cbd5e1;

  /* Borders */
  --border-soft: #374151;
  --border-gold: rgba(212,168,74,0.5);
}

@font-face {
  font-family: "QOMfont";
  src: url("../fonts/transcity_otf-webfont.woff2") format("woff2"),
       url("../fonts/transcity_otf-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family:Arial, Helvetica, sans-serif;
  font-weight: normal;
  font-style: normal;

  
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("../images/bkgd1.png");
  background-repeat: repeat;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;   /* IMPORTANT */
  z-index: 1;           /* now this works */
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px;
}

h1, h2, h3 {
  color: var(--gold-hi);
  text-shadow: 0 0 6px rgba(212,168,74,0.4);
  font-family: "QOMfont", 'Times New Roman', Times, serif;
  margin-top: 0;
  margin-bottom: 10px;
}

.card {
  background: linear-gradient(145deg, #1b2430, #0f1720);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;

  box-shadow:
    0 0 12px rgba(0,0,0,0.6),
    inset 0 0 8px rgba(255,255,255,0.03);
}

.card h2 {
  margin-bottom: 12px;
}


.adventurer-card {
  width: fit-content;
  max-width: 515px;
}

.encounter-card {
  width: fit-content;
  max-width: 370px;
}

.encounter-log-card {
  width: 100%;
  margin-top: 12px;
}

.adventurer-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.adventurer-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 260px;
  max-width: 260px;
}

.adventurer-right h3 {
  margin: 8px 0 4px 0;
  font-size: 16px;
}

.adventurer-image {
  width: 220px;
  height: auto;
  border-radius: 10px;
  border: 1px solid #4b5563;
  object-fit: cover;
  display: none;
}

.adventurer-info {
  flex: none;
  margin: 0;
}

.adventurer-info h2 {
  margin: 0 0 8px 0;
  line-height: 1.1;
}

.grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.grid-2 {
  display: grid;
  grid-template-columns: 515px 370px;
  gap: 16px;
  width: 100%;
  align-items: stretch;
}

.grid-2 > .card {
  height: 100%;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}


label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}

input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #4b5563;
}

button {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #4b5563;
}
input {
  background: #111827;
  color: #f9fafb;
}

@keyframes pulse {
  0% { box-shadow: 0 0 6px rgba(44, 62, 80, 0.6); }
  50% { box-shadow: 0 0 12px rgba(44, 62, 80, 0.9); }
  100% { box-shadow: 0 0 6px rgba(44, 62, 80, 0.6); }
}


.action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.action-row:last-of-type {
  margin-bottom: 0;
}

.action-row button {
  flex: 0 0 auto;
  width: auto;
  padding: 6px 8px;
  font-size: 12px;
}

/* Smaller buttons */
.btn-small {
  flex: 0.7;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-logo {
  height: 80px;
  width: auto;
}

.btn-roll {
  background: linear-gradient(145deg, #3a2d12, #1a1408);
  color: var(--gold-hi);
  font-weight: bold;

  border: 1px solid var(--gold);

  box-shadow:
    0 0 10px rgba(212,168,74,0.5),
    inset 0 0 8px rgba(0,0,0,0.7);

  animation: pulse 1.8s infinite;
}

.btn-roll:hover {
  background-color: #1f2d3a;
}


button, .button-link {
  background: linear-gradient(145deg, #2c3e50, #1a2530);
  color: var(--gold-hi);
  border: 1px solid var(--border-gold);
  border-radius: 8px;

  box-shadow:
    0 0 6px rgba(212,168,74,0.2),
    inset 0 0 6px rgba(0,0,0,0.6);

  transition: all 0.15s ease;
}

button:hover {
  background: linear-gradient(145deg, #34495e, #1f2d3a);
  box-shadow:
    0 0 10px rgba(212,168,74,0.5),
    inset 0 0 6px rgba(0,0,0,0.6);
}

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

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid #374151;
  padding: 12px;
  text-align: left;
}

.stat-box {
  background: #0b1220;
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  padding: 4px 8px;
  margin-bottom: 4px;

  box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
}


.error-box {
  color: #fca5a5;
  margin-top: 12px;
  min-height: 22px;
}

.top-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.top-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.combat-log {
  background: #0b1220;
  height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
}

.log-intro {
  color: #d1d5db;
  font-style: italic;
}

.log-entry {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.log-entry:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

.result-box {
  background: #052e16;
  border: 1px solid #166534;
  border-radius: 10px;
  padding: 12px;
  min-height: 48px;
}

.log-win {
   color: #4ade80;
  font-weight: bold;
  text-align: center;
  font-size: 16px;
}

.log-loss {
   color: #f87171;
  font-weight: bold;
  text-align: center;
  font-size: 16px;
}

.encounter-image {
  height: 260px;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto 10px;
  border-radius: 12px;
  border: 1px solid #374151;
}

.encounter-layout {
  width: 900px;
}

@keyframes diceSpin {
  0%   { transform: rotate(0deg) scale(.6); opacity: 0; }
  20%  { opacity: 1; }
  70%  { transform: rotate(720deg) scale(1.15); }
  100% { transform: rotate(720deg) scale(1); opacity: 1; }
}

.dice-spin {
  animation: diceSpin .9s ease-out;
}

.dice-area {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  align-items: flex-start;
}

.dice-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dice-label {
  font-size: 12px;
  font-weight: bold;
  color: #d1d5db;
}

.die {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 26px;
  color: #fbbf24;
  background: linear-gradient(135deg, #2a2218, #0a0806);
  border: 1.5px solid #d4a84a;
  border-radius: 6px;
  transform: rotate(8deg);
  box-shadow: 0 0 20px rgba(212,168,74,.4), inset 0 0 12px rgba(0,0,0,.6);
  text-shadow: 0 0 8px rgba(212,168,74,.6);
}

@media (max-width: 768px) {
  /* EXISTING + NEW layout fixes */

  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  .container {
    width: 100%;
    max-width: 100%;
    padding: 10px;
    margin: 0;
  }

  .encounter-layout {
    width: 100%;
    max-width: 100%;
  }

  .grid-2 {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .adventurer-card,
  .encounter-card,
  .encounter-log-card {
    width: 100%;
    max-width: 100%;
  }

  .adventurer-header {
    flex-direction: column;
    align-items: center;
  }

  .adventurer-image,
  .encounter-image {
    max-width: 100%;
    height: auto;
  }

  .top-bar {
    flex-direction: column;
    align-items: center;
  }

  .top-buttons {
    justify-content: center;
  }

  .combat-log {
    width: 100%;
    overflow-x: auto;
  }

  .table,
.table thead,
.table tbody,
.table th,
.table td,
.table tr {
  display: block;
  width: 100%;
}

.table thead {
  display: none;
}

.table tr {
  border-bottom: 1px solid #374151;
  padding: 12px 0;
}

.table td {
  border-bottom: none;
  padding: 6px 0;
}

.table td:nth-child(1)::before { content: "Name: "; }
.table td:nth-child(2)::before { content: "Class: "; }
.table td:nth-child(3)::before { content: "HP: "; }
.table td:nth-child(4)::before { content: "Status: "; }
}