/* Auto DM — console UI (Phase 26). Dark, monospace, terminal feel. */

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

html, body {
  height: 100%;
  background: #0c0e14;
  color: #d4d4d4;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #2a2e39;
  margin-bottom: 1rem;
}

header h1 {
  font-size: 1.1rem;
  color: #c89b3c;
  letter-spacing: 0.05em;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #888;
}

.screen {
  background: #131720;
  border: 1px solid #2a2e39;
  border-radius: 6px;
  padding: 1rem;
}

.screen + .screen {
  margin-top: 1rem;
}

input[type="text"],
input[type="password"],
select,
textarea {
  flex: 1;
  background: #0c0e14;
  border: 1px solid #2a2e39;
  color: #d4d4d4;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: inherit;
}

textarea {
  display: block;
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #c89b3c;
}

button {
  background: #c89b3c;
  color: #0c0e14;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #d4ab4e;
}

button:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
}

.row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.msg {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.msg.error {
  color: #e06c75;
}

.msg.ok {
  color: #98c379;
}

/* Output / game log */
.output {
  flex: 1;
  overflow-y: auto;
  overflow-wrap: anywhere;
  background: #0a0c12;
  border: 1px solid #2a2e39;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  white-space: pre-wrap;
  font-size: 13px;
}

.entry {
  margin-bottom: 0.5rem;
}

.entry .who {
  color: #888;
  font-size: 0.85em;
  margin-right: 0.5rem;
}

.entry.narration .body {
  color: #d4d4d4;
}

.entry.player .body {
  color: #98c379;
}

.entry.system .body {
  color: #888;
  font-style: italic;
}

.entry.companion .body {
  color: #c89b3c;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.game-top {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0.5rem;
}

.table-tools {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sheet-panel,
.roll-panel {
  background: #0a0c12;
  border: 1px solid #2a2e39;
  border-radius: 4px;
  padding: 0.75rem;
}

/* Phase 36: tabs for the player character + each companion inside
   #table-tools. The sheet-panel that follows holds N <div class=
   "sheet-view"> elements — only .sheet-view.active is visible. */
.sheet-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.char-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  background: #0a0c12;
  border: 1px solid #2a2e39;
  border-radius: 4px;
}

.char-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: #8f96a3;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  font-size: 0.78rem;
  line-height: 1.2;
  padding: 0.3rem 0.55rem;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.char-tab:hover:not(:disabled):not(.active) {
  background: rgba(200, 155, 60, 0.08);
  color: #d4d4d4;
}

.char-tab.active {
  background: #1a1e28;
  border-color: #c89b3c;
  color: #e8e8e8;
}

.char-tab .tab-name {
  font-weight: 600;
  color: inherit;
}

.char-tab .tab-meta {
  font-size: 0.7rem;
  opacity: 0.75;
}

.char-tab .tab-tag {
  font-size: 0.65rem;
  background: #c89b3c;
  border-radius: 2px;
  color: #0a0c12;
  font-weight: 700;
  margin-top: 0.15rem;
  padding: 0.05rem 0.35rem;
  text-transform: uppercase;
}

.sheet-host {
  display: contents; /* allow .sheet-panel padding to remain on parent */
}

.sheet-view {
  display: none;
}

.sheet-view.active {
  display: block;
}

.sheet-view.is-player .sheet-head strong::before {
  content: "⚔";
  color: #c89b3c;
  margin-right: 0.35rem;
}

.sheet-conds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.cond-pill {
  background: #5c2a2a;
  border: 1px solid #8a3a3a;
  border-radius: 3px;
  color: #f0c0c0;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
}

/* Phase 37: spells + inventory sections inside each sheet view. They
   reuse the generic .sheet-meta typography but need their own hooks
   for the inline pill / count / rarity-dot styling. */
.sheet-spells strong {
  color: #c89b3c;
}

.sheet-spells em {
  color: #d4d4d4;
  font-style: normal;
  font-weight: 600;
}

.sheet-inv strong {
  color: #c89b3c;
}

.inv-item {
  white-space: nowrap;
}

.inv-qty {
  color: #c89b3c;
  font-weight: 600;
  font-size: 0.78rem;
}

.inv-magic {
  color: #6f8cd6;  /* default to "uncommon" blue; rarity tooltip carries the precise tier */
  font-size: 0.7rem;
  margin-left: 0.2rem;
}

.sheet-panel summary {
  cursor: pointer;
  color: #c89b3c;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.sheet-head strong {
  color: #e8e8e8;
}

.sheet-head span,
.sheet-meta {
  color: #8f96a3;
  font-size: 0.82rem;
}

.sheet-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0.55rem 0;
}

.sheet-stat {
  min-width: 0;
  background: #131720;
  border: 1px solid #1f2330;
  border-radius: 4px;
  padding: 0.35rem 0.25rem;
  text-align: center;
}

.sheet-stat span,
.sheet-stat em {
  display: block;
  color: #8f96a3;
  font-size: 0.72rem;
  font-style: normal;
}

.sheet-stat strong {
  display: block;
  color: #d4d4d4;
  font-size: 1rem;
  line-height: 1.2;
}

.roll-panel label {
  display: block;
}

.roll-panel .lbl {
  display: block;
  color: #8f96a3;
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.roll-panel select {
  width: 100%;
}

.roll-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0;
  color: #d4d4d4;
  font-size: 0.85rem;
}

.roll-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.roll-preview {
  min-height: 1.2rem;
  color: #98c379;
  font-size: 0.82rem;
  margin-bottom: 0.55rem;
  overflow-wrap: anywhere;
}

.roll-panel button {
  width: 100%;
}

.input-row input {
  flex: 1;
}

.hints {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #666;
}

.hints code {
  background: #1a1e28;
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
  color: #c89b3c;
  margin-right: 0.3rem;
}

.play-guide {
  margin-top: 0.75rem;
  border: 1px solid #2a2e39;
  border-radius: 6px;
  background: #0f131b;
}

.play-guide summary {
  cursor: pointer;
  padding: 0.65rem 0.75rem;
  color: #d4d4d4;
  font-weight: 600;
  user-select: none;
}

.play-guide[open] summary {
  border-bottom: 1px solid #2a2e39;
  color: #c89b3c;
}

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

.guide-grid section {
  min-width: 0;
}

.guide-grid h3 {
  margin-bottom: 0.45rem;
  color: #98c379;
  font-size: 0.9rem;
}

.guide-grid ol {
  padding-left: 1.15rem;
  color: #aeb4bf;
  font-size: 0.84rem;
}

.guide-grid li {
  margin-bottom: 0.35rem;
}

.guide-grid code,
.command-list code {
  color: #c89b3c;
  background: #1a1e28;
  border-radius: 2px;
  padding: 0.05rem 0.25rem;
}

.command-list {
  display: grid;
  gap: 0.45rem;
}

.command-list div {
  display: grid;
  grid-template-columns: minmax(7.5rem, auto) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
}

.command-list dt,
.command-list dd {
  min-width: 0;
}

.command-list dd {
  color: #aeb4bf;
  font-size: 0.82rem;
}

.command-chip {
  width: 100%;
  text-align: left;
  background: #1a1e28;
  color: #c89b3c;
  border-color: #2a2e39;
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.command-chip:hover {
  background: #242a36;
  border-color: #c89b3c;
}

.lobby-divider {
  border: none;
  border-top: 1px solid #1a1e28;
  margin: 1.25rem 0;
}

/* ============================================================================
   Wizard (Phase 26c)
   ============================================================================ */

.wizard-step {
  display: none;
}
.wizard-step.active {
  display: block;
}

.wizard-progress {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.wizard-progress .dot {
  flex: 1;
  height: 4px;
  background: #1a1e28;
  border-radius: 2px;
}
.wizard-progress .dot.done {
  background: #98c379;
}
.wizard-progress .dot.active {
  background: #c89b3c;
}

.wizard-step h2 {
  font-size: 1.05rem;
  color: #c89b3c;
  margin-bottom: 0.75rem;
}

.wizard-step label {
  display: block;
  margin-bottom: 0.75rem;
}
.wizard-step label .lbl {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.25rem;
}

/* Phase 35: ✨ AI name-suggestion buttons inside the wizard's name inputs. */
.input-with-ai {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}
.input-with-ai input {
  flex: 1 1 auto;
  min-width: 0;
}
.ai-suggest-btn {
  flex: 0 0 auto;
  background: #2a2519;
  border: 1px solid #c89b3c;
  color: #c89b3c;
  border-radius: 4px;
  padding: 0 0.6rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
}
.ai-suggest-btn:hover:not(:disabled) {
  background: #3a321e;
}
.ai-suggest-btn:active:not(:disabled) {
  transform: scale(0.94);
}
.ai-suggest-btn:disabled {
  cursor: default;
  opacity: 0.7;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
}

.choice {
  background: #1a1e28;
  border: 1px solid #2a2e39;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.1s;
}
.choice:hover {
  border-color: #c89b3c;
}
.choice.selected {
  border-color: #c89b3c;
  background: #2a2519;
}
.choice .name {
  font-weight: 600;
  color: #d4d4d4;
  margin-bottom: 0.25rem;
}
.choice .desc {
  font-size: 0.8rem;
  color: #888;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #1a1e28;
}
.wizard-nav button.secondary {
  background: #2a2e39;
  color: #d4d4d4;
}
.wizard-nav button.secondary:hover {
  background: #3a3e49;
}

.summary-block {
  background: #0a0c12;
  border: 1px solid #2a2e39;
  border-radius: 4px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.summary-block .row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.summary-block .key {
  color: #888;
  width: 8em;
  flex-shrink: 0;
}
.summary-block .val {
  color: #d4d4d4;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.25rem 0.75rem;
}
.skills-grid label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}
.skills-grid label:hover {
  background: #1a1e28;
}
.skills-grid input[type="checkbox"] {
  margin: 0;
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.25rem 0.75rem;
}
.checkbox-list label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}
.checkbox-list label:hover {
  background: #1a1e28;
}
.checkbox-list input {
  margin: 0;
}

.spell-picker {
  display: grid;
  gap: 0.9rem;
}
.spell-section h3 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: #d4d4d4;
}
.spell-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.25rem 0.75rem;
}
.spell-list label {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}
.spell-list label:hover {
  background: #1a1e28;
}
.spell-list input {
  margin-top: 0.2rem;
}
.spell-name {
  display: block;
  color: #d4d4d4;
}
.spell-meta {
  display: block;
  font-size: 0.78rem;
  color: #888;
}

/* --- Phase 28: input-blocking + busy feedback --- */
input[type="text"]:disabled,
input[type="password"]:disabled,
select:disabled {
  background: #1a1e28;
  color: #666;
  cursor: not-allowed;
}

.typing-indicator {
  color: #888;
  font-style: italic;
}
.typing-indicator .body {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}
.typing-indicator .dot {
  width: 6px;
  height: 6px;
  background: #888;
  border-radius: 50%;
  display: inline-block;
  animation: typing-bounce 1.2s infinite ease-in-out both;
}
.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.30s;
}

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-4px); opacity: 1; }
}

/* Admin: owner tag on save rows + danger (delete) button */
.slug-row .owner {
  color: #8ab4f8;
  font-weight: 600;
}
button.danger {
  background: #b3261e;
  color: #fff;
}
button.danger:hover {
  background: #c0392b;
}

/* ============================================================ */
/* Phase 30 — Admin panel                                       */
/* ============================================================ */
.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.admin-card {
  background: #131720;
  border: 1px solid #2a2e39;
  border-radius: 6px;
  padding: 0.75rem;
}
.admin-card-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: #c89b3c;
}
.admin-card-lbl {
  color: #888;
  font-size: 0.8rem;
  margin-top: 0.15rem;
}
.admin-table-wrap {
  overflow-x: auto;
  margin: 0.5rem 0;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #2a2e39;
  vertical-align: top;
}
.admin-table th {
  color: #888;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
button.mini {
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  border-radius: 4px;
}
.tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
}
.tag-on    { background: #1f3d2a; color: #98c379; }
.tag-off   { background: #3d1f24; color: #e06c75; }
.tag-unlim { background: #3d341f; color: #c89b3c; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-card {
  background: #131720;
  border: 1px solid #2a2e39;
  border-radius: 8px;
  padding: 1rem;
  width: min(420px, 92vw);
}
.modal-card label {
  display: block;
  margin: 0.5rem 0;
}
.modal-card .lbl {
  display: block;
  color: #888;
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}
.modal-card input,
.modal-card select {
  width: 100%;
}

/* ============================================================ */
/* Phase 38 — XP banner + ASI modal                              */
/* ============================================================ */

.levelup-banner {
  background: #1a1e28;
  border: 1px solid #c89b3c;
  border-radius: 6px;
  color: #c89b3c;
  font-size: 0.85rem;
  margin: 0 0 0.5rem 0;
  padding: 0.4rem 0.75rem;
}

#asi-modal .modal-card {
  width: min(520px, 92vw);
}

.asi-mode-row {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 0.9rem;
}

.asi-status {
  color: #888;
  font-size: 0.85rem;
  margin: 0.4rem 0;
}

.asi-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}

.asi-pick {
  align-items: center;
  background: #1a1e28;
  border: 1px solid #2a2e39;
  border-radius: 4px;
  display: flex;
  font-size: 0.85rem;
  margin: 0 !important;
  padding: 0.45rem 0.6rem;
}

.asi-pick input {
  margin-right: 0.5rem;
  width: auto !important;
}

#asi-modal #asi-confirm {
  margin-top: 0.5rem;
}

/* Detail drawer */
.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) {
  .admin-detail-grid { grid-template-columns: 1fr; }
}
.admin-list {
  list-style: none;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.85rem;
}
.admin-list li {
  padding: 0.3rem 0;
  border-bottom: 1px solid #1f2330;
}

/* ============================================================ */
/* Mobile responsiveness                                         */
/* ============================================================ */

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  overflow-x: hidden;
}

button,
input,
select {
  min-width: 0;
}

button {
  min-height: 2.75rem;
  line-height: 1.2;
}

input[type="text"],
input[type="password"],
select {
  min-height: 2.75rem;
}

.row,
.input-row {
  min-width: 0;
}

.row > *,
.input-row > * {
  min-width: 0;
}

#game-screen {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#game-screen .output {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 14rem);
  max-height: calc(100dvh - 14rem);
}

.slug,
.meta,
.choice,
.summary-block .val,
.admin-table td {
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  #app {
    max-width: none;
    width: 100%;
    min-height: 100dvh;
    height: auto;
  }

  .screen {
    width: 100%;
  }

  .admin-table {
    min-width: 760px;
  }
}

@media (max-width: 640px) {
  html,
  body {
    font-size: 14px;
  }

  #app {
    padding: 0.75rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
  }

  header {
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
  }

  header h1 {
    line-height: 2.75rem;
  }

  #user-info {
    justify-content: flex-end;
    flex: 1 1 12rem;
    flex-wrap: wrap;
    min-width: 0;
  }

  #who {
    overflow-wrap: anywhere;
  }

  .screen {
    padding: 0.75rem;
    border-radius: 4px;
  }

  .row {
    flex-direction: column;
    gap: 0.6rem;
  }

  .row button,
  .row input,
  .row select,
  .modal-card button,
  .modal-card input,
  .modal-card select {
    width: 100%;
  }

  input[type="text"],
  input[type="password"],
  select,
  button {
    font-size: 16px;
  }

  #game-screen {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 5.75rem);
  }

  #game-screen .output {
    flex: 1 1 auto;
    min-height: 18rem;
    max-height: calc(100dvh - 16rem);
    padding: 0.75rem;
    font-size: 13px;
  }

  .game-top {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

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

  .sheet-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sheet-head {
    flex-direction: column;
    gap: 0.15rem;
  }

  .game-top button,
  #lobby-btn,
  #admin-back-btn {
    width: 100%;
  }

  .input-row {
    gap: 0.6rem;
  }

  .input-row label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .hints {
    line-height: 1.8;
  }

  .hints code {
    display: inline-block;
    margin-bottom: 0.25rem;
  }

  .guide-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .command-list div {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .command-chip {
    width: auto;
    max-width: 100%;
  }

  .wizard-progress {
    gap: 0.2rem;
  }

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

  .choice {
    padding: 0.65rem;
  }

  .skills-grid,
  .checkbox-list,
  .spell-list {
    grid-template-columns: 1fr;
  }

  .checkbox-list label,
  .skills-grid label,
  .spell-list label {
    align-items: flex-start;
    padding: 0.45rem 0.25rem;
  }

  .wizard-nav {
    position: sticky;
    bottom: 0;
    z-index: 10;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1rem -0.75rem -0.75rem;
    padding: 0.75rem;
    background: #131720;
    border-top: 1px solid #2a2e39;
  }

  .wizard-nav > div {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }

  .wizard-nav button,
  .wizard-nav button.secondary {
    width: 100%;
  }

  #wz-step-counter {
    margin-right: 0 !important;
    text-align: center;
  }

  .summary-block .row {
    flex-direction: row;
    align-items: flex-start;
  }

  .summary-block .key {
    width: 7.5rem;
  }

  .admin-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .admin-card {
    padding: 0.65rem;
  }

  .admin-table-wrap {
    overflow: visible;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .admin-table {
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
  }

  .admin-table thead {
    display: none;
  }

  .admin-table tr {
    background: #11151e;
    border: 1px solid #2a2e39;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    padding: 0.35rem 0;
  }

  .admin-table td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 38%) 1fr;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid #1f2330;
  }

  .admin-table td:last-child {
    border-bottom: none;
  }

  .admin-table td::before {
    color: #888;
    content: "";
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
  }

  .admin-table td:nth-child(1)::before { content: "Usuário"; }
  .admin-table td:nth-child(2)::before { content: "Role"; }
  .admin-table td:nth-child(3)::before { content: "Status"; }
  .admin-table td:nth-child(4)::before { content: "Tokens"; }
  .admin-table td:nth-child(5)::before { content: "Custo"; }
  .admin-table td:nth-child(6)::before { content: "Ações"; }

  .admin-table td[colspan] {
    display: block;
  }

  .admin-table td[colspan]::before {
    content: none;
  }

  .admin-table td.admin-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
  }

  .admin-table td.admin-actions::before {
    flex: 1 1 100%;
  }

  .admin-actions button,
  button.mini {
    flex: 1 1 calc(50% - 0.45rem);
    min-height: 2.4rem;
  }

  .admin-detail-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    align-items: flex-end;
    padding: 0.75rem;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
    overflow-y: auto;
  }
}

@media (max-width: 430px) {
  #app {
    padding-inline: 0.5rem;
  }

  .screen {
    padding: 0.65rem;
  }

  .input-row {
    flex-direction: column;
  }

  .input-row button,
  .input-row input {
    width: 100%;
  }

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

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

  .admin-cards {
    grid-template-columns: 1fr;
  }

  .summary-block .row {
    flex-direction: column;
    gap: 0.15rem;
  }

  .summary-block .key {
    width: auto;
  }

  .admin-actions button,
  button.mini {
    flex-basis: 100%;
  }
}

/* ============================================================================
   Phase 39 — inventário interativo + loja
   ============================================================================ */

.sheet-gold strong,
.sheet-equip strong {
  color: #c89b3c;
}

.equip-pill {
  background: #24304a;
  border: 1px solid #3a4d78;
  border-radius: 3px;
  color: #b9c8ea;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
}

.inv-item-btn {
  background: #1a1e28;
  border: 1px solid #2e3648;
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}

.inv-item-btn:hover {
  border-color: #c89b3c;
}

.inv-attuned {
  color: #c89b3c;
  font-size: 0.72rem;
  margin-left: 0.2rem;
}

.item-desc {
  color: #aab3c5;
  font-size: 0.82rem;
  max-height: 12rem;
  overflow-y: auto;
  white-space: pre-wrap;
}

.item-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.item-equip-row {
  align-items: center;
  display: flex;
  gap: 0.4rem;
}

.shop-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.shop-gold {
  color: #c89b3c;
  font-weight: 600;
  margin: 0.4rem 0;
}

.shop-stock {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 55vh;
  overflow-y: auto;
}

.shop-row {
  align-items: center;
  border-bottom: 1px solid #232a3a;
  display: flex;
  gap: 0.6rem;
  padding: 0.3rem 0;
}

.shop-name {
  flex: 1;
}

.shop-price {
  color: #c89b3c;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Phase 41c — reaction modal. */
#reaction-modal .modal-card {
  width: min(480px, 92vw);
}
.reaction-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.reaction-option {
  text-align: left;
}
.reaction-timer {
  color: #c89b3c;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  margin-right: auto;
}

/* ============================================================ */
/* Phase 42 — TTS + ambient music                                */
/* ============================================================ */

.audio-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}
.audio-btn {
  background: #1a1e28;
  border: 1px solid #2a2e39;
  border-radius: 6px;
  color: #e8e8e8;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
}
.audio-btn:hover:not(:disabled) {
  border-color: #c89b3c;
}
.audio-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.audio-btn.active {
  border-color: #c89b3c;
  color: #c89b3c;
}
.audio-volume {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #888;
}
.audio-volume input[type="range"] {
  width: 80px;
}
