:root {
  --wb-bg: #f6f7f9;
  --wb-surface: #ffffff;
  --wb-border: #e4e7eb;
  --wb-text: #1a1d21;
  --wb-muted: #6b7280;
  --wb-primary: #2563eb;
  --wb-on-primary: #ffffff;
  --wb-danger: #dc2626;
  --wb-radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wb-bg: #0f1115;
    --wb-surface: #171a21;
    --wb-border: #272b33;
    --wb-text: #e6e8eb;
    --wb-muted: #99a1ab;
    --wb-primary: #3b82f6;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--wb-bg);
  color: var(--wb-text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
main { max-width: 960px; margin: 0 auto; padding: 32px 20px 64px; }
main > h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 20px; }
/* G7 — consecutive page-level actions must not collide (inline button+link packing). */
main > :is(.wb-button, .wb-link) + :is(.wb-button, .wb-link) {
  margin-inline-start: 1.5rem;
}
.wb-stack { min-width: 0; }
main > .wb-stack {
  width: 100%;
  margin: 0 0 14px;
}
.wb-heading { font-weight: 650; letter-spacing: -0.01em; margin: 4px 0; }
.wb-text { margin: 2px 0; }
.wb-divider { border: 0; border-top: 1px solid var(--wb-border); margin: 18px 0; }
.wb-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--wb-muted); }
.wb-label { font-weight: 550; }
.wb-field input, .wb-field select, .wb-field textarea {
  font: inherit; color: var(--wb-text);
  padding: 8px 10px; background: var(--wb-surface);
  border: 1px solid var(--wb-border); border-radius: var(--wb-radius); outline: none;
}
.wb-field textarea { min-height: 4.5em; resize: vertical; line-height: 1.45; }
.wb-field input:focus, .wb-field select:focus, .wb-field textarea:focus {
  border-color: var(--wb-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.wb-button {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 550; font-size: 13px; line-height: 1.2;
  padding: 5px 10px; width: max-content; max-width: 100%;
  align-self: flex-start;
  background: var(--wb-primary); color: var(--wb-on-primary);
  border: 1px solid transparent; border-radius: var(--wb-radius);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.wb-button:hover { filter: brightness(1.06); }
.wb-button:active { filter: brightness(0.96); transform: none; }
.wb-button--link {
  background: transparent; color: var(--wb-primary); padding: 0;
  border: 0; border-radius: 0; font-weight: 550; min-height: 0;
  text-decoration: underline; text-underline-offset: 2px;
}
.wb-button--link:hover { filter: none; opacity: 0.85; }
.wb-button--ghost {
  background: transparent; color: var(--wb-text);
  border: 1px solid var(--wb-border); padding: 3px 8px; font-size: 12px;
}
.wb-button--ghost:hover { filter: none; background: var(--wb-surface); }
.wb-action-select { align-self: flex-start; }
.wb-action-select select {
  min-height: 30px; max-width: 100%; padding: 4px 26px 4px 9px;
  border: 1px solid var(--wb-border); border-radius: var(--wb-radius);
  background: var(--wb-surface); color: var(--wb-text); font: inherit; font-size: 12px; font-weight: 550;
}
.wb-action-select select:focus-visible { outline: 3px solid color-mix(in srgb, var(--wb-primary) 40%, transparent); outline-offset: 2px; }
.wb-action-menu { position: relative; display: inline-block; align-self: flex-start; z-index: 1; }
.wb-action-menu[open] { z-index: 4; }
.wb-action-menu-trigger {
  display: inline-flex; align-items: center; min-height: 28px; box-sizing: border-box;
  padding: 3px 8px; border: 1px solid var(--wb-border); border-radius: var(--wb-radius);
  color: var(--wb-text); font-size: 12px; font-weight: 550; line-height: 1.2; cursor: pointer;
  list-style: none;
}
.wb-action-menu-trigger::-webkit-details-marker { display: none; }
.wb-action-menu-trigger::after { content: "⌄"; margin-left: 5px; color: var(--wb-muted); }
.wb-action-menu-items {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5;
  display: flex; flex-direction: column; align-items: stretch; min-width: max-content;
  padding: 4px; border: 1px solid var(--wb-border); border-radius: 8px;
  background: var(--wb-surface); box-shadow: 0 10px 24px color-mix(in srgb, #000 24%, transparent);
}
.wb-action-menu:not([open]) > .wb-action-menu-items { display: none; }
.wb-action-menu-items .wb-button { width: 100%; justify-content: flex-start; white-space: nowrap; }
.wb-button--danger {
  background: var(--wb-danger); color: #fff;
}
.wb-button--primary { /* default chip — explicit for clarity */ }
.wb-button:focus-visible, .wb-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--wb-primary) 40%, transparent);
  outline-offset: 3px;
}
.wb-button:disabled, .wb-button[aria-disabled="true"] {
  cursor: not-allowed;
  filter: none;
  opacity: 0.46;
}
.wb-game-shell {
  width: min(100%, 36rem);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--wb-primary) 13%, transparent), transparent 42%),
    var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: 18px;
  box-shadow: 0 18px 48px color-mix(in srgb, var(--wb-text) 9%, transparent);
}
.wb-game-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--wb-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--wb-surface) 90%, var(--wb-primary));
}
.wb-game-status {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-align: center;
}
.wb-player-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wb-primary) 10%, var(--wb-bg));
  color: var(--wb-muted);
  font-size: 13px;
  font-weight: 650;
}
.wb-player-strip .wb-text { margin: 0; }
.wb-game-board {
  width: min(100%, 24rem);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(7px, 2.4vw, 12px);
}
.wb-game-board .wb-button {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 64px;
  aspect-ratio: 1;
  align-self: stretch;
  padding: 0;
  border-color: color-mix(in srgb, var(--wb-primary) 50%, var(--wb-border));
  border-radius: 14px;
  font-size: clamp(2rem, 12vw, 3.4rem);
  font-weight: 760;
}
.wb-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.wb-choice-grid .wb-button {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 52px;
  align-self: stretch;
  padding: 10px 8px;
  font-size: 15px;
}
.wb-card-table {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}
.wb-card-table > * {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--wb-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--wb-surface) 94%, var(--wb-primary));
}
.wb-card-hand {
  min-width: 0;
}
.wb-card-hand > .wb-repeat {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 5px 4px 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}
.wb-card-face {
  flex: 0 0 126px;
  width: 126px;
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--wb-border);
  border-radius: 14px;
  background: var(--wb-surface);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--wb-text) 10%, transparent);
  scroll-snap-align: start;
}
.wb-card-face .wb-text {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 760;
  text-align: center;
}
.wb-card-face .wb-button {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 6px;
}
@media (max-width: 480px) {
  main { padding: 20px 12px 40px; }
  main > h1 { font-size: 23px; }
  .wb-game-shell { padding: 16px; border-radius: 14px; }
  .wb-choice-grid { grid-template-columns: 1fr; }
  .wb-choice-grid .wb-button { min-height: 48px; }
  .wb-card-table { grid-template-columns: 1fr; }
  .wb-card-face { flex-basis: 112px; width: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
.wb-link {
  display: inline; color: var(--wb-primary); text-decoration: none; font-weight: 550;
  cursor: pointer;
}
.wb-link:hover { opacity: 0.85; }
.wb-link--muted { color: var(--wb-muted); font-weight: 500; }
.wb-link--emphasis { color: var(--wb-text); font-weight: 650; }
.wb-link--default { /* primary-colored default */ }
/* product-ux F6: person vs place must stay distinct without relying on hue alone */
.wb-link--person { text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.wb-link--place { color: var(--wb-muted); font-weight: 500; text-decoration: none; letter-spacing: 0.01em; }
.wb-link--place:hover { color: var(--wb-text); opacity: 1; }
.wb-link--content { font-weight: 650; color: var(--wb-text); }
.wb-nav {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 14px 16px;
  padding: 10px 0 14px; margin: 0 0 8px;
  border-bottom: 1px solid var(--wb-border);
  overflow-x: auto;
}
.wb-nav .wb-link { font-size: 14px; white-space: nowrap; }
.wb-nav .wb-link--active {
  color: var(--wb-text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 7px;
}
/* Session label rides at the end of the nav row (never its own banner line). */
.wb-nav .wb-meta { margin: 0 0 0 auto; font-size: 12px; white-space: nowrap; color: var(--wb-muted); }
.wb-list { display: flex; flex-direction: column; margin: 4px 0; }
.wb-list--comfortable .wb-list-item { padding: 12px 2px; }
.wb-list--compact .wb-list-item { padding: 8px 2px; }
.wb-list--dividers > .wb-repeat > .wb-list-item,
.wb-list--dividers > .wb-list-item {
  border-bottom: 1px solid var(--wb-border);
}
.wb-list--dividers > .wb-repeat > .wb-list-item:last-child,
.wb-list--dividers > .wb-list-item:last-child { border-bottom: 0; }
.wb-list-item {
  box-sizing: border-box;
  display: flex; flex-direction: column; gap: 4px;
  background: transparent; border: 0; border-radius: 0;
}
.wb-list-item:hover,
.wb-list-item:focus-within { background: color-mix(in srgb, var(--wb-muted) 8%, transparent); }
.wb-list-item:active { background: color-mix(in srgb, var(--wb-muted) 12%, transparent); }
/*
 * Section hierarchy (section-hierarchy-model): header band ≠ body rows.
 * Empty bodies show .wb-section-empty; nonempty hide it. Gestalt G5/G6.
 */
.wb-section {
  margin: 32px 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.wb-section-header {
  display: block;
  margin: 0;
  padding: 0 0 10px;
  background: transparent;
  border-bottom: 0;
}
.wb-section-title {
  display: block;
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.012em;
  text-transform: none;
  color: var(--wb-text);
  margin: 0;
  padding: 0;
  background: transparent;
}
.wb-section-desc {
  display: block;
  color: var(--wb-muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 4px 0 0;
  padding: 0;
  background: transparent;
  border: 0;
  max-width: 68ch;
}
.wb-section-body {
  margin: 0;
  padding: 0;
  background: transparent;
}
.wb-section-body > .wb-list,
.wb-section-body > .wb-view {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
/* Empty affordance via ::after so kernel rendered text stays free of "No items" noise.
   Only sections that contain a list (and zero list items) — never form-only sections. */
.wb-section:has(> .wb-section-body > .wb-list):not(:has(.wb-list-item)) > .wb-section-body::after {
  content: "No items";
  display: block;
  margin: 0;
  padding: 14px 8px;
  color: var(--wb-muted);
  font-size: 13px;
  font-weight: 500;
  font-style: italic;
}
.wb-section .wb-list-item {
  padding: 12px 8px;
  border-radius: 0;
}
.wb-section-body > .wb-list > .wb-repeat > .wb-list-item,
.wb-section-body > .wb-list > .wb-list-item {
  margin-inline: 8px;
  border-radius: 6px;
}
.wb-section .wb-list-item .wb-link--content,
.wb-section .wb-list-item .wb-link--emphasis {
  font-size: 15px;
  font-weight: 600;
}
.wb-section .wb-list--dividers > .wb-repeat > .wb-list-item,
.wb-section .wb-list--dividers > .wb-list-item {
  border-bottom-color: color-mix(in srgb, var(--wb-border) 80%, transparent);
}
.wb-badge {
  display: inline-flex; align-items: center; width: max-content;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 2px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--wb-muted) 18%, var(--wb-bg));
  color: var(--wb-muted);
}
.wb-badge--accent { background: color-mix(in srgb, var(--wb-primary) 18%, var(--wb-bg)); color: var(--wb-primary); }
.wb-badge--success { background: color-mix(in srgb, #16a34a 18%, var(--wb-bg)); color: #15803d; }
.wb-badge--warn { background: color-mix(in srgb, #d97706 18%, var(--wb-bg)); color: #b45309; }
.wb-badge--neutral { /* default muted chip */ }
.wb-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; border-radius: 999px; font-weight: 650; letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--wb-primary) 16%, var(--wb-bg));
  color: var(--wb-primary); user-select: none;
}
.wb-avatar--sm { width: 28px; height: 28px; font-size: 10px; }
.wb-avatar--md { width: 36px; height: 36px; font-size: 12px; }
.wb-image { display: block; width: 28px; height: 28px; object-fit: cover; border-radius: 999px; flex-shrink: 0; }
.wb-image--photo,
.wb-image--feature {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 10px;
}
.wb-image--feature { max-width: 54rem; margin-inline: auto; }
.wb-image-missing { border: 1px dashed color-mix(in srgb, #aa2b2b 60%, var(--wb-border)); color: #aa2b2b; padding: 8px; background: color-mix(in srgb, #aa2b2b 8%, var(--wb-bg)); border-radius: 8px; font-size: 12px; }
.wb-muted { color: var(--wb-muted); font-size: 13px; }
.wb-meta { color: var(--wb-muted); font-size: 13px; margin: 2px 0; }
.wb-time { display: inline-block; font-variant-numeric: tabular-nums; }
.wb-compose .wb-field { flex: 1; min-width: 12rem; }
.wb-compose { width: 100%; }
.wb-thread-actions { gap: 6px; flex-wrap: wrap; }
.wb-mod-tools { opacity: 0.92; margin-top: 4px; }
.wb-repeat { display: flex; flex-direction: column; gap: 0; margin: 0; }
.wb-repeat--grid {
  width: 100%;
  display: grid;
  gap: 16px;
}
.wb-repeat--columns-1 { grid-template-columns: minmax(0, 1fr); }
.wb-repeat--columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wb-repeat--columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wb-repeat--columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wb-repeat--wrap { flex-flow: row wrap; gap: 14px 22px; }
.wb-repeat--grid > *,
.wb-repeat--wrap > * { min-width: 0; }
@media (max-width: 760px) {
  .wb-repeat--grid { grid-template-columns: minmax(0, 1fr); }
}
/* Surfaces remain available for detail panels — not feed chrome. */
.wb-view { box-sizing: border-box; }
.wb-view--surface {
  background: var(--wb-surface);
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
}
.wb-view--muted {
  background: color-mix(in srgb, var(--wb-muted) 12%, var(--wb-bg));
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
}
/* Chat threads (Knot hangout / Orb match / forum DM): no card-per-message. */
[data-node-id="hm-row"],
[data-node-id="msg-row"],
[data-node-id="dm-msg-row"] {
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--wb-border);
  background: transparent;
  border-radius: 0;
}
[data-node-id="hm-row"]:last-child,
[data-node-id="msg-row"]:last-child,
[data-node-id="dm-msg-row"]:last-child { border-bottom: 0; }
[data-node-id="hm-time"],
[data-node-id="msg-time"] {
  color: var(--wb-muted);
  font-size: 12px;
}
[data-node-id="hm-body"],
[data-node-id="msg-body"],
[data-node-id="dm-msg-body"] {
  font-size: 15px;
  line-height: 1.45;
}
[data-node-id="hangout-thread"],
[data-node-id="match-thread"],
[data-node-id="dm-thread-panel"] {
  max-width: 42rem;
}
[data-node-id="hangout-compose"] .wb-field,
[data-node-id="match-compose"] .wb-field,
[data-node-id="dm-compose"] .wb-field {
  flex: 1;
  min-width: 10rem;
  max-width: none;
}
[data-node-id="match-members-row"] {
  flex-wrap: wrap;
  margin-bottom: 4px;
}
[data-node-id="match-members-heading"] {
  color: var(--wb-muted);
  font-size: 12px;
}
.wb-field { max-width: 100%; align-self: stretch; }
.wb-scroll-view {
  box-sizing: border-box;
  overflow-y: auto;
  min-height: 0;
  border: 1px solid var(--wb-border);
  border-radius: var(--wb-radius);
  background: var(--wb-surface);
}
.wb-form { display: flex; flex-direction: column; gap: 10px; }
.wb-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 10px;
  padding: 12px 14px;
  border: 1px solid var(--wb-border);
  border-left: 4px solid var(--wb-primary);
  border-radius: 10px;
  background: color-mix(in srgb, var(--wb-surface) 86%, var(--wb-primary));
  font-size: 13px;
  color: var(--wb-muted);
}
.wb-feedback__body { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.wb-feedback strong { color: var(--wb-text); font-size: 14px; }
.wb-feedback a { color: var(--wb-primary); font-weight: 700; text-decoration: none; }
.wb-feedback a:hover { text-decoration: underline; text-underline-offset: 2px; }
.wb-feedback__dismiss { flex: 0 0 auto; border: 0; padding: 0 2px; background: transparent; color: var(--wb-muted); font: inherit; font-size: 12px; cursor: pointer; }
.wb-feedback__dismiss:hover { color: var(--wb-text); }
.wb-feedback__dismiss:focus-visible { outline: 2px solid var(--wb-primary); outline-offset: 2px; border-radius: 4px; }
.wb-feedback[data-ok="true"] { border-color: #15803d; }
.wb-feedback[data-ok="false"] { border-color: var(--wb-danger); color: var(--wb-danger); background: color-mix(in srgb, var(--wb-surface) 88%, var(--wb-danger)); }
.wb-feedback[data-ok="false"] strong { color: var(--wb-danger); }
.wb-feedback--toast { position: fixed; z-index: 20; inset-block-start: 14px; inset-inline-end: 14px; width: min(28rem, calc(100vw - 28px)); box-shadow: 0 12px 32px color-mix(in srgb, #000 22%, transparent); }
.wb-stack--board { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch !important; }
.wb-stack--board > .wb-section,
.wb-stack--dashboard > .wb-section {
  min-width: 0; margin: 0;
  border: 1px solid var(--wb-border);
  border-radius: 8px;
  background: var(--wb-surface);
  box-shadow: none;
  overflow: hidden;
}
.wb-stack--board > .wb-section { align-self: stretch; height: 100%; }
.wb-stack--board > .wb-section .wb-section-header,
.wb-stack--dashboard > .wb-section .wb-section-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--wb-border);
}
.wb-stack--board > .wb-section .wb-section-title { font-size: 15px; }
.wb-stack--board > .wb-section .wb-section-body,
.wb-stack--dashboard > .wb-section .wb-section-body { padding: 0 14px 14px; }
.wb-stack--board > .wb-section .wb-list-item { padding-block: 16px; }
.wb-stack--dashboard { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start !important; }
@media (max-width: 760px) { .wb-stack--board, .wb-stack--dashboard { grid-template-columns: 1fr; } .wb-feedback--toast { inset-block-start: 10px; inset-inline: 12px; width: auto; } }
.wb-table table { width: 100%; border-collapse: collapse; }
.wb-table th, .wb-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--wb-border); }
.wb-table th { font-size: 13px; color: var(--wb-muted); }
.wb-error { color: var(--wb-danger); font-size: 12px; font-weight: 550; }
.wb-unknown { color: var(--wb-danger); }
