/* === Base document + controls === */

body {
  margin: 0;
  background: #0b0e14;
  color: #e0e4e8;
  font-family: monospace;
}

/* Utility */
.hidden {
  display: none !important;
}

/* make form controls inherit the page font */
button, input, select, textarea {
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}

/* Left panel of text buttons (legacy / optional) */
#ui-panel {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

button {
  background: none;
  color: #e0e4e8;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

/* === Shared panels for non-game screens === */

#screen-start,
#screen-character {
  padding: 2rem 1rem;
  display: flex;
  justify-content: center;
}

#screen-start .panel,
#screen-character .panel {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 1.5rem 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Headings / text */
#screen-start h1,
#screen-character h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.4rem;
}

#screen-start p,
#screen-character p {
  margin: 0.25rem 0 1rem;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* Buttons on these screens – reuse minimal style */
#screen-start button,
#screen-character button {
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: inherit;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

#screen-start button:hover,
#screen-character button:hover {
  border-color: #4f8cff;
}

/* Start screen – saves list */

#save-list {
  margin-top: 1.5rem;
}

#save-list p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

.save-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.save-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  background: #181818;
  font-size: 0.85rem;
}

.save-row span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.save-row button {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

/* Character creation – name row */

.char-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.char-row label {
  font-size: 0.85rem;
  min-width: 3rem;
}

.char-row input {
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  border: 1px solid #333;
  background: #111;
  color: inherit;
  font-size: 0.85rem;
}

/* Character creation – stats */

.char-stats {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2a2a2a;
}

.char-stats > p:first-child {
  margin-bottom: 0.75rem;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.stat-label {
  display: inline-block;
  width: 2.5rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

#stat-str-value,
#stat-dex-value,
#stat-int-value,
#stat-vit-value {
  display: inline-block;
  min-width: 2.5rem;
  text-align: center;
}

.stat-row button {
  padding: 0.1rem 0.45rem;
  font-size: 0.8rem;
}

/* Points + randomize */

#points-left {
  font-weight: 600;
}

#btn-random-stats {
  margin-top: 0.25rem;
}

/* Character creation – bottom buttons */

.char-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Hide [hidden] sections */
section[hidden] {
  display: none !important;
}

/* === GAME MENU BAR (Inventory, Equipment, Crafting, etc.) === */

/* Phase D — One consolidated top bar (character summary + menu buttons) */
#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  background: #151515;
  border-bottom: 1px solid #2a2a2a;

  /* Matches your existing bar padding style */
  padding: 0;
}

#menu-bar {
  display: flex;
  gap: 0.5rem;

  /* Phase D: inline inside #top-bar */
  padding: 0.2rem 0.8rem;
  background: transparent;
  border-bottom: none;
  margin-top: 0;
}

#menu-bar button {
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: inherit;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

#menu-bar button:hover {
  border-color: #4f8cff;
}

/* === Header layout === */
#game-header {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;

  background: #111;
  border-top: 1px solid #333;
  padding: 6px 12px;

  font-family: monospace;
  font-size: 0.85rem;
  color: #e0e4e8;

  display: flex;
  justify-content: space-between;
  align-items: center;

  z-index: 9900;
}

#game-header .game-header-text {
  white-space: nowrap;
}

#patch-notes-btn {
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: inherit;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
}

#patch-notes-btn:hover {
  border-color: #4f8cff;
}

/* === Patch notes modal === */
#patch-notes-panel[hidden] {
  display: none !important;
}

.patch-notes-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.patch-notes-dialog {
  background: #141414;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 1.0rem 1.25rem;
  max-width: 1000px;
  width: calc(100% - 2rem);
  max-height: 80vh;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65);
  font-size: 0.9rem;
  overflow: auto;
}

.patch-notes-dialog ul {
  margin: 0 0 1rem 1.1rem;
  padding: 0;
  list-style-position: inside;
}

.patch-notes-dialog h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.patch-notes-dialog button {
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #3a3a3a;
  background: #202020;
  color: inherit;
  padding: 0.25rem 0.7rem;
  font-size: 0.85rem;
}

.patch-notes-dialog button:hover {
  border-color: #4f8cff;
}

/* === Patch notes content formatting (renders markdown-ish HTML) === */
#patch-notes-content {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  max-height: 55vh;
  overflow: auto;
}

#patch-notes-content h3 {
  margin: 10px 0 8px;
  font-size: 16px;
  font-weight: 700;
}

#patch-notes-content h4 {
  margin: 10px 0 6px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0.95;
}

#patch-notes-content p {
  margin: 6px 0;
  opacity: 0.95;
}

#patch-notes-content ul {
  margin: 6px 0 10px 18px;
  padding: 0;
}

#patch-notes-content li {
  margin: 4px 0;
}

#patch-notes-content .pn-spacer {
  height: 8px;
}

/* Floating tooltip (used everywhere) */
#tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 300px;
  background: #111;
  color: #e0e4e8;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  font-size: 0.9rem;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .08s ease, transform .08s ease;
}

#tooltip strong {
  display: inline;
  font-weight: 700;
  color: #fff;
  margin: 0;
  padding: 0;
}

#tooltip .rarity {
  display: inline;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2;
}

#tooltip.show {
  opacity: 1;
  transform: translateY(0);
}
