/* ============================================================
   Tavern Roll — Stylesheet
   Aesthetic: candlelit tavern, aged parchment, brass accents.
   ============================================================ */

:root {
  --bg-deep:      #15110c;
  --bg:           #1d1812;
  --bg-elev:     #2a2218;
  --bg-elev-2:    #352a1c;
  --border:       #4a3a23;
  --border-soft:  #3a2d1c;
  --parchment:    #e8d8b0;
  --parchment-dim:#bfae87;
  --ink:          #1a1208;
  --gold:         #d4a857;
  --gold-bright:  #f0c870;
  --blood:        #a13b2c;
  --moss:         #5d7d4e;
  --rare-blue:    #5b8fd9;
  --epic-purple:  #a978d4;
  --legend-gold:  #f0b440;

  --font-display: 'Cinzel', serif;
  --font-body:    'Crimson Pro', Georgia, serif;
  --font-mono:    'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--parchment);
  font-size: 16px;
  line-height: 1.5;
}

body {
  background:
    radial-gradient(ellipse at top, rgba(212, 168, 87, 0.08), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(161, 59, 44, 0.05), transparent 60%),
    var(--bg-deep);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ============ SCREEN LAYOUT ============ */
.screen { min-height: 100vh; }

/* ============ AUTH SCREEN ============ */
#screen-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow:
    0 0 60px rgba(212, 168, 87, 0.08),
    inset 0 0 30px rgba(0, 0, 0, 0.3);
  position: relative;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  pointer-events: none;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 38px;
  color: var(--gold);
  text-align: center;
  letter-spacing: 0.04em;
  text-shadow: 0 0 20px rgba(212, 168, 87, 0.3);
  margin-bottom: 8px;
}

.tagline {
  text-align: center;
  font-style: italic;
  color: var(--parchment-dim);
  margin-bottom: 28px;
}

.tabs { display: flex; gap: 0; margin-bottom: 22px; border-bottom: 1px solid var(--border-soft); }
.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--parchment-dim);
  font-family: var(--font-display);
  font-size: 14px;
  padding: 10px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: color 0.15s;
}
.tab.active {
  color: var(--gold-bright);
  border-bottom: 2px solid var(--gold);
}
.tab:hover { color: var(--gold-bright); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input, form input, form select, form textarea {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 3px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:focus, form input:focus, form select:focus, form textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}

button[type="submit"], .btn-accent {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--ink);
  border: 1px solid #8a6a30;
  padding: 12px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s;
}
button[type="submit"]:hover, .btn-accent:hover { filter: brightness(1.1); }
button[type="submit"]:active, .btn-accent:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--parchment-dim);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: 3px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--gold-bright); border-color: var(--gold); }

.error {
  color: var(--blood);
  margin-top: 14px;
  text-align: center;
  font-style: italic;
  min-height: 1.2em;
}

/* ============ TOPBAR ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand-sm {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 0.05em;
}
.user-info { display: flex; align-items: center; gap: 14px; color: var(--parchment-dim); }
.badge {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--gold-bright);
  padding: 3px 10px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}

/* ============ LOBBY ============ */
.lobby-grid {
  max-width: 900px;
  margin: 30px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 24px;
  position: relative;
}
.panel.full { grid-column: 1 / -1; }
.panel h2 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}
.panel form { display: flex; gap: 10px; }
.panel form input { flex: 1; }

.room-list { list-style: none; }
.room-list li {
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  margin-bottom: 8px;
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.room-list li:hover { border-color: var(--gold); transform: translateX(2px); }
.room-list .room-meta { font-size: 13px; color: var(--parchment-dim); }
.room-list .role-tag {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.06em;
  background: var(--blood);
  color: var(--parchment);
  padding: 2px 8px;
  border-radius: 2px;
}
.room-list .role-tag.player { background: var(--moss); }

/* ============ GAME GRID ============ */
.game-grid {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
}

@media (max-width: 1100px) {
  .game-grid { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; height: auto; }
}

.side-panel, .chat-panel, .right-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.side-panel { padding: 16px; gap: 18px; overflow-y: auto; }
.panel-section h3 {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 6px;
}

.members-list, .items-list { list-style: none; }
.members-list li {
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.members-list .dm-mark { color: var(--blood); font-family: var(--font-display); font-size: 11px; }

.items-list li {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--parchment-dim);
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 2px;
  font-size: 13px;
}
.items-list li.rarity-uncommon { border-left-color: var(--moss); }
.items-list li.rarity-rare      { border-left-color: var(--rare-blue); }
.items-list li.rarity-epic      { border-left-color: var(--epic-purple); }
.items-list li.rarity-legendary { border-left-color: var(--legend-gold); box-shadow: 0 0 8px rgba(240, 180, 64, 0.2); }
.items-list .item-name { font-family: var(--font-display); font-size: 13px; color: var(--gold-bright); }
.items-list .item-desc { font-style: italic; color: var(--parchment-dim); font-size: 12px; margin-top: 3px; }

/* ============ CHAT ============ */
.chat-panel { padding: 0; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-track { background: var(--bg); }
.chat-log::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.msg {
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--bg);
  border-left: 3px solid var(--border);
}
.msg.system {
  background: transparent;
  border-left: none;
  font-style: italic;
  color: var(--parchment-dim);
  text-align: center;
  font-size: 13px;
}
.msg.chat .msg-author {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold-bright);
  margin-right: 8px;
  font-size: 13px;
  letter-spacing: 0.03em;
}
.msg.chat .msg-time { font-size: 11px; color: var(--parchment-dim); margin-left: 6px; }

.msg.roll {
  border-left-color: var(--gold);
  background: linear-gradient(90deg, rgba(212, 168, 87, 0.1), transparent);
}
.msg.roll .roll-total {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-bright);
  font-weight: 700;
  margin-left: 8px;
}
.msg.roll .roll-detail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--parchment-dim);
  margin-top: 4px;
}

.msg.item {
  border-left-color: var(--epic-purple);
  background: linear-gradient(90deg, rgba(169, 120, 212, 0.12), transparent);
}
.msg.item .item-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.msg.item .item-icon { font-size: 28px; }
.msg.item .item-title { font-family: var(--font-display); color: var(--gold-bright); font-size: 16px; }
.msg.item .item-meta { font-size: 12px; color: var(--parchment-dim); font-style: italic; }
.msg.item .item-body { font-size: 14px; margin-top: 4px; }

.chat-form {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
}
.chat-form input { flex: 1; }

.chat-hint {
  padding: 6px 14px 12px;
  font-size: 11px;
  color: var(--parchment-dim);
  background: var(--bg);
  border-top: 1px solid var(--border-soft);
}
.chat-hint code {
  background: var(--bg-elev-2);
  padding: 1px 6px;
  border-radius: 2px;
  font-family: var(--font-mono);
  color: var(--gold-bright);
}

/* ============ NOTEBOOK ============ */
/* (notebook background is now applied via .rtab-content[data-rtab-content="notebook"]) */
.notebook-header {
  padding: 12px 14px;
  background: var(--bg-elev);
  color: var(--parchment);
  border-bottom: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.notebook-header h3 {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.05em;
}
.notebook-tabs { display: flex; gap: 4px; }
.ntab {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--parchment-dim);
  font-family: var(--font-display);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 0.05em;
}
.ntab.active { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.note-status { font-size: 11px; color: var(--parchment-dim); font-style: italic; width: 100%; text-align: right; }

#note-editor {
  flex: 1;
  background: transparent;
  border: none;
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  resize: none;
  outline: none;
  line-height: 1.6;
}
.note-preview {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
}
.note-preview h1, .note-preview h2, .note-preview h3 {
  font-family: var(--font-display);
  color: #6a4a18;
  margin-top: 0.8em;
  margin-bottom: 0.4em;
}
.note-preview h1 { border-bottom: 1px solid #8a6a30; padding-bottom: 4px; }
.note-preview ul, .note-preview ol { padding-left: 22px; margin: 6px 0; }
.note-preview code { background: rgba(0,0,0,0.1); padding: 1px 5px; border-radius: 2px; font-family: var(--font-mono); font-size: 13px; }
.note-preview blockquote { border-left: 3px solid #8a6a30; padding-left: 10px; color: #5a4216; font-style: italic; margin: 10px 0; }
.note-preview hr { border: none; border-top: 1px dashed #8a6a30; margin: 14px 0; }

/* ============ MODAL ============ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 28px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 0 60px rgba(212, 168, 87, 0.15);
}
.modal-content h2 {
  font-family: var(--font-display);
  color: var(--gold);
  margin-bottom: 18px;
  letter-spacing: 0.04em;
}
.modal-content form { display: flex; flex-direction: column; gap: 14px; }
.modal-content label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--parchment-dim); font-family: var(--font-display); letter-spacing: 0.04em; }
.modal-content textarea { min-height: 80px; resize: vertical; }
.modal-buttons { display: flex; gap: 10px; justify-content: flex-end; }

/* ============ v0.2 ADDITIONS ============ */

/* Rename notebook-panel container to right-panel; keep same look */
.right-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top tab bar (Notebook | My Character) */
.right-tabs {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.rtab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--parchment-dim);
  font-family: var(--font-display);
  font-size: 12px;
  padding: 12px 10px;
  cursor: pointer;
  letter-spacing: 0.05em;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.rtab:hover { color: var(--gold-bright); }
.rtab.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
  background: var(--bg-elev);
}

.rtab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.rtab-content.hidden { display: none; }

/* Notebook content takes parchment look only on its own panel area */
.rtab-content[data-rtab-content="notebook"] {
  background: linear-gradient(180deg, #e8d8b0, #d8c69a);
  color: var(--ink);
}

/* Inventory tweaks */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.section-header-row h3 {
  border: none;
  margin: 0;
  padding: 0;
}
.count-badge {
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.items-list li {
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
}
.items-list li:hover {
  transform: translateX(3px);
  border-color: var(--gold);
}

/* Item detail modal */
.item-detail-content {
  max-width: 520px;
}
.item-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.item-detail-icon { font-size: 42px; }
.item-detail-name {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--gold-bright);
  letter-spacing: 0.03em;
}
.item-detail-rarity {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}
.rarity-tag-common     { color: var(--parchment-dim); }
.rarity-tag-uncommon   { color: var(--moss); }
.rarity-tag-rare       { color: var(--rare-blue); }
.rarity-tag-epic       { color: var(--epic-purple); }
.rarity-tag-legendary  { color: var(--legend-gold); text-shadow: 0 0 8px rgba(240, 180, 64, 0.4); }

.item-detail-desc {
  font-size: 15px;
  line-height: 1.7;
  color: var(--parchment);
  font-style: italic;
  padding: 8px 0 16px;
}
.item-detail-meta {
  font-size: 12px;
  color: var(--parchment-dim);
  margin-bottom: 16px;
}

/* Character sheet tab */
.sheet-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  gap: 14px;
  color: var(--parchment-dim);
}
.sheet-empty-icon {
  font-size: 56px;
  opacity: 0.7;
}
.sheet-empty p { font-style: italic; }
.sheet-hint { font-size: 12px; opacity: 0.7; }

.file-label {
  display: inline-block;
  cursor: pointer;
}

.sheet-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sheet-toolbar {
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.sheet-filename {
  font-size: 12px;
  color: var(--parchment-dim);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.sheet-actions { display: flex; gap: 6px; }
.btn-ghost.danger { color: var(--blood); }
.btn-ghost.danger:hover { border-color: var(--blood); color: var(--blood); }

.sheet-iframe {
  flex: 1;
  border: none;
  background: #2a2218;
  width: 100%;
}

/* ============ DICE ANIMATION ============ */

@keyframes diceTumble {
  0%   { transform: rotate(0deg)   scale(1); }
  25%  { transform: rotate(120deg) scale(1.15); }
  50%  { transform: rotate(240deg) scale(0.9); }
  75%  { transform: rotate(340deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes diceSettle {
  0%   { transform: scale(1.3); filter: brightness(1.8); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); filter: brightness(1); }
}

.dice-anim {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  margin: 0 6px;
  box-shadow: 0 4px 0 #8a6a30, 0 0 20px rgba(212, 168, 87, 0.4);
  animation: diceTumble 0.12s linear infinite;
  vertical-align: middle;
}

.dice-anim.settled {
  animation: diceSettle 0.4s ease-out forwards;
}

/* Critical hit / critical miss flair */
.dice-anim.critical {
  background: linear-gradient(135deg, #ffe28a, var(--gold-bright));
  box-shadow: 0 4px 0 #8a6a30, 0 0 30px rgba(240, 200, 100, 0.9);
}
.dice-anim.fumble {
  background: linear-gradient(135deg, #d96a5a, var(--blood));
  color: var(--parchment);
  box-shadow: 0 4px 0 #4a1810, 0 0 25px rgba(161, 59, 44, 0.7);
}

/* While the roll message is animating, blur the final number reveal */
.msg.roll.rolling .roll-total,
.msg.roll.rolling .roll-detail {
  opacity: 0;
  transition: opacity 0.2s;
}
.msg.roll .roll-total,
.msg.roll .roll-detail {
  opacity: 1;
  transition: opacity 0.3s;
}

.critical-banner {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.15em;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 2px;
  text-transform: uppercase;
}
.critical-banner.crit {
  background: var(--gold);
  color: var(--ink);
  animation: diceSettle 0.5s ease-out;
}
.critical-banner.miss {
  background: var(--blood);
  color: var(--parchment);
}

/* File input hidden but still clickable via label */
.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Make label look clickable for the file input */
label.file-label {
  cursor: pointer;
  display: inline-block;
}

/* Dice animation slot needs to be visible inline */
.dice-anim-slot {
  display: inline-block;
  vertical-align: middle;
  min-width: 0;
}

/* Hide the static total while the dice is rolling */
.msg.roll.rolling .roll-total {
  display: none;
}

/* ============ v0.3: ITEM IMAGES & USE ============ */

/* Image preview in forge modal */
.image-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
}
.image-preview-wrap img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Item thumbnail in inventory list */
.items-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.item-thumb {
  width: 38px;
  height: 38px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid var(--border-soft);
  flex-shrink: 0;
  background: var(--bg-deep);
}
.item-thumb-placeholder {
  width: 38px;
  height: 38px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.items-list .item-body-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.items-list .item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Item image in detail modal */
.item-detail-image {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  margin: 8px 0 14px;
}

/* Big item card in chat (for forge + use messages) */
.msg.item .item-image-large,
.msg.item-use .item-image-large {
  width: 100%;
  max-width: 280px;
  max-height: 220px;
  object-fit: contain;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  margin-top: 8px;
  display: block;
}

/* Item-use chat message: a dramatic "card played" look */
.msg.item-use {
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, rgba(212, 168, 87, 0.15), transparent 60%);
  padding: 14px;
}
.msg.item-use .use-header {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--gold-bright);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.msg.item-use .item-title-big {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--gold-bright);
  margin-bottom: 4px;
}
.msg.item-use .item-rarity-line {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.msg.item-use .item-desc-big {
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  color: var(--parchment);
  padding: 8px 0;
  border-top: 1px solid var(--border-soft);
  margin-top: 8px;
}

/* Rarity glow for "use" messages */
.msg.item-use.rarity-legendary { box-shadow: inset 0 0 30px rgba(240, 180, 64, 0.15); border-left-color: var(--legend-gold); }
.msg.item-use.rarity-epic      { border-left-color: var(--epic-purple); }
.msg.item-use.rarity-rare      { border-left-color: var(--rare-blue); }
.msg.item-use.rarity-uncommon  { border-left-color: var(--moss); }

/* Modal buttons: spread them when there are more than 2 */
.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* ============ v0.4: PANEL TOGGLE, SOUND, EDIT ============ */

/* Icon buttons in topbar */
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--parchment-dim);
  width: 34px;
  height: 34px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon:hover { color: var(--gold-bright); border-color: var(--gold); }
.btn-icon.active {
  background: var(--bg-elev-2);
  color: var(--gold-bright);
  border-color: var(--gold);
}
.btn-icon.muted {
  color: var(--blood);
  opacity: 0.7;
}

/* Wide panel mode: right column becomes wider, chat narrower */
.game-grid.wide-right {
  grid-template-columns: 240px minmax(0, 1fr) minmax(0, 2.2fr);
}

/* Default (already in v0.1): grid-template-columns: 260px 1fr 320px */
/* Wide-right gives the right panel roughly twice the chat's width */

@media (max-width: 1100px) {
  .game-grid.wide-right {
    grid-template-columns: 1fr;
  }
}

/* DM-only buttons hide by default; the JS adds .visible when role==dm */
.dm-only { display: none !important; }
.is-dm .dm-only { display: inline-block !important; }
.is-dm .dm-only.hidden { display: none !important; } /* still respect explicit hidden */

/* When forge-modal is in edit mode, hide the recipient picker */
.modal-content.edit-mode #forge-target-label { display: none; }

/* Tighter modal buttons row when many buttons */
.modal-buttons {
  flex-wrap: wrap;
}

.clickable-item-card {
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.clickable-item-card:hover {
  filter: brightness(1.15);
}
.clickable-item-card:active {
  transform: scale(0.99);
}
