@import url('https://fonts.googleapis.com/css2?family=Tiny5&display=swap');

:root {
  --bg: #14150e;
  --surface: #1c1f15;
  --surface2: #262b1a;
  --accent: darkolivegreen;
  --accent-hover: #6b8735;
  --danger: #b33a3a;
  --success: #7a9d3f;
  --text: #e8e6d4;
  --text-muted: #93916f;
  --border: #3a3f28;
  --input-bg: #0c0d08;
  --radius: 0px;
  --shadow: 3px 3px 0 rgba(0, 0, 0, .6);
}

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

html { font-size: 17px; }

body {
  font-family: 'Tiny5', 'Courier New', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  letter-spacing: .02em;
  line-height: 1.6;
}

img { image-rendering: pixelated; }

body::after {
  content: '';
  position: fixed;
  top: -8px;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 4px, rgba(0, 0, 0, .3) 4px, rgba(0, 0, 0, .3) 8px);
  z-index: 9999;
  animation: crt-roll 1.4s steps(60) infinite;
}

body::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: rgba(0, 0, 0, .3);
  opacity: .75;
  pointer-events: none;
  z-index: 10000;
  animation: crt-sweep 6s linear infinite;
}

html::before {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  top: -8px;
  height: 4px;
  background: rgba(0, 0, 0, .3);
  opacity: .75;
  pointer-events: none;
  z-index: 10000;
  animation: crt-sweep 6s linear infinite;
  animation-delay: -3s;
}

@keyframes crt-roll {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, 8px, 0); }
}

@keyframes crt-sweep {
  0% { transform: translate3d(0, 100vh, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

.crt-off body::after,
.crt-off body::before,
html.crt-off::before {
  display: none;
}

::-webkit-scrollbar { width: 14px; height: 14px; }
::-webkit-scrollbar-track { background: var(--surface); border-left: 2px solid var(--border); }
::-webkit-scrollbar-thumb { background: var(--accent); border: 2px solid var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover); }

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

nav {
  background: var(--surface);
  border-bottom: 3px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-shadow: 2px 2px 0 #000;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.nav-brand-icon { color: darkolivegreen; }

.nav-brand:hover { text-decoration: none; }
.nav-brand:hover .nav-brand-text { text-decoration: underline; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0;
  border: 2px solid var(--border);
  background: var(--surface2);
}

.nav-username { font-weight: 600; font-size: 1.05rem; }

.nav-link {
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.nav-link:hover { color: var(--accent-hover); text-decoration: none; }

.nav-caret { font-size: .85rem; transition: none; }
.nav-menu.open .nav-caret, .nav-menu:hover .nav-caret { color: var(--accent-hover); }

.nav-menu { position: relative; padding-bottom: .6rem; margin-bottom: -.6rem; }

.nav-menu-trigger {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .4rem;
  z-index: 200;
}
.nav-menu:hover .nav-dropdown,
.nav-menu.open .nav-dropdown {
  display: block;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  width: 100%;
  padding: .55rem .6rem;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
  text-align: left;
  cursor: pointer;
}
.nav-dropdown-item:hover { background: var(--surface2); text-decoration: none; }
.nav-dropdown-item i { width: 1em; text-align: center; }

.nav-dropdown-section {
  padding: .4rem .6rem 0;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.nav-dropdown-divider { height: 2px; background: var(--border); margin: .4rem 0; }

.notif-bell-trigger { position: relative; font-size: 1.15rem; }
.notif-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: .55rem;
  height: .55rem;
  background: var(--danger);
  border: 2px solid var(--bg);
  border-radius: 50%;
}
.notif-dropdown { min-width: 260px; max-width: 320px; max-height: 320px; overflow-y: auto; }
.notif-dropdown-header { display: flex; align-items: center; justify-content: space-between; padding: .4rem .6rem 0; }
.notif-clear-all {
  background: none;
  border: none;
  color: var(--accent-hover);
  font-family: inherit;
  font-size: .7rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.notif-item { white-space: normal; }
.notif-item-time { display: block; font-size: .7rem; color: var(--text-muted); margin-top: .15rem; }

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

h1 { font-size: 1.9rem; margin-bottom: 1.5rem; text-transform: uppercase; letter-spacing: .05em; text-shadow: 2px 2px 0 #000; }
h2 { font-size: 1.3rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin-bottom: .5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  border: 2px solid #000;
  box-shadow: var(--shadow);
  transition: none;
}
.btn:active { box-shadow: none; transform: translate(3px, 3px); }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c03537; }

.btn-ghost {
  background: var(--surface);
  color: var(--text-muted);
  border: 2px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-ghost:active { transform: none; }

.btn-sm { padding: .35rem .7rem; font-size: .78rem; }

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  height: 100%;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.server-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  text-align: center;
  transition: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.server-card:hover {
  border-color: var(--accent);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .6);
  transform: translate(-2px, -2px);
  text-decoration: none;
}

.server-icon {
  width: 64px;
  height: 64px;
  border-radius: 0;
  border: 2px solid var(--border);
  background: var(--surface2);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.server-name { font-weight: 600; font-size: .95rem; }
.server-meta { font-size: .8rem; color: var(--text-muted); }

.sheet-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  align-items: start;
}

/* Friend rows carry action buttons (Accept/Decline, Message/Remove) that eat into a card's width
   much more than a sheet's compact HP/AC stats do — a multi-column grid of 300px cards left almost
   no room for the name before it started ellipsizing. Single-column rows give it the full width. */
.friend-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.sheet-item {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
  transition: none;
  text-decoration: none;
  color: inherit;
}
.sheet-item:hover { border-color: var(--accent); box-shadow: 5px 5px 0 rgba(0, 0, 0, .6); transform: translate(-2px, -2px); text-decoration: none; }

.sheet-icon {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--accent);
  font-size: 1.1rem;
}
.sheet-item:hover .sheet-icon { border-color: var(--accent); }

.sheet-info { flex: 1; min-width: 0; }
.sheet-slot { font-size: .8rem; color: var(--text-muted); margin-bottom: .2rem; text-transform: uppercase; letter-spacing: .04em; }
.sheet-name { font-size: 1.05rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-meta { font-size: .85rem; color: var(--text-muted); margin-top: .15rem; }
.sheet-badges { margin-top: .35rem; }

.sheet-stats {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .15rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.sheet-item-arrow { flex-shrink: 0; color: var(--text-muted); font-size: 1.1rem; }
.sheet-item:hover .sheet-item-arrow { color: var(--accent); }
.sheet-badges .badge { margin-left: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.form-grid.thirds { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid.full { grid-template-columns: 1fr; }
.form-grid.search { grid-template-columns: 1fr 2fr auto; }

.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-size: .85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

input, select, textarea {
  background: var(--input-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  padding: .6rem .8rem;
  font-size: .95rem;
  width: 100%;
  transition: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Retro-styled checkboxes everywhere — :not(.death-check) since that one already has its own
   distinct circular success/failure styling (see the death-saves rules further down) that this
   would otherwise outrank on specificity and stomp (width/border/background all overlap). */
input[type="checkbox"]:not(.death-check) {
  appearance: none;
  -webkit-appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  padding: 0;
  border: 2px solid var(--border);
  background: var(--input-bg);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
}
input[type="checkbox"]:not(.death-check):hover { border-color: var(--accent-hover); }
input[type="checkbox"]:not(.death-check):checked {
  background: var(--accent);
  border-color: var(--accent);
}
input[type="checkbox"]:not(.death-check):checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Number-stepper: wraps a <input type="number"> with −/+ buttons on either side (see
   number-stepper.js) instead of leaving the browser's native spinner stacked on one side. */
.number-stepper { display: flex; align-items: stretch; }
.number-stepper input[type="number"] {
  text-align: center;
  border-left: none;
  border-right: none;
  -moz-appearance: textfield;
}
.number-stepper input[type="number"]::-webkit-inner-spin-button,
.number-stepper input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.number-stepper-btn {
  flex-shrink: 0;
  width: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text);
}
.number-stepper-minus:hover { border-color: var(--danger); color: var(--danger); }
.number-stepper-plus:hover { border-color: var(--success); color: var(--success); }
.number-stepper-btn:active { background: var(--surface); }

/* Compact contexts (a stat sits inline in a flex row, or a narrow grid column, not filling a
   whole form-group column) — the stepper should size to its input's own fixed width and use
   smaller +/- buttons, not the full-size default that would crowd out the number itself. */
.prof-row .number-stepper, .slot-edit-row .number-stepper { width: auto; }
.prof-row .number-stepper input[type="number"] { width: 3.2rem; }
.prof-row .number-stepper-btn { width: 1.5rem; }
.slot-edit-row .number-stepper-btn {
  width: 1.1rem;
  font-size: .8rem;
}
/* .ability-box centers its children instead of stretching them, so the stepper needs an explicit
   full-width override to fill the box the way its plain <input> used to. */
.ability-box .number-stepper { width: 100%; }
textarea { resize: vertical; min-height: 100px; font-family: inherit; }

.ability-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .75rem;
}

.ability-box {
  background: var(--input-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem .5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}
.ability-box label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent-hover);
  text-transform: uppercase;
}
.ability-box input {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  padding: .3rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  border-radius: 0;
  width: 100%;
}
.ability-box input:focus { border-bottom-color: var(--accent); }
.ability-mod {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.prof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .4rem .75rem;
  margin-top: .5rem;
}
.prof-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 400;
  text-transform: none;
  cursor: pointer;
}
.prof-row input[type="checkbox"] { width: auto; }
.prof-mod { margin-left: auto; font-weight: 700; color: var(--accent-hover); min-width: 2rem; text-align: right; }
.prof-bonus-input { margin-left: auto; width: 3.2rem; font-weight: 700; color: var(--accent-hover); text-align: right; padding: .2rem .3rem; }

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .5rem;
  margin-top: .5rem;
}
.slot-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface2);
  border: 2px solid var(--border);
  padding: .4rem .6rem;
  font-size: .85rem;
}
.slot-row label { display: flex; align-items: center; gap: .3rem; font-weight: 400; text-transform: none; }
.slot-level { font-weight: 700; min-width: 2.6rem; }

.slot-edit-table {
  display: grid;
  grid-template-columns: 3.5rem 6rem 6rem;
  gap: .35rem .75rem;
  margin-top: .5rem;
  max-width: 380px;
}
.slot-edit-row { display: contents; }
.slot-edit-row span { align-self: center; }
.slot-edit-head span { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.slot-edit-row input { width: 100%; }

.prof-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .3rem .75rem;
}
.prof-view-row { display: flex; align-items: center; gap: .5rem; font-size: .85rem; padding: .2rem 0; }
.prof-view-dot { width: .8rem; font-size: .5rem; color: var(--text-muted); }
.prof-view-row.proficient .prof-view-dot { color: var(--accent); }
.prof-view-row.proficient { font-weight: 600; }
.prof-view-mod { margin-left: auto; font-weight: 700; color: var(--accent-hover); }

.sheet-top-layout {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
.sheet-side-col .section-title:first-child { margin-top: 0; }

.ability-block-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: column;
  grid-template-rows: repeat(3, auto);
  gap: .75rem;
}
.ability-block {
  background: var(--surface);
  border: 2px solid var(--border);
  border-top: 3px solid var(--accent);
  box-shadow: var(--shadow);
  padding: .6rem .75rem .75rem;
}
.ability-block-header {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding-bottom: .4rem;
  margin-bottom: .4rem;
  border-bottom: 2px solid var(--border);
}
.ability-block-key { font-weight: 700; color: var(--accent-hover); font-size: .85rem; letter-spacing: .04em; }
.ability-block-score { font-size: 1.3rem; font-weight: 700; }
.ability-block-mod { margin-left: auto; font-size: .95rem; font-weight: 700; color: var(--text-muted); }
.ability-block-row { display: flex; align-items: center; gap: .4rem; font-size: .78rem; padding: .15rem 0; }
.ability-block-row.proficient { font-weight: 600; }
/* Edit-view variant: the header holds an actual score input (with its own stepper) instead of a
   plain span, kept small so it doesn't crowd out the ability key and modifier next to it. */
.ability-block-header input[type="number"] { width: 2.6rem; font-size: 1.05rem; font-weight: 700; text-align: center; padding: .2rem; }
.ability-block-header .number-stepper-btn { width: 1.1rem; font-size: .8rem; }
.ability-block-row .prof-view-mod { font-size: .78rem; }

.ability-block-header.rollable, .ability-block-row.rollable { cursor: pointer; }
.ability-block-header.rollable:hover .ability-block-score,
.ability-block-header.rollable:hover .ability-block-mod,
.ability-block-row.rollable:hover { color: var(--accent-hover); }
.ability-roll-btn {
  background: none;
  border: 2px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .8rem;
  line-height: 1;
  padding: .2rem .35rem;
  margin-left: .3rem;
}
.ability-roll-btn:hover { color: var(--text); border-color: var(--accent); }

.dice-roll-toast {
  position: fixed;
  z-index: 10500;
  transform: translate(-50%, -100%);
  background: var(--surface2);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: .85rem;
  font-weight: 700;
  padding: .3rem .55rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s, transform .15s;
  white-space: nowrap;
}
.dice-roll-toast.show { transform: translate(-50%, -130%); opacity: 1; }

.spell-layout {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1.5rem;
  align-items: start;
}
.slot-col {
  background: var(--surface);
  border: 2px solid var(--border);
  border-top: 3px solid var(--accent);
  box-shadow: var(--shadow);
  padding: .5rem .6rem;
}
.slot-col-row {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font-size: .78rem;
  padding: .25rem 0;
  border-bottom: 2px solid var(--border);
}
.slot-col-row:last-child { border-bottom: none; }

.inventory-table { border: 2px solid var(--border); box-shadow: var(--shadow); }
.inventory-row {
  display: grid;
  grid-template-columns: 1fr 4rem 6rem;
  gap: .5rem;
  padding: .5rem .75rem;
  font-size: .85rem;
  border-bottom: 2px solid var(--border);
  align-items: center;
}
.inventory-row:last-child { border-bottom: none; }
.inventory-head { font-weight: 700; text-transform: uppercase; font-size: .7rem; color: var(--text-muted); background: var(--surface2); letter-spacing: .04em; }
.inventory-total { font-weight: 700; background: var(--surface2); }

.spell-level-group { margin-bottom: 1rem; }
.spell-table {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 3.5rem;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}
.spell-row { display: contents; }
.spell-row > span {
  padding: .45rem .6rem;
  font-size: .8rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.spell-row:last-child > span { border-bottom: none; }
.spell-row-head > span { font-weight: 700; text-transform: uppercase; font-size: .7rem; color: var(--text-muted); background: var(--surface2); letter-spacing: .04em; }
.spell-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  font-size: .65rem;
  font-weight: 700;
  border: 1px solid var(--accent);
  color: var(--accent-hover);
  border-radius: 50%;
  cursor: help;
  flex-shrink: 0;
}

.section {
  margin-top: 2rem;
}
.section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-hover);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
}

.alert {
  padding: .75rem 1rem;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.alert-error { background: rgba(179, 58, 58, .15); color: #ff8080; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .6);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
}
.login-logo { font-size: 3rem; margin-bottom: 1rem; }
.login-card h1 { margin-bottom: .5rem; }
.login-card p { color: var(--text-muted); margin-bottom: 2rem; line-height: 1.5; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { color: var(--border); }

.flex { display: flex; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); font-size: .9rem; }

.guild-tabs {
  display: flex;
  gap: .5rem;
  border-bottom: 2px solid var(--border);
}
.guild-tab {
  padding: .6rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.guild-tab:hover { color: var(--text); text-decoration: none; }
.guild-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.category-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  color: var(--text);
  text-decoration: none;
  transition: none;
}
.category-card:hover { border-color: var(--accent); box-shadow: 5px 5px 0 rgba(0, 0, 0, .6); transform: translate(-2px, -2px); text-decoration: none; }
.category-card-title { font-weight: 700; font-size: 1.05rem; }

.badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .5rem;
  border-radius: 0;
  vertical-align: middle;
  margin-left: .5rem;
}
.badge-homebrew { background: rgba(122, 157, 63, .18); color: var(--success); border: 2px solid var(--success); }
.badge-open { background: rgba(179, 58, 58, .15); color: var(--danger); border: 2px solid var(--danger); }
.badge-resolved { background: rgba(122, 157, 63, .18); color: var(--success); border: 2px solid var(--success); }
.badge-npc { background: rgba(147, 145, 111, .18); color: var(--text-muted); border: 2px solid var(--text-muted); }
.badge-collection { background: rgba(88, 101, 242, .15); color: #7289ff; border: 2px solid #7289ff; }

.collection-chip-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.collection-chip {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .5rem .75rem;
  border: 2px solid var(--border);
  background: var(--surface2);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  min-width: 9rem;
}
.collection-chip:hover { border-color: var(--accent); text-decoration: none; }
.collection-chip-name { font-weight: 700; font-size: .9rem; }
.collection-chip-meta { font-size: .75rem; color: var(--text-muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem 1.5rem;
}
.stat { display: flex; flex-direction: column; gap: .2rem; }
.stat-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent-hover); }
.stat-value { font-size: .95rem; }

.hp-widget { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.hp-current { font-size: 1.1rem; font-weight: 700; }
.hp-step {
  width: 1.6rem;
  height: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: var(--radius);
}
.hp-damage:hover { border-color: var(--danger); color: var(--danger); }
.hp-heal:hover { border-color: var(--success); color: var(--success); }
/* Keeps the amount input and the Temp field as one unit — .hp-widget wraps when it runs out of
   room, and without this they could wrap apart from each other onto separate lines. */
.hp-amount-group { display: inline-flex; align-items: center; gap: .4rem; }
.hp-amount {
  width: 2.8rem;
  font-size: .8rem;
  padding: .2rem .3rem;
  text-align: center;
}
.hp-temp-wrap {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding-left: .5rem;
  border-left: 2px solid var(--border);
}
.hp-temp-input {
  width: 2.8rem;
  font-size: .8rem;
  padding: .2rem .3rem;
  text-align: center;
  color: var(--accent-hover);
}

.hitdice-widget { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.hitdice-count { font-size: 1.1rem; font-weight: 700; }
.hitdice-spend { padding: .2rem .6rem; font-size: .75rem; }

.sheet-actions { display: flex; gap: .5rem; margin-top: .75rem; }

.death-saves {
  margin-top: .75rem;
  padding: .6rem .75rem;
  border: 2px solid var(--danger);
  background: rgba(179, 58, 58, .08);
}
.death-save-row { display: flex; align-items: center; gap: .5rem; font-size: .8rem; padding: .15rem 0; }
.death-save-row-label { width: 5.5rem; color: var(--text-muted); }
.death-check {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  cursor: pointer;
  background: transparent;
  border-radius: 0;
}
.death-check.success { border: 2px solid var(--success); }
.death-check.failure { border: 2px solid var(--danger); }
.death-check.success:checked { background: var(--success); }
.death-check.failure:checked { background: var(--danger); }

.slot-pips { display: flex; flex-wrap: wrap; gap: .25rem; }
.slot-pip {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  border: 2px solid var(--border);
}
.slot-pip.filled { background: var(--accent-hover); border-color: var(--accent-hover); }

.entry-body { line-height: 1.6; }
.entry-body p { margin-bottom: .75rem; }
.entry-body h3, .entry-body h4 { margin: 1rem 0 .5rem; color: var(--text); }
.entry-body ul { margin: 0 0 .75rem 1.25rem; }
.entry-body table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: .9rem; }
.entry-body th, .entry-body td { text-align: left; padding: .5rem .75rem; border-bottom: 2px solid var(--border); }
.entry-body th { color: var(--accent-hover); font-weight: 700; }
.mb-1 { margin-bottom: .5rem; }

.picker { position: relative; display: flex; align-items: center; gap: .5rem; }
.picker .picker-input { flex: 1; }
.tag-picker { position: relative; }

.picker-info {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--accent-hover);
  font-size: .8rem;
  font-weight: 700;
  cursor: help;
}

.picker-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 60;
  margin-top: .3rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow-y: auto;
  list-style: none;
  padding: .3rem;
}
.picker-suggestions li {
  padding: .5rem .65rem;
  border-radius: 0;
  cursor: pointer;
  font-size: .88rem;
}
.picker-suggestions li:hover { background: var(--surface2); }

.chip-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: .3rem .5rem .3rem .8rem;
  font-size: .85rem;
  cursor: help;
}
.chip button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 .15rem;
}
.chip button:hover { color: var(--danger); }
.chip-qty {
  width: 2.6rem;
  font-size: .8rem;
  padding: .1rem .25rem;
  text-align: center;
  cursor: text;
}

.ref-tooltip {
  position: absolute;
  z-index: 300;
  max-width: 320px;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .6);
  padding: .75rem .9rem;
  font-size: .85rem;
  pointer-events: none;
}
.ref-tooltip-title { font-weight: 700; margin-bottom: .2rem; }
.ref-tooltip-subtitle { color: var(--accent-hover); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .45rem; }
.ref-tooltip-body { color: var(--text); line-height: 1.45; }

.notes-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  align-items: start;
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--border);
  padding: 0 .75rem .75rem;
  height: calc(100vh - 220px);
  min-height: 0;
}

.notes-sidebar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .1rem;
  margin: 0 -.75rem 0;
  padding-left: .75rem;
  padding-right: .75rem;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}

.notes-scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-left: 1.5rem;
}
.notes-sidebar-nav span { font-weight: 700; font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.notes-sidebar-controls { display: flex; gap: .5rem; }
.notes-sidebar-controls i {
  cursor: pointer;
  font-size: .85rem;
  opacity: .7;
  font-style: normal;
}
.notes-sidebar-controls i:hover { opacity: 1; color: var(--accent-hover); }

.notes-section-label {
  font-weight: 700;
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .3rem .2rem;
  margin-top: .6rem;
}

.notes-tree { list-style: none; user-select: none; }
.notes-tree .notes-tree { margin-left: 1rem; margin-top: .1rem; }
.notes-tree-item { margin-bottom: .05rem; }

.notes-tree-note-row {
  display: flex;
  align-items: center;
  border-left: 3px solid transparent;
}
.notes-tree-note {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .4rem;
  font-size: .9rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.notes-tree-note:hover { color: var(--accent-hover); text-decoration: none; }
.notes-tree-note.active { color: var(--accent-hover); }
.notes-tree-note-row:has(.notes-tree-note.active) { border-left-color: var(--accent); }

.notes-tree-folder-row {
  display: flex;
  align-items: center;
  padding: .3rem .4rem;
  border-left: 3px solid transparent;
}
.notes-tree-folder {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  font-size: .9rem;
  color: var(--text);
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.notes-tree-folder:hover { color: var(--accent-hover); }
.notes-tree-folder-icon { flex-shrink: 0; width: 1.1em; color: var(--accent); }

.notes-tree-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.notes-shared-dot { flex-shrink: 0; font-size: .7rem; color: var(--success); }

.notes-tree-folder-row[data-folded="1"] + .notes-tree { display: none; }

.notes-tree-folder-row, .notes-tree-note-row { cursor: grab; }
.notes-tree-folder-row.dragging, .notes-tree-note-row.dragging { opacity: .4; }
.notes-tree-folder-row.drag-over { background: var(--surface2); outline: 2px dashed var(--accent); outline-offset: -2px; }
.notes-sidebar.drag-over-root { background: var(--surface2); }

.notes-tree-rename-input {
  font-weight: 700;
  font-size: .9rem;
  border: none;
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  background: transparent;
  padding: 0 .1rem;
  flex: 1;
  min-width: 0;
}

.notes-tree-note-owner {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: block;
  padding: .3rem .2rem 0;
}

.notes-context-menu {
  position: fixed;
  z-index: 600;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .3rem;
  min-width: 190px;
  list-style: none;
}
.notes-context-menu-item {
  padding: .5rem .7rem;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
}
.notes-context-menu-item:hover { background: var(--surface2); }
.notes-context-menu-item i { width: 1em; text-align: center; }
.notes-context-menu-item.danger { color: var(--danger); }
.notes-context-menu-divider { border-top: 2px solid var(--border); margin: .3rem 0; }

.notes-content {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 0;
}

.notes-main-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  padding: .16rem 0rem;
  margin-bottom: .6rem;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}
.notes-name-input {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
  border: none;
  background: transparent;
  padding: 0 .1rem;
  width: auto;
  flex: 1;
  min-width: 0;
  padding-left: 1.5rem;
}

.notes-shared-toggle-btn {
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
}
.notes-shared-toggle-btn:hover { border-color: var(--accent); color: var(--accent-hover); }
.notes-shared-toggle-btn.active { border-color: var(--accent); color: var(--accent-hover); background: var(--surface2); }

.notes-edit-toggle-btn {
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
}
.notes-edit-toggle-btn:hover { border-color: var(--accent); color: var(--accent-hover); }

.notes-owner-label { font-size: .85rem; white-space: nowrap; flex-shrink: 0; }

.notes-main {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.notes-view, .notes-folder-placeholder, .notes-empty {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  min-height: 120px;
  font-family: 'Tiny5', 'Courier New', monospace;
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: .02em;
}
.notes-view { flex: 1; }

.notes-view p { white-space: pre-wrap; }
.notes-folder-placeholder, .notes-empty { padding: 2rem 0; text-align: center; min-height: 0; }

#notes-edit-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#note-content {
  border: none;
  background: transparent;
  padding: 0;
  resize: vertical;
  min-height: 300px;
  flex: 1;
  font-family: 'Tiny5', 'Courier New', monospace;
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: .02em;
}
#note-content:focus { outline: none; border: none; }

.hidden { display: none !important; }

.notes-save-status { display: block; font-size: .8rem; color: var(--text-muted); margin-top: .5rem; }
.notes-save-status.dirty { color: var(--accent-hover); }

.wiki-link { border-bottom: 2px solid var(--accent-hover); }
.wiki-link-missing { border-bottom: 2px dashed var(--text-muted); color: var(--text-muted); }

.wiki-autocomplete {
  position: absolute;
  z-index: 60;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  padding: .3rem;
  min-width: 220px;
}
.wiki-autocomplete li { padding: .4rem .6rem; border-radius: 0; cursor: pointer; font-size: .85rem; }
.wiki-autocomplete li:hover, .wiki-autocomplete li.active { background: var(--surface2); }

@media (max-width: 700px) {
  .form-grid, .form-grid.thirds, .form-grid.search { grid-template-columns: 1fr; }
  .ability-grid { grid-template-columns: repeat(3, 1fr); }
  .notes-layout { grid-template-columns: 1fr; }
  .sheet-top-layout { grid-template-columns: 1fr; }
  .ability-block-grid { grid-template-columns: 1fr 1fr; grid-auto-flow: row; grid-template-rows: none; }
  .spell-layout { grid-template-columns: 1fr; }
  nav { padding: 0 1rem; }
  .container { padding: 1.5rem 1rem; }
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.landing-feature-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  transition: none;
}
.landing-feature-card:hover {
  border-color: var(--accent);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .6);
  transform: translate(-2px, -2px);
  text-decoration: none;
}
.landing-feature-card i { font-size: 1.8rem; color: var(--accent); margin-bottom: .75rem; }
.landing-feature-card h3 { margin-bottom: .4rem; }

.notes-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
}
.notes-confirm-panel {
  background: var(--surface);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  max-width: 360px;
  text-align: center;
}
.notes-confirm-message { margin-bottom: 1.25rem; line-height: 1.5; }
.notes-confirm-actions { display: flex; gap: .75rem; justify-content: center; }

.avatar-crop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.avatar-crop-panel {
  background: var(--surface);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.avatar-crop-box {
  width: 280px;
  height: 280px;
  overflow: hidden;
  position: relative;
  border: 2px solid var(--accent);
  background: #000;
  cursor: grab;
  touch-action: none;
}
.avatar-crop-box.dragging { cursor: grabbing; }
.avatar-crop-box img {
  position: absolute;
  top: 0;
  left: 0;
  user-select: none;
  pointer-events: none;
  max-width: none;
}
.avatar-crop-zoom { width: 280px; }
.avatar-crop-hint { font-size: .75rem; color: var(--text-muted); }

.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
  padding: 1rem;
}
.share-modal-panel {
  background: var(--surface);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
}
.share-modal-panel h3 { margin-bottom: 1rem; }
.share-modal-label { display: block; margin-bottom: .35rem; font-size: .85rem; }
.share-modal-select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  padding: .35rem;
  font-family: inherit;
}
.share-modal-guild-panels { margin-top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.share-modal-guild-panel { border-left: 3px solid var(--accent); padding-left: .75rem; }
.share-modal-guild-panel-title { font-weight: 700; margin-bottom: .4rem; }
.share-modal-radio {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 400;
  text-transform: none;
  font-size: .85rem;
  margin-bottom: .3rem;
}
.share-modal-radio input { width: auto; }
.share-modal-members { margin-top: .4rem; }
.share-modal-members-select { font-size: .85rem; }
.share-modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

.bingo-card-wrap { max-width: 480px; margin: 1rem auto 0; }
.bingo-title { display: grid; gap: .5rem; margin-bottom: .75rem; width: 100%; }
.bingo-title span {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: var(--accent-hover);
  text-shadow: 2px 2px 0 #000;
}

.bingo-board { display: grid; gap: .5rem; width: 100%; }
.bingo-cell {
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: break-word;
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .5rem;
  font-size: .7rem;
  line-height: 1.25;
  cursor: pointer;
  position: relative;
}
.bingo-cell input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.bingo-cell:hover:not(.free) {
  border-color: var(--accent-hover);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .6);
  transform: translate(-2px, -2px);
}
.bingo-cell.free {
  background: var(--surface2);
  font-weight: 700;
  color: var(--accent-hover);
  cursor: default;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: .85rem;
}
.bingo-cell:has(input:checked) {
  background: rgba(122, 157, 63, .18);
  border-color: var(--success);
  color: var(--success);
  text-decoration: line-through;
}
.bingo-cell:has(input:checked)::before {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: .85rem;
  text-decoration: none;
}
.bingo-cell.bingo-line { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent), 5px 5px 0 rgba(0, 0, 0, .6); }

.bingo-toolbar { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-top: 1.25rem; }
.bingo-toolbar input[type="text"] { width: 9rem; text-align: center; }

.thread-scroll {
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding-right: .25rem;
}
.thread-message { max-width: 75%; }
.thread-message.mine { align-self: flex-end; text-align: right; }
.thread-message-body {
  display: inline-block;
  background: var(--surface2);
  border: 2px solid var(--border);
  padding: .5rem .7rem;
  font-size: .9rem;
  word-break: break-word;
  text-align: left;
}
.thread-message.mine .thread-message-body { border-color: var(--accent); }

.table-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  align-items: start;
}
.table-card h3 { font-size: 1.05rem; }
.table-roll-result {
  background: var(--surface2);
  border: 2px solid var(--accent);
  padding: .5rem .7rem;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .6rem;
}
.table-entries-toggle summary { list-style: none; }
.table-entries-toggle summary::-webkit-details-marker { display: none; }
.table-entries-list {
  margin: .5rem 0 0;
  padding-left: 1.25rem;
  font-size: .85rem;
  color: var(--text-muted);
  max-height: 220px;
  overflow-y: auto;
}
.table-entries-list li { margin-bottom: .25rem; }
