/* Product polish for the Linux topology board. */
body[data-view="board"] .linux-board-scene {
  background-color: #090d0b;
  background-image:
    linear-gradient(90deg, transparent 0 49.9%, rgba(225, 79, 159, 0.04) 50%, transparent 50.1%),
    linear-gradient(rgba(104, 245, 170, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(104, 245, 170, 0.032) 1px, transparent 1px),
    linear-gradient(135deg, rgba(203, 33, 127, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(51, 198, 226, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(5, 10, 8, 0.88), rgba(7, 11, 10, 0.95)),
    url("/assets/ubuntu-sky-board-v1.webp");
  background-size: 100% 100%, 32px 32px, 32px 32px, 100% 100%, 100% 100%, 100% 100%, cover;
}

body[data-view="board"] .board-terminal-bar {
  position: relative;
  color: #829088;
  background:
    linear-gradient(90deg, rgba(115, 239, 173, 0.035), transparent 38%),
    #111713;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

body[data-view="board"] .board-terminal-bar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, #53e895, rgba(83, 232, 149, 0.08) 28%, rgba(225, 79, 159, 0.18) 62%, #33c6e2);
  opacity: 0.42;
}

body[data-view="board"] .terminal-path b {
  color: #82f1b5;
  text-shadow: 0 0 16px rgba(115, 239, 173, 0.25);
}

body[data-view="board"] .terminal-live {
  color: #91a098;
}

body[data-view="board"] .board-system-hud {
  gap: 14px;
}

body[data-view="board"] .level-pass {
  border-color: rgba(115, 239, 173, 0.34);
  background:
    linear-gradient(104deg, rgba(115, 239, 173, 0.12), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent),
    #0e1511;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    inset 0 0 32px rgba(115, 239, 173, 0.025),
    0 18px 38px rgba(0, 0, 0, 0.25);
}

body[data-view="board"] .level-pass::after {
  content: "KERNEL VERIFIED";
  position: absolute;
  right: 13px;
  top: 8px;
  color: rgba(115, 239, 173, 0.44);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 7px;
  font-weight: 800;
}

body[data-view="board"] .linux-board-scene .board-meta {
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent),
    rgba(14, 20, 17, 0.9);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045), 0 18px 38px rgba(0, 0, 0, 0.18);
}

body[data-view="board"] .linux-board-scene .board-meta div {
  position: relative;
  overflow: hidden;
}

body[data-view="board"] .linux-board-scene .board-meta div::after {
  position: absolute;
  right: 8px;
  bottom: 0;
  color: rgba(255, 255, 255, 0.026);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 46px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

body[data-view="board"] .linux-board-scene .board-meta div:nth-child(1)::after { content: "01"; }
body[data-view="board"] .linux-board-scene .board-meta div:nth-child(2)::after { content: "$"; }
body[data-view="board"] .linux-board-scene .board-meta div:nth-child(3)::after { content: "@"; }
body[data-view="board"] .linux-board-scene .board-meta div:nth-child(4)::after { content: "*"; }
body[data-view="board"] .linux-board-scene .board-meta div:nth-child(5)::after { content: "07"; }

body[data-view="board"] .linux-board-scene .board-meta small {
  color: #68776f;
}

body[data-view="board"] .linux-board-scene .board-meta strong {
  position: relative;
  z-index: 1;
  color: #f4f8f6;
  text-shadow: 0 1px rgba(0, 0, 0, 0.25);
}

body[data-view="board"] .topology-heading {
  position: relative;
}

body[data-view="board"] .topology-heading::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(115, 239, 173, 0.22), rgba(255, 255, 255, 0.025) 45%, rgba(99, 217, 239, 0.2));
}

body[data-view="board"] .topology-heading strong {
  color: #f1f6f3;
  text-shadow: 0 0 22px rgba(115, 239, 173, 0.08);
}

body[data-view="board"] .linux-board-scene .board-tree::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  width: min(44%, 520px);
  aspect-ratio: 1.9;
  border: 1px solid rgba(225, 79, 159, 0.1);
  border-radius: 50%;
  box-shadow:
    0 0 0 18px rgba(225, 79, 159, 0.018),
    0 0 0 48px rgba(83, 232, 149, 0.012),
    inset 0 0 34px rgba(225, 79, 159, 0.025);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

body[data-view="board"] .topology-links {
  mix-blend-mode: screen;
}

body[data-view="board"] .topology-links .link-glow {
  stroke-width: 7;
  opacity: 0.16;
  filter: blur(2.4px);
}

body[data-view="board"] .topology-links .link-flow {
  stroke-width: 1.65;
  stroke-dasharray: 2 7;
  filter: drop-shadow(0 0 3px currentColor);
}

body[data-view="board"] .topology-links .link-node {
  stroke-width: 2;
  filter: drop-shadow(0 0 5px currentColor);
}

body[data-view="board"] .topology-links .data-packet {
  filter: drop-shadow(0 0 7px currentColor);
}

body[data-view="board"] .linux-board-scene .donor-stack {
  position: relative;
  border-color: rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 25%),
    rgba(12, 18, 15, 0.84);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 20px 44px rgba(0, 0, 0, 0.24);
}

body[data-view="board"] .linux-board-scene .left-donors {
  box-shadow: inset 2px 0 rgba(83, 232, 149, 0.2), inset 0 1px rgba(255, 255, 255, 0.035), 0 20px 44px rgba(0, 0, 0, 0.24);
}

body[data-view="board"] .linux-board-scene .right-donors {
  box-shadow: inset -2px 0 rgba(51, 198, 226, 0.22), inset 0 1px rgba(255, 255, 255, 0.035), 0 20px 44px rgba(0, 0, 0, 0.24);
}

body[data-view="board"] .linux-board-scene .donor-stack-title {
  color: #829088;
}

body[data-view="board"] .linux-board-scene .position-card,
body[data-view="board"] .linux-board-scene .position-card.legend,
body[data-view="board"] .linux-board-scene .position-card.left_builder,
body[data-view="board"] .linux-board-scene .position-card.right_builder {
  position: relative;
  overflow: visible;
  border-color: rgba(255, 255, 255, 0.105);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.034), transparent 44%),
    rgba(13, 19, 16, 0.94);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.045),
    0 18px 42px rgba(0, 0, 0, 0.27);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

body[data-view="board"] .linux-board-scene .position-card::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 8px;
  height: 8px;
  display: block;
  border: 2px solid #0a0e0c;
  border-radius: 50%;
  background: #69766f;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  opacity: 1;
  transform: translateX(-50%);
}

body[data-view="board"] .linux-board-scene .position-card::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.025);
  border-radius: 8px;
  pointer-events: none;
}

body[data-view="board"] .linux-board-scene .position-card.legend {
  border-color: rgba(242, 132, 191, 0.42);
  background:
    linear-gradient(155deg, rgba(225, 79, 159, 0.15), transparent 48%),
    rgba(17, 19, 18, 0.97);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.06),
    inset 0 0 36px rgba(225, 79, 159, 0.025),
    0 0 0 1px rgba(225, 79, 159, 0.05),
    0 24px 58px rgba(0, 0, 0, 0.34),
    0 0 38px rgba(225, 79, 159, 0.07);
  transform: scale(1.035);
}

body[data-view="board"] .linux-board-scene .position-card.legend::before {
  background: #f268b4;
  box-shadow: 0 0 0 1px rgba(242, 104, 180, 0.3), 0 0 14px rgba(242, 104, 180, 0.65);
}

body[data-view="board"] .linux-board-scene .position-card.left_builder {
  border-color: rgba(115, 239, 173, 0.32);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045), 0 18px 42px rgba(0, 0, 0, 0.27), 0 0 28px rgba(83, 232, 149, 0.035);
}

body[data-view="board"] .linux-board-scene .position-card.left_builder::before {
  background: #73efad;
  box-shadow: 0 0 0 1px rgba(115, 239, 173, 0.25), 0 0 12px rgba(115, 239, 173, 0.52);
}

body[data-view="board"] .linux-board-scene .position-card.right_builder {
  border-color: rgba(99, 217, 239, 0.34);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045), 0 18px 42px rgba(0, 0, 0, 0.27), 0 0 28px rgba(51, 198, 226, 0.035);
}

body[data-view="board"] .linux-board-scene .position-card.right_builder::before {
  background: #63d9ef;
  box-shadow: 0 0 0 1px rgba(99, 217, 239, 0.25), 0 0 12px rgba(99, 217, 239, 0.52);
}

body[data-view="board"] .linux-board-scene .position-card.empty {
  border-color: rgba(255, 255, 255, 0.075);
  background: rgba(10, 15, 12, 0.76);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

body[data-view="board"] .linux-board-scene .position-card.empty::before {
  background: #303a35;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body[data-view="board"] .linux-board-scene .position-card:has(.position-user-button):hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07), 0 24px 52px rgba(0, 0, 0, 0.34);
  transform: translateY(-2px);
}

body[data-view="board"] .linux-board-scene .board-tree .avatar-mini {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(145deg, #c62f81, #6759c5 52%, #188761);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.24),
    inset 0 -12px 20px rgba(0, 0, 0, 0.12),
    0 12px 26px rgba(0, 0, 0, 0.36);
}

body[data-view="board"] .linux-board-scene .board-tree .avatar-mini::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 4px, rgba(255, 255, 255, 0.025) 4px 5px);
  pointer-events: none;
}

body[data-view="board"] .linux-board-scene .board-tree .position-card.legend .avatar-mini {
  border-color: rgba(242, 132, 191, 0.55);
  box-shadow:
    0 0 0 4px rgba(225, 79, 159, 0.08),
    0 0 28px rgba(225, 79, 159, 0.14),
    0 16px 34px rgba(0, 0, 0, 0.42);
}

body[data-view="board"] .linux-board-scene .board-tree .status-pill {
  border-color: rgba(255, 255, 255, 0.1);
  color: #a6b2ac;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}

body[data-view="board"] .linux-board-scene .board-tree .slot-label {
  font-size: 10px;
  font-weight: 850;
}

body[data-view="board"] .linux-board-scene .board-tree .position-user strong {
  color: #f7faf8;
  font-size: 13px;
}

body[data-view="board"] .linux-board-scene .board-tree .position-user small {
  color: #7e8b84;
}

body[data-view="board"] .linux-board-scene .position-actions button {
  border-color: rgba(115, 239, 173, 0.24);
  color: #e4faed;
  background: rgba(115, 239, 173, 0.1);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 8px 18px rgba(0, 0, 0, 0.22);
}

body[data-view="board"] .linux-board-scene .position-actions button:hover {
  border-color: rgba(115, 239, 173, 0.42);
  background: rgba(115, 239, 173, 0.16);
}

body[data-view="board"] .linux-board-scene .board-scene-progress > span {
  height: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

body[data-view="board"] .linux-board-scene .board-scene-progress > span::after {
  box-shadow: 0 0 12px rgba(83, 232, 149, 0.5);
}

/* Player profile opened from a board node. */
.game-profile-dialog {
  --profile-accent: #f268b4;
  width: min(540px, calc(100vw - 28px));
  max-width: 540px;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--profile-accent) 35%, rgba(255, 255, 255, 0.1));
  border-radius: 18px;
  color: #f3f7f5;
  background-color: #0d1210;
  background-image:
    linear-gradient(rgba(115, 239, 173, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(115, 239, 173, 0.026) 1px, transparent 1px),
    linear-gradient(145deg, color-mix(in srgb, var(--profile-accent) 12%, transparent), transparent 46%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.07),
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 32px 90px rgba(0, 0, 0, 0.6),
    0 0 70px color-mix(in srgb, var(--profile-accent) 9%, transparent);
  animation: player-card-in 220ms ease-out both;
}

.game-profile-dialog.profile-left { --profile-accent: #73efad; }
.game-profile-dialog.profile-right { --profile-accent: #63d9ef; }
.game-profile-dialog.profile-center { --profile-accent: #f268b4; }

.game-profile-dialog::backdrop {
  background: rgba(4, 8, 7, 0.78);
  backdrop-filter: blur(12px) saturate(0.8);
}

@keyframes player-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.game-profile-dialog .profile-dialog-head {
  position: relative;
  min-height: 132px;
  padding: 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  background: linear-gradient(110deg, color-mix(in srgb, var(--profile-accent) 12%, transparent), transparent 56%);
}

.game-profile-dialog .profile-dialog-head::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--profile-accent), transparent 70%);
  opacity: 0.58;
}

.profile-player-avatar {
  position: relative;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--profile-accent) 56%, white 8%);
  border-radius: 16px;
  color: white;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), transparent 42%),
    linear-gradient(145deg, #c62f81, #6759c5 52%, #188761);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.24),
    0 0 0 5px color-mix(in srgb, var(--profile-accent) 7%, transparent),
    0 18px 34px rgba(0, 0, 0, 0.36);
  font-size: 23px;
  font-weight: 900;
}

.profile-player-avatar i {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 15px;
  height: 15px;
  border: 3px solid #0d1210;
  border-radius: 50%;
  background: #54e394;
  box-shadow: 0 0 12px rgba(84, 227, 148, 0.6);
}

.profile-player-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.game-profile-dialog .profile-player-copy small {
  color: var(--profile-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
}

.game-profile-dialog .profile-player-copy h3 {
  margin: 0;
  overflow: hidden;
  color: #f7faf8;
  font-size: 28px;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-profile-dialog .profile-player-copy p {
  margin: 0;
  overflow: hidden;
  color: #839088;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-profile-dialog .icon-action {
  width: 40px;
  height: 40px;
  align-self: start;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  color: #8d9992;
  background: rgba(255, 255, 255, 0.035);
  font-size: 25px;
  line-height: 1;
}

.game-profile-dialog .icon-action:hover {
  border-color: rgba(255, 255, 255, 0.18);
  color: white;
  background: rgba(255, 255, 255, 0.07);
}

.profile-node-strip {
  min-height: 38px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.065);
  color: #66736c;
  background: rgba(0, 0, 0, 0.18);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
}

.profile-node-strip > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #73efad;
  font-weight: 800;
}

.profile-node-strip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #54e394;
  box-shadow: 0 0 10px rgba(84, 227, 148, 0.65);
}

.profile-node-strip code {
  color: #6d7b73;
  font: inherit;
}

.game-profile-dialog .profile-details {
  margin: 0;
  padding: 18px 24px 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.game-profile-dialog .profile-details > div {
  min-width: 0;
  min-height: 86px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent),
    rgba(255, 255, 255, 0.018);
}

.game-profile-dialog .profile-details dt {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #748078;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.game-profile-dialog .profile-details dt span {
  color: color-mix(in srgb, var(--profile-accent) 72%, #748078);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 8px;
}

.game-profile-dialog .profile-details dd {
  margin: 0;
  overflow: hidden;
  color: #f1f5f3;
  font-size: 15px;
  font-weight: 800;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-side-value {
  color: var(--profile-accent) !important;
}

.profile-gift-status {
  min-height: 23px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(254, 188, 46, 0.2);
  border-radius: 999px;
  color: #f0cd72;
  background: rgba(254, 188, 46, 0.07);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
}

.profile-gift-status.status-confirmed {
  border-color: rgba(84, 227, 148, 0.2);
  color: #73efad;
  background: rgba(84, 227, 148, 0.07);
}

.profile-gift-status.status-disputed {
  border-color: rgba(255, 105, 105, 0.22);
  color: #ff9d9d;
  background: rgba(255, 105, 105, 0.07);
}

.game-profile-dialog .profile-dialog-actions {
  padding: 8px 24px 24px;
  display: block;
}

.game-profile-dialog .telegram-link {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(99, 217, 239, 0.22);
  border-radius: 10px;
  color: #a9effb;
  background: rgba(51, 198, 226, 0.09);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04), 0 12px 24px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.game-profile-dialog .telegram-link:hover {
  border-color: rgba(99, 217, 239, 0.42);
  background: rgba(51, 198, 226, 0.15);
  transform: translateY(-1px);
}

.game-profile-dialog .profile-dialog-actions .muted-text {
  min-height: 42px;
  display: grid;
  place-items: center;
  color: #69766f;
}

/* Unified level deck. */
body[data-view="board"] .board-control-deck {
  gap: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.105);
  border-radius: 14px;
  background:
    linear-gradient(110deg, rgba(115, 239, 173, 0.055), transparent 35%),
    linear-gradient(290deg, rgba(99, 217, 239, 0.035), transparent 40%),
    rgba(13, 19, 16, 0.92);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.055),
    0 18px 38px rgba(0, 0, 0, 0.22);
}

body[data-view="board"] .board-control-deck .level-pass {
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 0;
  background: linear-gradient(110deg, rgba(115, 239, 173, 0.1), transparent 62%);
  box-shadow: none;
}

body[data-view="board"] .board-control-deck .board-meta {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-view="board"] .board-control-deck .board-meta div:first-child {
  border-left: 0;
}

body[data-view="board"] .board-control-deck .level-pass-serial,
body[data-view="board"] .board-control-deck .board-meta div {
  border-radius: 0;
}

body[data-view="board"] .board-control-deck .board-meta div::after {
  display: none;
}

/* Real 1 -> 2 -> 4 game tree. */
body[data-view="board"] .unity-tree {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(124px, 0.72fr) minmax(222px, 1.28fr);
  grid-template-areas:
    "legend legend"
    "leftTeam rightTeam";
  align-items: stretch;
  column-gap: 38px;
  row-gap: 4px;
}

body[data-view="board"] .unity-tree > .position-card.legend {
  grid-area: legend;
  width: min(300px, 34%);
  min-height: 122px;
  justify-self: center;
  align-self: start;
  padding: 8px 12px;
}

body[data-view="board"] .unity-tree > .position-card.legend .position-head {
  min-height: 29px;
}

body[data-view="board"] .unity-tree > .position-card.legend .avatar-mini {
  width: 62px;
  height: 62px;
  flex-basis: 62px;
}

.team-branch {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: 18px minmax(94px, auto) minmax(104px, 1fr);
  align-items: stretch;
  justify-items: center;
  gap: 6px;
}

.left-team { grid-area: leftTeam; }
.right-team { grid-area: rightTeam; }

.team-branch-title {
  justify-self: start;
  padding-left: 5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #718078;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
}

.team-branch-title i {
  width: 7px;
  height: 7px;
  border: 2px solid #090d0b;
  border-radius: 50%;
  background: #73efad;
  box-shadow: 0 0 0 1px rgba(115, 239, 173, 0.22), 0 0 10px rgba(115, 239, 173, 0.4);
}

.right-team .team-branch-title {
  justify-self: end;
  padding-right: 5px;
}

.right-team .team-branch-title i {
  order: 2;
  background: #63d9ef;
  box-shadow: 0 0 0 1px rgba(99, 217, 239, 0.22), 0 0 10px rgba(99, 217, 239, 0.4);
}

body[data-view="board"] .team-branch > .position-card {
  width: min(300px, 62%);
  min-height: 94px;
  grid-area: auto;
  align-self: stretch;
}

.branch-donors {
  position: relative;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

body[data-view="board"] .branch-donors > .position-card,
body[data-view="board"] .branch-donors > .position-card.empty {
  width: 100%;
  min-height: 104px;
  grid-area: auto;
  align-self: stretch;
  padding: 6px 8px;
}

body[data-view="board"] .branch-donors .position-head {
  min-height: 28px;
}

body[data-view="board"] .branch-donors .avatar-mini {
  width: 45px;
  height: 45px;
  flex-basis: 45px;
  border-radius: 9px;
}

body[data-view="board"] .branch-donors .position-user {
  flex-direction: row;
  align-items: center;
  text-align: left;
}

body[data-view="board"] .branch-donors .position-user > div {
  min-width: 0;
}

body[data-view="board"] .branch-donors .position-user strong,
body[data-view="board"] .branch-donors .position-user small {
  overflow: hidden;
  display: block;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-view="board"] .branch-donors .position-actions {
  position: absolute;
  right: 7px;
  bottom: 7px;
}

body[data-view="board"] .branch-donors .position-actions button {
  min-height: 27px;
}

@media (min-width: 901px) and (min-height: 700px) {
  body[data-view="board"] .board-control-deck {
    min-height: 86px;
    flex: 0 0 86px;
  }

  body[data-view="board"] .board-control-deck .level-pass,
  body[data-view="board"] .board-control-deck .board-meta,
  body[data-view="board"] .board-control-deck .board-meta div {
    min-height: 84px;
    height: 84px;
  }

  body[data-view="board"] .unity-tree > .position-card.legend {
    min-height: 118px;
  }

  body[data-view="board"] .team-branch > .position-card {
    min-height: 92px;
  }

  body[data-view="board"] .branch-donors > .position-card,
  body[data-view="board"] .branch-donors > .position-card.empty {
    min-height: 102px;
  }
}

@media (min-width: 621px) {
  body[data-view="board"] .unity-tree {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: minmax(145px, 0.6fr) minmax(130px, 0.8fr) minmax(116px, 1fr);
    grid-template-areas:
      ". legend legend ."
      "leftBuilder leftBuilder rightBuilder rightBuilder"
      "leftDonor1 leftDonor2 rightDonor1 rightDonor2";
    align-items: center;
    gap: 8px 18px;
  }

  body[data-view="board"] .unity-tree > .position-card.legend {
    width: min(320px, 64%);
    height: clamp(122px, 17vh, 170px);
    min-height: 0;
    align-self: center;
  }

  body[data-view="board"] .team-branch,
  body[data-view="board"] .branch-donors {
    display: contents;
  }

  body[data-view="board"] .team-branch-title {
    display: none;
  }

  body[data-view="board"] .unity-tree .position-card.left_builder { grid-area: leftBuilder; }
  body[data-view="board"] .unity-tree .position-card.right_builder { grid-area: rightBuilder; }
  body[data-view="board"] .unity-tree .position-card.left_donor_1 { grid-area: leftDonor1; }
  body[data-view="board"] .unity-tree .position-card.left_donor_2 { grid-area: leftDonor2; }
  body[data-view="board"] .unity-tree .position-card.right_donor_1 { grid-area: rightDonor1; }
  body[data-view="board"] .unity-tree .position-card.right_donor_2 { grid-area: rightDonor2; }

  body[data-view="board"] .team-branch > .position-card.left_builder,
  body[data-view="board"] .team-branch > .position-card.right_builder {
    width: min(320px, 58%);
    height: clamp(106px, 14vh, 145px);
    min-height: 0;
    justify-self: center;
    align-self: center;
  }

  body[data-view="board"] .branch-donors > .position-card,
  body[data-view="board"] .branch-donors > .position-card.empty {
    width: 100%;
    height: clamp(110px, 12vh, 128px);
    min-height: 0;
    justify-self: stretch;
    align-self: center;
  }
}

@media (max-width: 620px) {
  body[data-view="board"] .linux-board-scene .position-card:has(.position-user-button):hover {
    transform: none;
  }

  body[data-view="board"] .linux-board-scene .board-meta div::after {
    font-size: 38px;
  }

  body[data-view="board"] .board-control-deck .level-pass {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.085);
  }

  body[data-view="board"] .unity-tree {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "legend"
      "leftTeam"
      "rightTeam";
    gap: 18px;
  }

  body[data-view="board"] .unity-tree > .position-card.legend {
    width: 100%;
    min-height: 174px;
  }

  body[data-view="board"] .team-branch {
    width: 100%;
    grid-template-rows: 20px auto auto;
    gap: 10px;
  }

  body[data-view="board"] .team-branch > .position-card {
    width: min(230px, 76%);
    min-height: 150px;
  }

  body[data-view="board"] .branch-donors {
    gap: 10px;
  }

  body[data-view="board"] .branch-donors::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 24%;
    left: 24%;
    height: 1px;
    background: currentColor;
    opacity: 0.2;
  }

  body[data-view="board"] .left-team .branch-donors { color: #73efad; }
  body[data-view="board"] .right-team .branch-donors { color: #63d9ef; }

  body[data-view="board"] .branch-donors > .position-card,
  body[data-view="board"] .branch-donors > .position-card.empty {
    min-height: 148px;
    padding: 8px 5px;
  }

  body[data-view="board"] .branch-donors .position-user {
    flex-direction: column;
    text-align: center;
  }

  body[data-view="board"] .branch-donors .position-actions {
    position: static;
  }

  .game-profile-dialog {
    width: calc(100vw - 20px);
    border-radius: 15px;
  }

  .game-profile-dialog .profile-dialog-head {
    min-height: 112px;
    padding: 18px;
    gap: 12px;
  }

  .profile-player-avatar {
    width: 62px;
    height: 62px;
    font-size: 19px;
  }

  .game-profile-dialog .profile-player-copy h3 { font-size: 22px; }
  .profile-node-strip { padding: 0 18px; }

  .game-profile-dialog .profile-details {
    padding: 14px 18px 8px;
  }

  .game-profile-dialog .profile-details > div {
    min-height: 78px;
    padding: 11px;
  }

  .game-profile-dialog .profile-dialog-actions {
    padding: 8px 18px 18px;
  }
}
