/* Shared styles for the overlay app, DM Studio, and join pages. */

:root {
  --bg: #191c22;
  --bg2: #232732;
  --fg: #e8e6e3;
  --muted: #9aa0ab;
  --accent: #c53131;
  --accent-soft: rgba(197, 49, 49, 0.14);
  --border: #363c4c;
  --gold: #ffb74d;
  --blue: #64b5f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.overlay-body { overflow-x: hidden; }
.overlay-body #app { display: flex; flex-direction: column; min-height: 100vh; }

.studio-body #app { max-width: 860px; margin: 0 auto; padding: 18px 16px 60px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }

/* header (overlay) */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: linear-gradient(160deg, #2b2129 0%, var(--bg2) 55%);
  border-bottom: 2px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 2;
}
.header__title { font-weight: 700; letter-spacing: 0.2px; }
.close { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; }

.studio-header { margin-bottom: 16px; }

.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg2); }
.tab {
  flex: 1; padding: 9px 0; background: none; border: none; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px;
  transition: color 0.15s ease, background 0.15s ease;
}
.tab:hover { color: var(--fg); }
.tab--active { color: var(--fg); border-bottom-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.tab--badge { color: var(--gold); }

.body { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.footer-links { margin-top: 8px; display: flex; justify-content: flex-end; }

.btn {
  background: var(--bg2); color: var(--fg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px;
  transition: border-color 0.15s ease, filter 0.15s ease;
}
.btn:hover { border-color: var(--muted); }
.btn--primary { background: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn--primary:hover { filter: brightness(1.12); border-color: var(--accent); }
.btn--small { padding: 3px 8px; font-size: 12px; }
.btn--danger { color: #ff8b8b; }

.input {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--fg); padding: 6px 8px; font-size: 13px; font-family: inherit;
}
.input--stat { width: 70px; }
.input--num { width: 90px; }
select.input { padding: 6px; }
textarea.input { width: 100%; resize: vertical; }

.empty { color: var(--muted); text-align: center; padding: 18px 8px; }
.muted { color: var(--muted); font-size: 12px; }

/* cards (overlay inventory / inbox) */
.card {
  border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 8px; background: var(--bg2);
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--muted); border-left-color: var(--muted); }
.card--uncommon { border-left-color: #4caf50; }
.card--rare { border-left-color: var(--blue); }
.card--very-rare { border-left-color: #ba68c8; }
.card--legendary { border-left-color: var(--gold); }
.card--artifact { border-left-color: #ff8a65; }
.card__head { display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; }
.card__name { font-weight: 600; flex: 1; }
.card__body {
  padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 8px;
  border-top: 1px solid var(--border);
}
.note { font-style: italic; color: #ffb74d; }
.desc { white-space: pre-wrap; }

/* equipment paper doll (overlay) */
.doll {
  display: grid; gap: 5px; max-width: 460px;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas:
    ".       head    ."
    "cloak   armor   neck"
    "weapon1 belt    shield"
    "weapon2 gloves  ring1"
    ".       boots   ring2";
}
.doll__cell {
  border: 1px dashed var(--border); border-radius: 7px; padding: 5px 8px;
  min-height: 44px; background: var(--bg); position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
}
.doll__cell--filled { border-style: solid; background: var(--bg2); }
.doll__slot { font-size: 9px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.doll__item { font-size: 12px; font-weight: 600; line-height: 1.25; padding-right: 14px; }
.doll__empty { font-size: 12px; color: var(--border); }
.doll__x {
  position: absolute; top: 3px; right: 4px; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 11px; padding: 2px;
}
.doll__x:hover { color: #ff8b8b; }
.doll__cell--uncommon { border-color: #4caf50; }
.doll__cell--rare { border-color: var(--blue); }
.doll__cell--very-rare { border-color: #ba68c8; }
.doll__cell--legendary { border-color: var(--gold); }
.doll__cell--artifact { border-color: #ff8a65; }

/* equip-conflict banner */
.conflict {
  border: 1px solid var(--gold); border-radius: 8px; background: var(--accent-soft);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
}

/* DM-applied status pills (overlay + campaign console) */
.status-strip { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.status-pill {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 12px; padding: 3px 9px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--bg2);
}
.status-pill--buff { border-color: #4caf50; }
.status-pill--buff strong { color: #4caf50; }
.status-pill--debuff { border-color: var(--accent); }
.status-pill--debuff strong { color: #ff8b8b; }
.status-pill--status { border-color: var(--gold); }
.status-pill--status strong { color: var(--gold); }
.status-pill__mods { color: var(--fg); }
.status-pill__until { color: var(--muted); font-size: 11px; }
.status-pill__x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 0 0 0 2px; }
.status-pill__x:hover { color: #ff8b8b; }

/* shared read-only item detail (Studio library + campaign console) */
.item-detail { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.item-detail__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-detail__line { display: flex; gap: 8px; align-items: baseline; }
.item-detail__label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; min-width: 92px; }
.item-detail__action { border-left: 2px solid var(--border); padding-left: 10px; }
.item-detail__roll { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--blue); }

.rarity {
  font-size: 11px; text-transform: capitalize; padding: 1px 6px;
  border-radius: 10px; border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.rarity--uncommon { color: #4caf50; }
.rarity--rare { color: #64b5f6; }
.rarity--very-rare { color: #ba68c8; }
.rarity--legendary { color: #ffb74d; }
.rarity--artifact { color: #ff8a65; }

.action { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action__desc { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 4px; cursor: pointer; }

.equipped-badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: #4caf50; border: 1px solid #4caf50; border-radius: 8px; padding: 0 6px;
  white-space: nowrap;
}
.charge-chip {
  font-size: 11px; font-weight: 600; color: var(--gold);
  border: 1px solid var(--border); border-radius: 10px; padding: 1px 7px;
  background: rgba(255, 183, 77, 0.08); white-space: nowrap;
}
.charge-chip--empty { color: var(--muted); background: none; }
.btn--tiny { padding: 0 6px; font-size: 12px; line-height: 18px; }
.mods { font-family: monospace; font-size: 12.5px; color: var(--muted); }
.mods--active { color: var(--blue); }

.stat-row { display: flex; align-items: center; gap: 10px; }
.stat-label { width: 60px; font-family: monospace; }

/* ability tiles (overlay Stats tab) */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat-tile {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg2);
  padding: 8px 8px 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.stat-tile:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.stat-tile--boosted { border-color: #64b5f6; }
.stat-tile--boosted .stat-tile__mod { color: #64b5f6; }
.stat-tile__roll {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; color: var(--fg); cursor: pointer; padding: 0;
  font-family: inherit;
}
.stat-tile__abbr {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--muted);
}
.stat-tile__mod { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-tile__hint { font-size: 10px; color: var(--muted); min-height: 12px; }
.stat-tile__hint--die { opacity: 0; transition: opacity 0.15s ease; }
.stat-tile:hover .stat-tile__hint--die { opacity: 1; }
.stat-tile__input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--fg); font-size: 12px; padding: 3px 6px; text-align: center; width: 100%;
}
.stat-tile__input:focus { outline: none; border-color: var(--muted); }
.log-line { border-bottom: 1px solid var(--border); padding-bottom: 4px; font-size: 13px; }

/* studio */
.landing { max-width: 480px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 12px; }

.panel {
  border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,0.02);
  padding: 14px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 10px;
}
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.row {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg2);
}
.row__main { flex: 1; cursor: pointer; }
.row--open { border-color: var(--muted); }
.row__caret { color: var(--muted); font-size: 11px; }
.row-detail { margin: -4px 0 8px; padding-left: 14px; }
.row__name { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.row__meta { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  border: 1px solid var(--border); border-radius: 8px; padding: 1px 6px; color: #ffb74d;
}

.field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.field--inline { flex-direction: row; align-items: center; gap: 6px; color: var(--fg); font-size: 13px; }
.group { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.group legend { display: flex; align-items: center; gap: 4px; padding: 0 4px; }
.actions-list { display: flex; flex-direction: column; gap: 8px; }
.action-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px;
  display: flex; flex-direction: column; gap: 6px; background: rgba(255,255,255,0.02);
}
.action-card__head { display: flex; justify-content: space-between; align-items: center; }

.campaign { border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 10px; background: var(--bg2); }
.campaign__head { display: flex; justify-content: space-between; align-items: center; }
.invite {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; overflow-wrap: anywhere;
}
.roster { display: flex; flex-direction: column; gap: 4px; }
.roster__row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.grant-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grant-log { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); padding-top: 8px; }
.grant-log__row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }

/* toasts */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px);
  z-index: 1000; background: var(--bg2); color: var(--fg);
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 10px 16px; max-width: 85vw;
  opacity: 0; transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.toast--show { opacity: 1; transform: translate(-50%, 0); }
.toast--roll { border-left-color: #64b5f6; font-weight: 600; }
.toast--error { border-left-color: #ff8b8b; }
