.layout {
  display: flex;
  height: calc(100vh - 100px);
}

.main {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  position: relative;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--gold-rgb), 0.2) transparent;
}

.main::-webkit-scrollbar {
  width: 6px;
}

.main::-webkit-scrollbar-track {
  background: transparent;
}

.main::-webkit-scrollbar-thumb {
  background: rgba(var(--gold-rgb), 0.2);
  border-radius: 3px;
}

.main::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--gold-rgb), 0.35);
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .main {
    flex: 1;
    padding-right: 0;
  }

  .header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .campaignName {
    font-size: 1.1rem;
    width: 100%;
    text-align: center;
    order: -1;
  }

  .addBtn {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.backLink {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.backLink:hover {
  color: var(--gold);
}

.campaignName {
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(var(--shadow-rgb), 0.4);
}

.headerBtns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fogBtn {
  padding: 0.4rem 0.5rem;
  background: none;
  border: 1px solid rgba(var(--gold-rgb), 0.2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.5;
  transition:
    opacity 0.15s,
    border-color 0.15s;
}

.fogBtn:hover {
  opacity: 0.8;
  border-color: rgba(var(--gold-rgb), 0.4);
}

.fogBtnActive {
  opacity: 1;
  border-color: rgba(var(--gold-rgb), 0.5);
  background: rgba(var(--gold-rgb), 0.1);
}

.addBtn {
  padding: 0.5rem 1rem;
  background: var(--btn-gold-bg);
  color: var(--btn-active-text);
  border: none;
  border-radius: 4px;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow:
    0 2px 4px rgba(var(--shadow-rgb), 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-shadow: 0 1px 1px rgba(var(--shadow-rgb), 0.2);
}

.addBtn:hover {
  background: linear-gradient(
    180deg,
    var(--gold-bright),
    var(--gold-hover) 40%,
    var(--gold)
  );
}

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

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 3rem 0;
  font-style: italic;
  grid-column: 1 / -1;
}

/* ── Combat layout ── */

.content {
  display: block;
}

.content.withCombat {
  display: flex;
  gap: 0;
  align-items: flex-start;
}

.combatSidebar {
  width: 190px;
  flex-shrink: 0;
  border-right: 1px solid rgba(var(--gold-rgb), 0.15);
  padding-right: 0.5rem;
  margin-right: 0.75rem;
  min-height: 300px;
  position: sticky;
  top: 0;
}

.content.withCombat .grid {
  flex: 1;
  min-width: 0;
}

.addBtnActive {
  background: rgba(var(--gold-rgb), 0.15) !important;
  border: 1px solid rgba(var(--gold-rgb), 0.5) !important;
  color: var(--gold) !important;
}

@media (max-width: 768px) {
  .content.withCombat {
    flex-direction: column;
  }

  .combatSidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(var(--gold-rgb), 0.15);
    padding-right: 0;
    margin-right: 0;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    position: static;
  }
}
