/* MeshTavern components (spec 07 U3 and U4, #209). Every rule reads roles from tokens.css and
   never a base value or a colour literal. A `.is-hover`, `.is-focus` or `.is-active` class shows
   a state without interaction, for the style guide and the mockups only. */

/* ---------- Page ---------- */

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

html {
  font-family: var(--font-text);
  font-size: 16px;
  line-height: var(--leading-base);
  color: var(--text);
  background: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  font-size: var(--text-base);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: var(--heading-weight);
  font-variation-settings: var(--display-settings);
  font-optical-sizing: auto;
  line-height: var(--leading-tight);
  letter-spacing: var(--heading-tracking);
  text-transform: var(--heading-transform);
  margin: 0 0 var(--space-3);
}
h1 {
  font-size: var(--text-2xl);
}
h2 {
  font-size: var(--text-xl);
}
h3 {
  font-size: var(--text-lg);
}
h4 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-2);
}
p {
  margin: 0 0 var(--space-3);
}
a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.15em;
  border-radius: var(--radius-xs);
}
a:hover {
  text-decoration-color: currentColor;
}
code,
kbd,
pre {
  font-family: var(--font-code);
  font-size: 0.92em;
}
small,
.muted {
  color: var(--text-muted);
}
.prose {
  font-size: var(--text-md);
  line-height: var(--leading-prose);
}
.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The focus ring, one rule for everything (spec 07 U3). */
:focus-visible,
.is-focus {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-offset);
}

/* The wordmark (#230): the traced mark as inline SVG (shared/src/wordmark.ts), then the name as
   visually hidden text, its accessible name. The mark is as tall as the slot's font size, 20 px
   in a bar. "Mesh" takes the text colour, "Tavern" with its bar the accent's (PM, 2026-10-08).
   Without the SVG the name shows as plain text. */
.wordmark {
  display: inline-flex;
  font-size: var(--text-lg);
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark-mark {
  display: block;
  height: 1em;
  width: auto;
  fill: currentColor;
}
.wordmark-tavern {
  fill: var(--accent-text);
}

/* An icon of the app's inline SVG set (web/src/app/icons.ts, #210): the size and baseline of the
   guide's icon sheet, in the colour of the text around it. */
svg.icon {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  flex: none;
  vertical-align: -0.3em;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  /* A link drawn as a button (a page's one way on, a sign-in method) is not underlined (#212). */
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    background-color var(--motion-hover),
    border-color var(--motion-hover),
    color var(--motion-hover),
    box-shadow var(--motion-hover);
}
.btn:hover,
.btn.is-hover {
  background: var(--surface-hover);
}
.btn:active,
.btn.is-active {
  background: var(--surface-pressed);
}
.btn[aria-pressed='true'] {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.btn:disabled,
.btn[aria-disabled='true'] {
  color: var(--text-faint);
  background: var(--surface);
  border-color: var(--line);
  cursor: not-allowed;
}
.btn-primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: transparent;
}
.btn-primary:hover,
.btn-primary.is-hover {
  background: var(--accent-hover);
}
.btn-primary:active,
.btn-primary.is-active {
  background: var(--accent-pressed);
}
.btn-primary:disabled {
  color: var(--text-faint);
  background: var(--surface-pressed);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover,
.btn-ghost.is-hover {
  background: var(--surface-hover);
}
.btn-ghost:disabled {
  background: transparent;
  border-color: transparent;
}
.btn-danger {
  color: var(--danger-text);
  background: var(--surface);
  border-color: var(--line-strong);
}
.btn-danger:hover,
.btn-danger.is-hover {
  color: var(--on-danger);
  background: var(--danger);
  border-color: transparent;
}
.btn-danger:active,
.btn-danger.is-active {
  color: var(--on-danger);
  background: var(--danger);
  border-color: transparent;
  filter: brightness(0.92);
}
.btn-icon {
  width: var(--control-height);
  padding: 0;
}
.btn-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
}
.btn-sm {
  min-height: 1.625rem;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
}
.btn-sm.btn-icon {
  width: 1.625rem;
}
.btn-group {
  display: inline-flex;
}
.btn-group > .btn {
  border-radius: 0;
  margin-left: -1px;
}
.btn-group > .btn:first-child {
  border-radius: var(--radius-control) 0 0 var(--radius-control);
  margin-left: 0;
}
.btn-group > .btn:last-child {
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}
.btn-group > .btn[aria-pressed='true'] {
  position: relative;
  z-index: 1;
}

/* ---------- Fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}
.field > span:first-child,
.field > label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text);
}
.field .hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}
.field-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.input {
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  font: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  transition:
    border-color var(--motion-hover),
    background-color var(--motion-hover);
}
.input::placeholder {
  color: var(--text-faint);
}
.input:hover,
.input.is-hover {
  border-color: var(--line-strong);
}
.input:focus-visible,
.input.is-focus {
  border-color: var(--accent);
  outline-offset: 0;
}
.input:disabled {
  color: var(--text-faint);
  background: var(--surface);
  border-style: dashed;
  cursor: not-allowed;
}
.input[aria-invalid='true'],
.input.is-error {
  border-color: var(--danger);
}
textarea.input {
  min-height: 5rem;
  padding: var(--space-2) var(--space-3);
  line-height: var(--leading-base);
  resize: vertical;
}
select.input {
  padding-right: var(--space-6);
  appearance: none;
  /* The chevron as two halves of a square in a role's colour, so a theme restyles it too (#210;
     the guide's first cut was an SVG with its own grey). */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position:
    right calc(var(--space-3) + 5px) center,
    right var(--space-3) center;
  background-size: 5px 5px;
}
.input-sm {
  min-height: 1.625rem;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
}
.field-error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--danger-text);
  margin: 0;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  cursor: pointer;
}
.check input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}
.switch input {
  appearance: none;
  width: 2.25rem;
  height: 1.25rem;
  margin: 0;
  border-radius: var(--radius-full);
  background: var(--line-strong);
  position: relative;
  transition: background-color var(--motion-hover);
}
.switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.25rem - 4px);
  height: calc(1.25rem - 4px);
  border-radius: 50%;
  background: var(--surface);
  transition: transform var(--motion-hover);
}
.switch input:checked {
  background: var(--accent);
}
.switch input:checked::after {
  transform: translateX(1rem);
}

/* ---------- The panel frame (spec 07 U4) ---------- */

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--frame-line);
  border-radius: var(--radius-panel);
  box-shadow: var(--elevation-panel);
}
.panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.5rem;
  padding: 0 var(--space-2) 0 var(--space-4);
  border-bottom: 1px solid var(--line);
}
.panel-title {
  flex: 1;
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-title small {
  margin-left: var(--space-2);
  font-weight: var(--weight-regular);
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: var(--space-3) var(--space-4);
}
.panel-body.flush {
  padding: 0;
}
.panel-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--line);
}
.panel-section {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.panel-section:last-child {
  border-bottom: 0;
}
.panel-section-title {
  margin: 0 0 var(--space-2);
  /* The text face also when it is a heading, as .panel-title (#212). */
  font-family: var(--font-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

/* The one list row. */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.25rem;
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-3);
  border-left: 3px solid transparent;
  transition: background-color var(--motion-hover);
}
.row:hover,
.row.is-hover {
  background: var(--surface-hover);
}
.row-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-main small {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.row-selected {
  border-left-color: var(--selection);
  background: var(--accent-soft);
}
.row-turn {
  border-left-color: var(--turn);
  background: var(--turn-soft);
}
.row-hidden {
  color: var(--text-muted);
}
.row-hidden .avatar {
  outline: 1.5px dashed var(--hidden);
  outline-offset: 1px;
  opacity: 0.8;
}
.row-private {
  border-left-color: var(--private);
}
.row-handle {
  color: var(--text-faint);
  cursor: grab;
}
.avatar {
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: 50%;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.row-value {
  min-width: 2rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-medium);
}
.row-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--motion-hover);
}
.row:hover .row-actions,
.row.is-hover .row-actions,
.row:focus-within .row-actions,
.row-actions.is-shown {
  opacity: 1;
}

/* ---------- Chips and badges ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 1.5rem;
  padding: 0 var(--space-2) 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-chip);
  white-space: nowrap;
}
.chip .icon {
  width: 1rem;
  height: 1rem;
}
.chip-dot {
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.125rem;
  border-radius: 50%;
  background: var(--chip-color, var(--accent));
}
.chip-rounds {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.chip button {
  display: grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  margin-right: -0.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.chip button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
button.chip {
  cursor: pointer;
}
button.chip:hover,
.chip.is-hover {
  background: var(--surface-hover);
}
.chip[aria-pressed='true'],
.chip.is-selected {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.chip:disabled {
  color: var(--text-faint);
  border-color: var(--line);
  cursor: not-allowed;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 1.25rem;
  padding: 0 0.4rem;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1;
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-radius: var(--radius-xs);
  white-space: nowrap;
}
.badge .icon {
  width: 0.875rem;
  height: 0.875rem;
}
.badge-accent {
  color: var(--accent-text);
  background: var(--accent-soft);
}
.badge-danger {
  color: var(--danger-text);
  background: var(--danger-soft);
}
.badge-ok {
  color: var(--ok-text);
  background: var(--ok-soft);
}
.badge-warn {
  color: var(--warn-text);
  background: var(--warn-soft);
}
.badge-info {
  color: var(--info-text);
  background: var(--info-soft);
}
.badge-turn {
  color: var(--turn);
  background: var(--turn-soft);
}
.badge-private {
  color: var(--private);
  background: var(--private-soft);
}
.badge-count {
  min-width: 1.25rem;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--on-accent);
  background: var(--accent);
}

/* ---------- Tabs and the segmented switch ---------- */

.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative;
  padding: var(--space-2) var(--space-3);
  margin-bottom: -1px;
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  cursor: pointer;
  transition:
    color var(--motion-hover),
    border-color var(--motion-hover);
}
.tab:hover,
.tab.is-hover {
  color: var(--text);
}
.tab[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}
.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}
.segmented .btn {
  min-height: calc(var(--control-height) - 6px);
  padding: 0 var(--space-2);
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.segmented .btn[aria-pressed='true'] {
  color: var(--text);
  background: var(--surface-raised);
  border-color: var(--line);
  box-shadow: var(--shadow-1);
}

/* ---------- Dialog ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: var(--surface-scrim);
  animation: fade var(--motion-dialog);
}
.dialog {
  width: min(100%, 26rem);
  padding: var(--space-5);
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--frame-line);
  border-radius: var(--radius-dialog);
  box-shadow: var(--elevation-overlay);
  animation: rise var(--motion-dialog);
}
.dialog h2 {
  font-family: var(--font-text);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
  margin-bottom: var(--space-2);
}
.dialog p {
  color: var(--text-muted);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
}
.dialog-actions.destructive .btn-primary {
  display: none;
}
.inline-dialog {
  position: static;
  background: transparent;
  animation: none;
  padding: 0;
  display: block;
}

/* ---------- Menu and tooltip ---------- */

.menu {
  min-width: 12rem;
  padding: var(--space-1);
  margin: 0;
  list-style: none;
  background: var(--surface-raised);
  border: 1px solid var(--frame-line);
  border-radius: var(--radius-control);
  box-shadow: var(--elevation-raised);
  z-index: var(--z-overlay);
  animation: rise var(--motion-panel);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 1.875rem;
  padding: 0 var(--space-2);
  font: inherit;
  font-size: var(--text-base);
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.menu-item:hover,
.menu-item.is-hover,
.menu-item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}
.menu-item .kbd {
  margin-left: auto;
}
.menu-item[aria-disabled='true'],
.menu-item[aria-disabled='true']:hover {
  color: var(--text-faint);
  background: transparent;
  cursor: not-allowed;
}
.menu-item.danger {
  color: var(--danger-text);
}
/* One choice among the items (#213): the check marks the chosen one and keeps the others' place. */
.menu-item[aria-checked='false'] > .icon {
  visibility: hidden;
}
.menu-separator {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--line);
}
/* A menu or a tooltip the app opens over the page, at the place its control gives (#211). */
.menu-floating,
.tooltip-floating {
  position: fixed;
}
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.125rem;
  padding: 0 0.3rem;
  font-family: var(--font-text);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
}
.tooltip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-inverse);
  background: var(--text);
  border-radius: var(--radius-xs);
  box-shadow: var(--elevation-raised);
  z-index: var(--z-tooltip);
  white-space: nowrap;
  animation: fade var(--motion-hover);
}
.tooltip .kbd {
  color: var(--text-inverse);
  background: color-mix(in srgb, var(--text-inverse) 14%, transparent);
  border-color: color-mix(in srgb, var(--text-inverse) 30%, transparent);
}

/* ---------- Toast, banner, empty state, skeleton ---------- */

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: max-content;
  max-width: 24rem;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--frame-line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-control);
  box-shadow: var(--elevation-raised);
  z-index: var(--z-toast);
  animation: rise var(--motion-panel);
}
.toast .icon {
  color: var(--accent-text);
}
.toast-error {
  border-left-color: var(--danger);
}
.toast-error .icon {
  color: var(--danger-text);
}
.toast-ok {
  border-left-color: var(--ok-text);
}
.toast-ok .icon {
  color: var(--ok-text);
}
.toast .btn {
  margin-left: var(--space-2);
}
.toast-text {
  flex: 1;
}
.toast-close {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.toast-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.toast .toast-close .icon {
  width: 1rem;
  height: 1rem;
  color: inherit;
}
.toast-leaving {
  animation: sink var(--motion-panel) forwards;
}
.toast-stack {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  z-index: var(--z-toast);
}
.banner {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  box-shadow: var(--elevation-raised);
}
.banner .icon {
  color: var(--warn-text);
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-panel);
}
/* The state's own icon; an icon in its button keeps the button's size (#211). */
.empty > .icon {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--text-faint);
}
.empty strong {
  color: var(--text);
  font-weight: var(--weight-semibold);
}
.empty p {
  margin: 0;
  max-width: 24rem;
}
.empty .btn {
  margin-top: var(--space-2);
}
.skeleton {
  display: block;
  height: 0.875rem;
  border-radius: var(--radius-xs);
  background: linear-gradient(
    90deg,
    var(--surface-hover) 25%,
    var(--surface-pressed) 50%,
    var(--surface-hover) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.progress {
  height: 0.375rem;
  overflow: hidden;
  background: var(--surface-sunken);
  border-radius: var(--radius-full);
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width var(--motion-panel);
}

/* ---------- Cards ---------- */

.card {
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--frame-line);
  border-radius: var(--radius-panel);
  box-shadow: var(--elevation-panel);
  overflow: hidden;
  text-decoration: none;
  transition:
    border-color var(--motion-hover),
    box-shadow var(--motion-hover),
    transform var(--motion-hover);
}
a.card:hover,
.card.is-hover {
  border-color: var(--line-strong);
  box-shadow: var(--elevation-raised);
}
.card-media {
  aspect-ratio: 16 / 10;
  background: var(--surface-sunken);
  display: grid;
  place-items: center;
  color: var(--text-faint);
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-body {
  padding: var(--space-3) var(--space-4);
}
.card-title {
  margin: 0 0 var(--space-1);
  font-family: var(--font-text);
  font-size: var(--text-md);
  font-weight: var(--weight-semibold);
  letter-spacing: 0;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-4);
}

/* ---------- The toolbar (spec 07 U4) ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}
.tool {
  display: grid;
  place-items: center;
  width: calc(var(--control-height) - 6px);
  height: calc(var(--control-height) - 6px);
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition:
    background-color var(--motion-hover),
    color var(--motion-hover);
}
.tool .icon {
  width: 1.125rem;
  height: 1.125rem;
}
.tool:hover,
.tool.is-hover {
  color: var(--text);
  background: var(--surface-hover);
}
.tool[aria-pressed='true'] {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.tool:disabled {
  color: var(--text-faint);
  background: transparent;
  cursor: not-allowed;
}
/* The grid display above would show a tool its page hides (#213: Grid and Fog for a player). */
.tool[hidden] {
  display: none;
}
.tool .badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  height: 1rem;
  min-width: 1rem;
  padding: 0 0.25rem;
  font-size: 0.625rem;
}
.tool-badged {
  position: relative;
}

/* ---------- Motion ---------- */

@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
@keyframes sink {
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .spinner {
    animation-duration: 0s;
  }
  .scrim,
  .dialog,
  .menu,
  .toast,
  .toast-leaving,
  .tooltip {
    animation: none;
  }
}
