.board-menu,
.chrome-pop {
  position: fixed;
  z-index: 90;
  width: max-content;
  min-width: 196px;
  max-width: min(280px, calc(100vw - 16px));
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--island);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: 13px/1.3 var(--sans);
}
.board-menu[hidden],
.chrome-pop[hidden] { display: none !important; }

.board-menu-item,
.chrome-pop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.board-menu-item:hover,
.board-menu-item.is-on,
.chrome-pop-item:hover,
.chrome-pop-item.is-on,
.chrome-pop-item[aria-current="true"] {
  background: var(--field);
}
.board-menu-item:focus-visible,
.chrome-pop-item:focus-visible,
.chrome-board:focus-visible,
.chrome-more:focus-visible,
.chrome-share:focus-visible {
  outline: 2px solid var(--sel);
  outline-offset: 0;
}
.board-menu-item[aria-disabled="true"] {
  color: var(--mute);
  cursor: default;
}
.board-menu-item[aria-disabled="true"]:hover,
.board-menu-item[aria-disabled="true"].is-on {
  background: transparent;
}
.board-menu-item.is-danger,
.chrome-pop-item.is-danger {
  color: var(--err);
}
.board-menu-item .kbd {
  color: var(--mute);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.board-menu-item.is-danger .kbd { color: inherit; opacity: 0.7; }
.board-menu-rule,
.chrome-pop-rule {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

.brand-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  height: 40px;
  margin-left: 8px;
  padding: 0;
}
.chrome-board {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 22ch;
  height: 32px;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: 12px/1 var(--sans);
  font-weight: 600;
  cursor: pointer;
}
.chrome-board-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chrome-chev {
  width: 12px;
  height: 12px;
  flex: none;
  color: var(--mute);
}
.chrome-board:hover,
.chrome-more:hover {
  background: var(--field);
}
.chrome-share {
  flex: none;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.chrome-share:hover { background: var(--field); }
.chrome-more {
  flex: none;
  width: 32px;
  height: 32px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.chrome-more svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.chrome-pop-who {
  display: block;
  max-width: none;
  padding: 6px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}
.chrome-pop-who[hidden] { display: none !important; }
.chrome-pop-item.is-phone-share { display: none; }

@media (pointer: coarse), (max-width: 1023px) {
  .board-menu-item,
  .chrome-pop-item {
    min-height: 44px;
    padding: 8px 10px;
  }
  .chrome-board,
  .chrome-share,
  .chrome-more {
    min-height: 44px;
    height: 44px;
  }
  .chrome-more {
    width: 44px;
  }
}

@media (max-width: 1023px) {
  #chrome-brand .wordmark {
    margin-right: 0;
    padding: 0 4px;
    height: 44px;
  }
  #chrome-brand .rule { display: none; }
  .brand-nav {
    margin-left: 4px;
    height: 44px;
  }
  .chrome-board { max-width: min(16ch, 36vw); }
  .chrome-pop {
    width: max-content;
    max-width: min(280px, calc(100vw - 16px));
    min-width: 220px;
    height: auto;
    min-height: 0;
    padding: 6px;
  }
  .kbd { display: none; }
}

@media (max-width: 360px) {
  .chrome-share { display: none; }
  .chrome-pop-item.is-phone-share { display: flex; }
}

.comments-panel {
  top: 64px;
  right: 12px;
  left: auto;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 88px);
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  touch-action: manipulation;
}
.comments-panel[hidden] { display: none !important; }
body.is-comments .hint { visibility: hidden; }
.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: none;
  padding: 8px 8px 8px 12px;
  border-bottom: 1px solid var(--line);
}
.comments-head h2 {
  flex: 1;
  min-width: 0;
  font: 600 13px/1.2 var(--sans);
  color: var(--ink);
}
.comments-hide,
.comments-back {
  margin: 0;
  padding: 4px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--mute);
  font: 12px/1.2 var(--sans);
  cursor: pointer;
}
.comments-back { margin-right: -2px; }
.comments-hide:hover,
.comments-back:hover { background: var(--field); color: var(--ink); }
.comments-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 6px;
}
.comments-empty {
  margin: 0;
  padding: 16px 10px;
  color: var(--mute);
  font: 13px/1.4 var(--sans);
}
.comment-row {
  margin: 0 0 2px;
}
.comment-row-hit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.comment-row-hit:hover {
  background: var(--field);
}
.comment-row.is-resolved {
  opacity: 0.55;
}
.comment-row-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink);
}
.comment-row-meta {
  color: var(--mute);
  font-size: 11px;
}
.comment-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 8px;
}
.comment-note {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  grid-template-areas:
    "face who when"
    "face body body";
  column-gap: 8px;
  row-gap: 2px;
  margin: 0;
  padding: 0 4px;
}
.comment-note-face {
  grid-area: face;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--field);
  color: var(--ink);
  font: 650 11px/24px var(--sans);
  text-align: center;
}
.comment-note-who {
  grid-area: who;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 12px;
}
.comment-note-when {
  grid-area: when;
  color: var(--mute);
  font-size: 11px;
}
.comment-note-body {
  grid-area: body;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-reply {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--island);
}
.comment-reply[hidden] { display: none !important; }
.comment-reply-text,
.comment-composer-text {
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--island);
  resize: none;
  min-height: 52px;
  max-height: 88px;
  font: 13px/1.3 var(--sans);
}
.comment-reply-post,
.comment-composer-post {
  align-self: flex-end;
  margin: 0;
}
.comment-composer-post {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--island);
  color: var(--ink);
  font: 600 12px/1 var(--sans);
  cursor: pointer;
}
.comment-composer-post:hover { background: var(--field); }

.comment-composer {
  position: fixed;
  z-index: 90;
  width: 260px;
  max-width: calc(100vw - 16px);
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
}
.comments-panel,
.comment-composer,
.comment-reply-text,
.comment-composer-text {
  -webkit-user-select: text;
  user-select: text;
}

.comments-pins {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  overflow: visible;
}
.comment-pin {
  position: absolute;
  z-index: 12;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--island);
  box-shadow: var(--shadow);
  pointer-events: auto;
  transform: translate(-50%, -50%);
  cursor: pointer;
}
.comment-pin::before {
  content: "";
  display: block;
  width: 10px;
  height: 8px;
  margin: 6px auto 0;
  border: 1.6px solid var(--ink);
  border-radius: 2px 2px 2px 0;
}
.comment-pin.is-on {
  outline: 2px solid var(--sel);
  outline-offset: 0;
  background: var(--island);
}

@media (pointer: coarse), (max-width: 1023px) {
  .comments-hide,
  .comments-back {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 10px;
  }
  .comment-row-hit {
    min-height: 44px;
    padding: 10px;
  }
  .comment-reply {
    padding: 10px;
  }
}

@media (max-width: 1023px) {
  .comments-panel {
    top: auto;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: calc(66px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    max-height: min(58dvh, calc(100dvh - 128px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    border-radius: 16px 16px 12px 12px;
  }
}
