:where(.g2-ui) [hidden] { display: none !important; }

/* Shared components: buttons, fields, cards, lists, tables, badges, charts. */

/* ----------------------------------------------------------------- buttons */

:where(.g2-ui) .btn,
:where(.g2-ui) button {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--target);
  padding: 0 var(--sp-4);
  background: var(--btn-bg);
  color: var(--btn-ink);
  border: 1.5px solid var(--btn-line);
  border-radius: var(--r-pill);
  font: inherit;
  font-weight: 650;
  font-size: var(--text-md);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform var(--dur) var(--ease),
    background-color var(--dur),
    box-shadow var(--dur);
  -webkit-tap-highlight-color: transparent;
}
:where(.g2-ui) .btn:hover,
:where(.g2-ui) button:hover:not(:disabled) {
  --btn-bg: var(--surface-3);
}
:where(.g2-ui) .btn:active,
:where(.g2-ui) button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}
:where(.g2-ui) .btn.primary,
:where(.g2-ui) button.primary {
  --btn-bg: var(--accent);
  --btn-ink: var(--accent-ink);
  --btn-line: var(--accent-edge);
  box-shadow:
    inset 0 -3px 0 rgba(120, 80, 10, 0.18),
    0 2px 0 var(--accent-edge);
}
:where(.g2-ui) .btn.primary:hover,
:where(.g2-ui) button.primary:hover:not(:disabled) {
  --btn-bg: var(--accent-hover);
}
:where(.g2-ui) .btn.big,
:where(.g2-ui) button.big {
  min-height: 54px;
  padding: 0 var(--sp-5);
  font-size: var(--text-lg);
}
:where(.g2-ui) .btn.danger,
:where(.g2-ui) button.danger {
  --btn-ink: var(--danger);
  --btn-line: var(--danger-line);
}
:where(.g2-ui) .btn.ghost,
:where(.g2-ui) button.ghost {
  --btn-bg: transparent;
  --btn-line: transparent;
}
:where(.g2-ui) button:disabled {
  opacity: 0.55;
  cursor: default;
}
/* "small" keeps a 44 px hit area on touch screens and a compact look with a mouse. */
:where(.g2-ui) .btn.small,
:where(.g2-ui) button.small {
  min-height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--text-sm);
}
@media (pointer: coarse) {
  :where(.g2-ui) .btn,
  :where(.g2-ui) button {
    min-width: var(--target);
  }
  :where(.g2-ui) .btn.small,
  :where(.g2-ui) button.small {
    min-height: var(--target);
  }
}
:where(.g2-ui) .btn .icon,
:where(.g2-ui) button .icon {
  width: 22px;
  height: 22px;
  flex: none;
}

/* ------------------------------------------------------------------ fields */

:where(.g2-ui) input,
:where(.g2-ui) select,
:where(.g2-ui) textarea {
  min-height: var(--target);
  padding: 6px 12px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-md);
  max-width: 100%;
}
:where(.g2-ui) input::placeholder,
:where(.g2-ui) textarea::placeholder {
  color: var(--ink-2);
  opacity: 0.85;
}
:where(.g2-ui) input[type='checkbox'],
:where(.g2-ui) input[type='radio'] {
  width: 20px;
  height: 20px;
  min-height: 0;
  accent-color: var(--grass);
  margin: 0;
}
:where(.g2-ui) input[type='file'] {
  padding: 8px;
}
:where(.g2-ui) textarea {
  width: 100%;
  min-height: 96px;
}
/* Our own chevron: Safari on iPhone draws native selects at a fixed 28 px
   height and ignores min-height, which fails the 44 px touch target. */
:where(.g2-ui) select {
  padding-inline-end: 32px;
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
:where(.g2-ui) label.field {
  display: grid;
  gap: var(--sp-1);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--ink-2);
  margin-bottom: var(--sp-3);
}
:where(.g2-ui) label.field > input,
:where(.g2-ui) label.field > select,
:where(.g2-ui) label.field > textarea {
  color: var(--ink);
  font-weight: normal;
}
/* An inline problem with one form field (tied to it by aria-describedby). */
:where(.g2-ui) .field-error {
  margin: calc(-1 * var(--sp-2)) 0 var(--sp-3);
  color: var(--danger);
  font-size: var(--text-sm);
  font-weight: 650;
}
:where(.g2-ui) .field-error:empty {
  display: none;
}
:where(.g2-ui) label.check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--target);
  font-size: var(--text-sm);
  color: var(--ink-2);
  cursor: pointer;
}

/* Segmented control and tabs. */
:where(.g2-ui) .seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  max-width: 100%;
}
:where(.g2-ui) .seg > * {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--sp-3);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
}
:where(.g2-ui) .seg > *:hover {
  background: var(--surface-3);
  color: var(--ink);
}
:where(.g2-ui) .seg > .on {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 0 var(--accent-edge);
}
@media (pointer: coarse) {
  :where(.g2-ui) .seg > * {
    min-height: var(--target);
    min-width: var(--target);
    justify-content: center;
  }
}

:where(.g2-ui) .toolbar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}
:where(.g2-ui) .toolbar > input {
  flex: 1 1 200px;
  min-width: 0;
}

/* ---------------------------------------------------------------- surfaces */

:where(.g2-ui) .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
:where(.g2-ui) .card h2.card-title {
  font-size: var(--text-lg);
  margin: 0 0 var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
:where(.g2-ui) .card > h3:first-child {
  margin-top: 0;
}
:where(.g2-ui) .card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
:where(.g2-ui) .card-head h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
}

:where(.g2-ui) .tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--sp-3);
}
:where(.g2-ui) .tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  min-width: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
:where(.g2-ui) .tile .v {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
}
:where(.g2-ui) .tile .art {
  position: absolute;
  right: -8px;
  bottom: -10px;
  width: 64px;
  height: 64px;
  opacity: 0.9;
  pointer-events: none;
}

:where(.g2-ui) .caption {
  font-size: var(--text-sm);
  color: var(--ink-2);
}
:where(.g2-ui) .muted {
  color: var(--ink-2);
}
:where(.g2-ui) .eyebrow {
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-ink);
}

:where(.g2-ui) .grid2,
:where(.g2-ui) .grid3 {
  display: grid;
  gap: var(--sp-4);
}
:where(.g2-ui) .grid2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
:where(.g2-ui) .grid3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

:where(.g2-ui) .grow {
  flex: 1;
  min-width: 0;
}
:where(.g2-ui) .ell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:where(.g2-ui) .num {
  font-variant-numeric: tabular-nums;
  text-align: end;
}

/* ------------------------------------------------------------------- lists */

:where(.g2-ui) .list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
:where(.g2-ui) .list > .it {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  color: var(--ink);
}
:where(.g2-ui) .list > .it:last-child {
  border-bottom: 0;
}
:where(.g2-ui) .list > a.it {
  text-decoration: none;
  border-radius: 0;
  transition: background-color var(--dur);
}
:where(.g2-ui) .list > a.it:hover {
  background: var(--surface-2);
}
:where(.g2-ui) .list > a.it:focus-visible {
  outline-offset: -3px;
}
:where(.g2-ui) .list .title {
  font-weight: 700;
}

/* ------------------------------------------------------------------ tables */

:where(.g2-ui) .table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
:where(.g2-ui) table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
}
:where(.g2-ui) table.data th {
  text-align: start;
  font-weight: 750;
  color: var(--ink-2);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
:where(.g2-ui) table.data td {
  padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
:where(.g2-ui) table.data tbody tr:last-child td {
  border-bottom: 0;
}
:where(.g2-ui) table.data tbody tr:hover td {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}
:where(.g2-ui) table.data .num {
  text-align: end;
  white-space: nowrap;
}
:where(.g2-ui) table.data th.num {
  text-align: end;
}
:where(.g2-ui) .card table.data,
:where(.g2-ui) .card .table-wrap {
  box-shadow: none;
}
:where(.g2-ui) .table-wrap:focus-visible {
  outline-offset: 0;
}

/* Phones: a stacked table shows each row as a card of "label  value" lines
   (cells carry data-label), so nothing scrolls sideways. */
@media (max-width: 480px) {
  :where(.g2-ui) .table-wrap.stack {
    overflow-x: visible;
    border: 0;
    background: none;
    box-shadow: none;
  }
  :where(.g2-ui) .table-wrap.stack table,
  :where(.g2-ui) .table-wrap.stack tbody,
  :where(.g2-ui) .table-wrap.stack tr,
  :where(.g2-ui) .table-wrap.stack td {
    display: block;
    width: 100%;
  }
  :where(.g2-ui) .table-wrap.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  :where(.g2-ui) .table-wrap.stack tr {
    margin: 0 0 var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
  }
  :where(.g2-ui) .table-wrap.stack td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--sp-3);
    padding: var(--sp-1) 0;
    border: 0;
    text-align: end;
    white-space: normal;
  }
  :where(.g2-ui) .table-wrap.stack td::before {
    content: attr(data-label);
    color: var(--ink-2);
    font-size: var(--text-sm);
    font-weight: 650;
    text-align: start;
  }
  :where(.g2-ui) .table-wrap.stack td.stack-head {
    display: block;
    text-align: start;
    font-weight: 700;
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--sp-1);
  }
  :where(.g2-ui) .table-wrap.stack td.stack-head::before {
    content: none;
  }
}

/* ------------------------------------------------------------------ badges */

:where(.g2-ui) .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 750;
  line-height: 1;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  vertical-align: middle;
  white-space: nowrap;
}
:where(.g2-ui) .badge.gold {
  background: var(--accent);
  border-color: var(--accent-edge);
  color: var(--accent-ink);
}
:where(.g2-ui) .badge.live::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: g2-pulse 1.6s ease-in-out infinite;
}
:where(.g2-ui) .badge.ok {
  color: var(--success);
  border-color: var(--success-line);
  background: var(--success-bg);
}
:where(.g2-ui) .badge.warn {
  color: var(--warn);
  border-color: var(--warn-line);
  background: var(--warn-bg);
}
:where(.g2-ui) .badge.bad {
  color: var(--danger);
  border-color: var(--danger-line);
  background: var(--danger-bg);
}
@keyframes g2-pulse {
  50% {
    opacity: 0.35;
  }
}

/* ----------------------------------------------------------------- notices */

:where(.g2-ui) .notice {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin: 0 0 var(--sp-3);
}
:where(.g2-ui) .notice.error {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}
:where(.g2-ui) .notice.warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn);
}

/* Tabler interface icons (src/icons.tsx); colour follows the text. */
:where(.g2-ui) .icon {
  flex: none;
  vertical-align: middle;
}

:where(.g2-ui) .empty {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--ink-2);
}
:where(.g2-ui) .empty .art {
  display: block;
  margin: 0 auto var(--sp-2);
  width: 72px;
  height: 72px;
  opacity: 0.85;
}

:where(.g2-ui) .loading {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--ink-2);
  padding: var(--sp-4) 0;
}
/* A worker glob tumbling in place while data loads. */
:where(.g2-ui) .loading .glob-spin {
  width: 32px;
  height: 32px;
  background: url('/signin/assets/worker-east.webp') 0 0 / 512px 32px no-repeat;
  animation: g2-glob-roll 0.8s steps(16) infinite;
}
@keyframes g2-glob-roll {
  to {
    background-position-x: -512px;
  }
}

/* Player avatar: a glob-shaped pebble with the initial. */
:where(.g2-ui) .avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--r-blob);
  background: var(--av, #4d7d5a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  flex: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.15),
    inset 0 3px 0 rgba(255, 255, 255, 0.25);
}
:where(.g2-ui) .avatar.ai-avatar {
  --av: var(--accent);
  color: var(--accent-ink);
  text-shadow: none;
}
:where(.g2-ui) .avatar.small {
  width: 30px;
  height: 30px;
  font-size: 14px;
}
:where(.g2-ui) .avatar.large {
  width: 84px;
  height: 84px;
  font-size: 38px;
}

:where(.g2-ui) .chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--target);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 4px var(--sp-3) 4px 6px;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--ink);
  text-decoration: none;
  max-width: 220px;
}
:where(.g2-ui) .chip > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

