*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  background: #1a1a2e;
  color: #e0e0e0;
}

/* ── Game layout ─────────────────────────────────── */

.game-layout {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 700px;
  margin: 0 auto;
}

.game-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #2a2a4a;
  flex-shrink: 0;
}

.game-header h1 {
  margin: 0;
  font-size: 1.1rem;
  color: #a0a0c0;
}

/* ── Feed filter bar ─────────────────────────────── */

.feed-filter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.875rem;
  background: #0a0c14;
  border-bottom: 1px solid #1e2040;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.feed-filter__label {
  font-size: 0.7rem;
  color: #555;
  margin-right: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.feed-filter__btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  background: transparent;
  border: 1px solid #2a2d5a;
  color: #666;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.feed-filter__btn:hover {
  background: #1e2040;
  color: #a0a8e0;
}

.feed-filter__btn--active {
  background: #1e2040;
  color: #c8d0ff;
  border-color: #4a52a8;
}

/* ── Feed filter — hide non-matching messages ────── */

#message-feed[data-filter="in_character"] .message:not([data-type="in_character"]),
#message-feed[data-filter="ooc"] .message:not([data-type="ooc"]),
#message-feed[data-filter="narrative"] .message:not([data-type="narrative"]),
#message-feed[data-filter="dice"] .message:not([data-type="roll"]):not([data-type="roll_prompt"]) {
  display: none;
}

/* ── Feed ────────────────────────────────────────── */

.feed-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

#message-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feed-empty {
  color: #666;
  text-align: center;
  margin-top: 2rem;
  font-style: italic;
}

/* ── Messages ────────────────────────────────────── */

.message {
  padding: 0.625rem 0.875rem;
  border-radius: 6px;
  background: #16213e;
  border-left: 3px solid #3a3a5a;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message--in_character {
  border-left-color: #2980b9;
  background: #0a1628;
}

.message--ooc {
  border-left-color: #555;
  background: #111318;
  color: #777;
  font-size: 0.875rem;
  font-style: italic;
}

.message--ooc .message__sender {
  color: #555;
}

.message--roll {
  border-left-color: #f39c12;
  background: #1a1400;
}

.message--narrative {
  border-left-color: #8e44ad;
  background: #1a0a2e;
  font-style: italic;
}

.message--system {
  border-left-color: #2ecc71;
  background: #0a1a0f;
  font-size: 0.875rem;
  color: #a0c0a0;
}

.message--roll_prompt {
  border-left-color: #e67e22;
  background: #1a0e00;
  font-size: 0.9rem;
  color: #e0b070;
}

.prompt-banner {
  background: #1a0e00;
  border: 1px solid #e67e22;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin: 0 0.5rem 0.25rem;
  font-size: 0.875rem;
  color: #e0b070;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.prompt-banner__body {
  flex: 1;
  min-width: 0;
}

.prompt-banner__label { font-weight: bold; margin-right: 0.4rem; }
.prompt-banner__context { margin-right: 0.4rem; }
.prompt-banner__suggest { margin-left: 0.4rem; opacity: 0.8; }

.prompt-banner__roll-link {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── GM roll prompt panel (game page) ───────────── */

.gm-prompt-panel {
  margin: 0.25rem 0.5rem 0;
}

.gm-prompt-toggle {
  background: none;
  border: none;
  color: #a0a0c0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 0.25rem 0;
}
.gm-prompt-toggle:hover { color: #e0e0f0; }

.gm-prompt-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0;
}

.gm-prompt-input {
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #3a3a5a;
  background: #0f3460;
  color: #e0e0e0;
  font-size: 0.875rem;
  min-height: 36px;
}
.gm-prompt-input--context { flex: 1; min-width: 10rem; }
.gm-prompt-input--sm { width: 4.5rem; text-align: center; }

.gm-prompt-msg {
  font-size: 0.85rem;
  color: #2ecc71;
  font-style: italic;
}

/* ── Character sheet prompt banner ───────────────── */

.sheet-section--prompt-active {
  border-left: 3px solid #e67e22;
  background: #1a0e00;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}

.sheet-prompt__context {
  color: #e0b070;
  font-size: 0.95rem;
  margin: 0.25rem 0;
}

.sheet-prompt__meta {
  color: #c09050;
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

.sheet-prompt__hint {
  color: #806040;
  font-size: 0.8rem;
  font-style: italic;
  margin: 0.4rem 0 0;
}

/* ── Scene panel (T034/T035) ─────────────────────── */

.scene-panel {
  flex-shrink: 0;
  border-bottom: 1px solid #2a2a4a;
  background: #0a0c14;
}

.scene-panel__image-wrap {
  position: relative;
}

.scene-panel__img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}

.scene-panel__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.375rem 0.75rem;
  background: rgba(0,0,0,0.6);
  font-size: 0.8rem;
  color: #d0d0e0;
  font-style: italic;
}

.scene-panel__controls {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.scene-upload-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.scene-upload-form__label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.scene-upload-form__file {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: #a0a0c0;
}

.scene-upload-form__text {
  flex: 1;
  min-width: 8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #3a3a5a;
  background: #0f1830;
  color: #e0e0e0;
  font-size: 0.8rem;
}

.scene-upload-form__ok  { font-size: 0.8rem; color: #2ecc71; }
.scene-upload-form__error { font-size: 0.8rem; color: #e74c3c; }

/* ── Message type badges (T037) ──────────────────── */

.message__badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  line-height: 1.4;
  vertical-align: middle;
  flex-shrink: 0;
}

.message__badge--in_character { background: #0d3050; color: #5ba8d8; }
.message__badge--ooc          { background: #1a1a1a; color: #666; }
.message__badge--roll         { background: #2a1e00; color: #c8880a; }
.message__badge--narrative    { background: #250a3a; color: #b060d8; }
.message__badge--system       { background: #0a1e0f; color: #2ecc71; }
.message__badge--roll_prompt  { background: #2a1400; color: #e07020; }

.message__meta {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  color: #888;
  flex-wrap: wrap;
}

.message__sender {
  font-weight: 600;
  color: #a0b0e0;
}

.message__content {
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Roll message ────────────────────────────────── */

.message__roll {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.roll-dice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.die {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 4px;
  border: 1px solid #555;
  background: #2a2a2a;
  font-weight: 700;
  font-size: 0.9rem;
  color: #aaa;
  min-width: 44px;
  min-height: 44px;
}

.die--hit {
  background: #1a2e00;
  border-color: #5a9e12;
  color: #8ecc3a;
}

.roll-summary {
  font-size: 0.9rem;
  color: #f39c12;
  font-weight: 600;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.roll-summary__total {
  font-weight: 400;
  color: #888;
  font-size: 0.8rem;
}

.roll-verdict {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}
.roll-verdict--success {
  background: #1a3a1a;
  color: #4caf50;
}
.roll-verdict--failure {
  background: #3a1a1a;
  color: #e57373;
}
.roll-pool-restored {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: #0f2a3a;
  color: #4db8e8;
}

/* ── Post form ───────────────────────────────────── */

.roster-upload-prompt {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid #2a2a4a;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.roster-upload-prompt__msg {
  margin: 0;
  color: #a0a0c0;
  font-size: 0.9rem;
}

.roster-upload-prompt__form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.roster-upload-prompt__error { color: #e06c75; font-size: 0.85rem; }
.roster-upload-prompt__ok    { color: #98c379; font-size: 0.85rem; }

.post-form-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #2a2a4a;
  flex-shrink: 0;
  background: #1a1a2e;
}

.post-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.post-form__name,
.post-form__content {
  padding: 0.5rem 0.625rem;
  border-radius: 4px;
  border: 1px solid #3a3a5a;
  background: #0f3460;
  color: #e0e0e0;
  font-size: 1rem;
  width: 100%;
}

.post-form__content {
  resize: none;
  line-height: 1.4;
  min-height: 44px;
}

.post-form__row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.post-form__row .post-form__content {
  flex: 1;
  width: auto;
}

.post-form__submit {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: none;
  background: #e94560;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 72px;
  flex-shrink: 0;
}

.post-form__submit:hover { background: #c73652; }
.post-form__submit:active { background: #a02a42; }

input:focus,
textarea:focus {
  outline: 2px solid #e94560;
  outline-offset: 1px;
}


/* ── Index page ──────────────────────────────────── */

.index-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  gap: 1rem;
}

.index-page h1 { margin: 0; }

.index-page a {
  color: #e94560;
  text-decoration: none;
  font-size: 1.1rem;
}

.index-page a:hover { text-decoration: underline; }

/* ── Character sheet ─────────────────────────────── */

.sheet-layout {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 700px;
  margin: 0 auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #2a2a4a;
  flex-wrap: wrap;
}

.sheet-back {
  color: #a0a0c0;
  text-decoration: none;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.sheet-back:hover { color: #e0e0e0; }

.sheet-name {
  margin: 0;
  font-size: 1.25rem;
  flex: 1;
}

.pool-display {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.pool-display__label {
  font-size: 0.75rem;
  color: #a0a0c0;
  font-weight: 400;
  margin-right: 0.25rem;
}

.pool-display__value { color: #f39c12; }
.pool-display__sep   { color: #555; }
.pool-display__max   { color: #888; font-weight: 400; font-size: 0.9rem; }

.sheet-main {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sheet-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sheet-identity__input {
  flex: 1;
  padding: 0.5rem 0.625rem;
  border-radius: 4px;
  border: 1px solid #3a3a5a;
  background: #0f3460;
  color: #e0e0e0;
  font-size: 0.9rem;
  max-width: 280px;
}

.sheet-identity__input:focus {
  outline: 2px solid #e94560;
  outline-offset: 1px;
}

.save-indicator {
  font-size: 0.8rem;
  color: #a0c0a0;
  font-style: italic;
}

.sheet-section {
  background: #16213e;
  border-radius: 6px;
  padding: 1rem;
  border-left: 3px solid #3a3a5a;
}

.sheet-section__title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a0a0c0;
}

/* Traits */

.trait-block { margin-bottom: 0.875rem; }
.trait-block:last-child { margin-bottom: 0; }

.trait-name {
  margin: 0 0 0.375rem;
  font-size: 1rem;
  color: #c0c8f0;
}

.tag-list,
.condition-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* Toggle labels (tags and conditions) */

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: 4px;
  border: 1px solid #3a3a5a;
  background: #1a1a2e;
  cursor: pointer;
  font-size: 0.875rem;
  min-height: 44px;
  user-select: none;
  transition: border-color 0.1s, background 0.1s;
}

.toggle-label:hover { border-color: #6a6a9a; }

.toggle-label__checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: #e94560;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-label__text { line-height: 1.3; }

/* Unlocked tags (checked = available) get a subtle highlight */
.toggle-label:has(.toggle-label__checkbox:checked) {
  background: #0d1b2a;
  border-color: #3a5a7a;
}

/* Active conditions are highlighted amber */
.toggle-label--condition:has(.toggle-label__checkbox:checked) {
  background: #1a1000;
  border-color: #c0850a;
  color: #f0b030;
  text-decoration: none;
}

/* Keys */

.key-item,
.secret-item {
  margin-bottom: 0.875rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid #2a2a4a;
}

.key-item:last-child,
.secret-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.key-name,
.secret-name {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: #c0c8f0;
}

.key-desc,
.secret-desc {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  color: #a0a0c0;
  line-height: 1.5;
}

.key-hits {
  margin: 0;
  font-size: 0.8rem;
  color: #888;
}

/* ── Shared button base ──────────────────────────── */

.btn {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.1s, opacity 0.1s;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn--roll {
  background: #e94560;
  color: #fff;
}
.btn--roll:hover:not(:disabled) { background: #c73652; }
.btn--roll:active:not(:disabled) { background: #a02a42; }

.btn--reset {
  background: #2a2a4a;
  color: #a0a0c0;
}
.btn--reset:hover:not(:disabled) { background: #3a3a6a; }

.btn--refresh {
  background: #0f3460;
  color: #a0c8ff;
  border: 1px solid #2a5090;
}
.btn--refresh:hover:not(:disabled) { background: #1a4880; }

.btn--help {
  background: #2e4a1e;
  color: #8ecc3a;
  border: 1px solid #4a7a2e;
}
.btn--help:hover:not(:disabled) { background: #3e6a2a; }

.btn--sm {
  padding: 0.25rem 0.625rem;
  min-height: 36px;
  font-size: 1rem;
  font-weight: 700;
  background: #2a2a4a;
  color: #c0c0e0;
  border: 1px solid #3a3a6a;
}
.btn--sm:hover:not(:disabled) { background: #3a3a6a; }

/* ── Pool actions (refresh, help) ────────────────── */

.pool-action-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

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

.pool-action-label {
  font-size: 0.875rem;
  color: #a0a0c0;
  flex-shrink: 0;
}

.pool-action-input {
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #3a3a5a;
  background: #0f3460;
  color: #e0e0e0;
  font-size: 0.9rem;
  min-height: 44px;
  text-align: center;
}

.pool-action-input--char { width: 5rem; }
.pool-action-input--dice { width: 4rem; }

.pool-action-msg {
  font-size: 0.85rem;
  color: #a0c0a0;
  font-style: italic;
}

.pool-pending {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: #f39c12;
}

/* ── Pool builder ────────────────────────────────── */

.pool-builder-breakdown {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.pool-breakdown__term {
  font-weight: 700;
  color: #f0c040;
}

.pool-breakdown__label {
  font-size: 0.75rem;
  color: #888;
}

.pool-breakdown__op {
  color: #666;
  font-weight: 400;
}

.pool-breakdown__total {
  color: #f39c12;
  font-size: 1.1rem;
}

.pool-builder-controls {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.pool-spend-control {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.pool-spend-control__label {
  font-size: 0.8rem;
  color: #a0a0c0;
  white-space: nowrap;
}

.pool-spend-control__value {
  display: inline-block;
  min-width: 1.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
}

/* ── Pool add buttons (trait/tag selectors) ──────── */

.trait-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.pool-add-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #3a5a3a;
  background: #1a2e1a;
  color: #8ecc3a;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  flex-shrink: 0;
}

.pool-add-btn:hover:not(:disabled) {
  background: #2a4a2a;
  border-color: #5a8a3a;
}

.pool-add-btn--active {
  background: #2a4a10;
  border-color: #8ecc3a;
  color: #c0f060;
}

.pool-add-btn--locked,
.pool-add-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── Character roster bar (game feed) ────────────── */

.roster-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #2a2a4a;
  background: #12122a;
  flex-shrink: 0;
}

.roster-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  background: #1e1e3a;
  border: 1px solid #3a3a5a;
  text-decoration: none;
  color: inherit;
  font-size: 0.8rem;
  min-width: 60px;
  text-align: center;
  transition: border-color 0.15s;
}

.roster-bar__item:hover { border-color: #e94560; }
.roster-bar__name { font-weight: 600; color: #c0c8f0; font-size: 0.8rem; }
.roster-bar__pool { color: #f39c12; font-size: 0.75rem; }
.roster-bar__player { color: #777; font-size: 0.7rem; }

.roster-bar__manage {
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  background: #2a1a3a;
  border: 1px solid #8e44ad;
  color: #c070e0;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
}

.roster-bar__manage:hover { background: #3a2a4a; }

/* ── Manage page ─────────────────────────────────── */

.manage-layout { max-width: 700px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.manage-header { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid #2a2a4a; }
.manage-back { color: #a0a0c0; text-decoration: none; font-size: 0.875rem; }
.manage-back:hover { color: #e0e0e0; }
.manage-title { margin: 0; font-size: 1.1rem; color: #c0c8f0; }
.manage-main { padding: 1rem; display: flex; flex-direction: column; gap: 2rem; }
.manage-section { display: flex; flex-direction: column; gap: 0.75rem; }
.manage-section__title { margin: 0; font-size: 1rem; color: #a0a0c0; border-bottom: 1px solid #2a2a4a; padding-bottom: 0.375rem; }

.manage-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.manage-table th, .manage-table td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid #2a2a4a; }
.manage-table th { color: #888; font-weight: 600; }
.manage-table a { color: #e94560; text-decoration: none; }
.manage-table a:hover { text-decoration: underline; }
.manage-table__none { color: #555; }
.manage-table__invite-label { color: #2ecc71; font-size: 0.8rem; }

.manage-form-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.manage-input { flex: 1; min-width: 160px; padding: 0.5rem 0.625rem; border-radius: 4px; border: 1px solid #3a3a5a; background: #0f3460; color: #e0e0e0; font-size: 0.9rem; }
.manage-input--sm { flex: 0 0 80px; min-width: 60px; }

.manage-invite-url { display: flex; align-items: center; gap: 0.5rem; background: #0a1a0f; border: 1px solid #2ecc71; border-radius: 4px; padding: 0.5rem 0.75rem; }
.manage-invite-url__label { color: #2ecc71; font-size: 0.8rem; white-space: nowrap; }
.manage-invite-url__input { flex: 1; background: transparent; border: none; color: #e0e0e0; font-size: 0.875rem; }

.manage-empty { color: #555; font-style: italic; margin: 0; }
.manage-error { color: #e06c75; font-size: 0.875rem; margin: 0; }
.manage-ok    { color: #98c379; font-size: 0.875rem; margin: 0; }
.manage-list { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.25rem; }
.manage-list a { color: #e94560; text-decoration: none; }
.manage-list a:hover { text-decoration: underline; }

.btn--danger { background: #c0392b; color: #fff; border: none; border-radius: 4px; padding: 0.3rem 0.75rem; cursor: pointer; font-size: 0.8rem; }
.btn--danger:hover { background: #a93226; }
.btn--primary { background: #e94560; color: #fff; border: none; border-radius: 4px; padding: 0.5rem 1rem; cursor: pointer; font-size: 0.9rem; white-space: nowrap; }
.btn--primary:hover:not(:disabled) { background: #c73652; }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* T028h: XP tracker */
.sheet-section--xp {}
.xp-count { font-size: 0.85rem; color: #888; font-weight: normal; }
.xp-track { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.xp-box-label { display: flex; align-items: center; cursor: pointer; }
.xp-box { width: 1.1rem; height: 1.1rem; accent-color: #e94560; cursor: pointer; }
.xp-box:disabled { cursor: not-allowed; opacity: 0.5; }

/* T028j: Secret used/unlocked state */
.secret-header { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.secret-item--locked { opacity: 0.55; }
.secret-lock-icon { font-size: 0.85rem; margin-right: 0.25rem; }
.secret-used-label { display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; white-space: nowrap; }
.secret-desc--locked { font-style: italic; color: #555; }

/* T028k: XP spend panel */
.sheet-section--xp-spend { padding-top: 0.25rem; }
.xp-panel-toggle { margin-bottom: 0.5rem; }
.xp-spend-panel { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem; background: #0d1b2a; border: 1px solid #2a2a4a; border-radius: 6px; }
.xp-spend-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.xp-spend-cost { font-weight: 700; color: #e94560; min-width: 3.5rem; font-size: 0.875rem; }
.xp-spend-label { flex: 1; font-size: 0.875rem; color: #c0c0d0; }
.xp-sub-panel { padding: 0.5rem 0.75rem; background: #0a1525; border-radius: 4px; display: flex; flex-direction: column; gap: 0.4rem; }
.xp-unlock-row { display: flex; align-items: center; gap: 0.5rem; }
.xp-unlock-name { flex: 1; font-size: 0.85rem; color: #c0c0d0; }
.xp-sub-empty { font-size: 0.8rem; color: #555; font-style: italic; margin: 0; }
.xp-spend-msg { font-size: 0.85rem; color: #2ecc71; margin: 0; }
.tag-item--locked .toggle-label__text { text-decoration: line-through; color: #666; }
.tag-lock-icon { font-size: 0.75rem; margin-left: 0.25rem; }

/* T028m: roll breakdown line */
.roll-breakdown { font-size: 0.75rem; color: #888; margin-top: 0.2rem; }

/* T028k: deferred spend options */
.xp-spend-row--deferred { opacity: 0.45; }
.xp-spend-row--deferred .xp-spend-label { font-style: italic; }

/* Description, Inventory, Rules image */
.sheet-section--description {}
.sheet-description, .inventory-input {
  width: 100%; box-sizing: border-box;
  background: #0d1b2a; color: #e0e0e0;
  border: 1px solid #2a2a4a; border-radius: 4px;
  padding: 0.5rem 0.625rem; font-size: 0.9rem;
  font-family: inherit; resize: vertical;
}
.sheet-description:disabled, .inventory-input:disabled { opacity: 0.65; cursor: default; }
.sheet-description:focus, .inventory-input:focus { outline: 1px solid #e94560; }

.sheet-section--rules {}
.rules-image { max-width: 100%; border-radius: 4px; display: block; }
.rules-text { font-size: 0.875rem; color: #c0c0d0; line-height: 1.6; }
.rules-heading { font-size: 1rem; color: #e0e0f0; margin: 0 0 0.75rem; }
.rules-p { margin: 0 0 0.75rem; }
.rules-example { margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; background: #0a1525;
  border-left: 3px solid #2a2a4a; border-radius: 0 4px 4px 0; color: #a0a0c0; }
.rules-dl { margin: 0 0 0.75rem; display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.75rem; }
.rules-dl dt { font-weight: 700; color: #e0e0f0; white-space: nowrap; }
.rules-dl dd { margin: 0; color: #c0c0d0; }
.rules-table { border-collapse: collapse; width: auto; margin: 0 0 0.75rem; font-size: 0.85rem; }
.rules-table th, .rules-table td { padding: 0.2rem 1.5rem 0.2rem 0; text-align: left; }
.rules-table th { color: #a0a0c0; font-weight: 600; border-bottom: 1px solid #2a2a4a; }
.rules-table td:first-child { font-weight: 700; color: #e94560; white-space: nowrap; }

/* Help section sub-structure */
.pool-action-subheading { font-size: 0.75rem; color: #a0a0c0; text-transform: uppercase;
  letter-spacing: 0.06em; margin: 0 0 0.5rem; font-weight: 600; }
.pool-action-divider { border: none; border-top: 1px solid #2a2a4a; margin: 1rem 0; }

/* Conditions grid */
.conditions { margin-top: 1rem; }
.conditions__title { font-size: 0.85rem; color: #a0a0c0; text-transform: uppercase;
  letter-spacing: 0.05em; margin: 0 0 0.5rem; }
.conditions__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem 1rem; }
.condition-custom-input {
  background: transparent; border: none; border-bottom: 1px solid #3a3a5a;
  color: #e0e0e0; font-size: 0.875rem; padding: 0.1rem 0.2rem; width: 100%;
  font-family: inherit;
}
.condition-custom-input:disabled { opacity: 0.6; }
.condition-custom-input::placeholder { color: #555; }
