:root {
  --review-panel-width: minmax(320px, 1fr);
}

body.inline-review-ready {
  display: block !important;
  min-width: 0;
}

.archive-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  color: #fff;
  background: #2b2b2b;
}

.archive-site-header a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.archive-site-header a:first-child {
  justify-self: start;
}

.archive-site-header a:last-child {
  justify-self: end;
}

.archive-site-header-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}

.archive-site-header a:hover,
.archive-site-header a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.reading-layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  transition: grid-template-columns .22s ease;
}

.reading-layout.comments-open {
  grid-template-columns: minmax(0, 2fr) var(--review-panel-width);
}

.reading-layout > .phone,
.reading-layout > .phone-frame {
  width: min(900px, 100%) !important;
  max-width: 900px !important;
  margin: 0 auto !important;
  min-width: 0;
}

.reading-layout.comments-open > .phone,
.reading-layout.comments-open > .phone-frame {
  width: 100% !important;
}

.reading-layout .chat-body {
  overflow: visible !important;
}

.reading-layout .bubble-wrapper,
.reading-layout .bubble-wrap {
  max-width: min(84%, 720px) !important;
  min-width: 0;
}

.reading-layout .message-row.user .bubble-wrapper,
.reading-layout .msg-row.me .bubble-wrap {
  max-width: min(78%, 680px) !important;
}

.reviewable-message {
  position: relative;
}

.inline-comment-button {
  position: absolute;
  top: 4px;
  z-index: 4;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid #cad2cd;
  border-radius: 999px;
  color: #66716b;
  background: rgba(255,255,255,.94);
  box-shadow: 0 2px 7px rgba(0,0,0,.06);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
  cursor: pointer;
  opacity: .24;
  transition: opacity .16s ease, border-color .16s ease, color .16s ease, background .16s ease;
}

.message-row.ai .inline-comment-button,
.msg-row:not(.me) .inline-comment-button {
  right: 0;
}

.message-row.user .inline-comment-button,
.msg-row.me .inline-comment-button {
  left: 0;
}

.reviewable-message:hover .inline-comment-button,
.inline-comment-button:focus-visible,
.inline-comment-button.has-comments,
.reviewable-message.is-commenting .inline-comment-button {
  opacity: 1;
}

.inline-comment-button:hover,
.inline-comment-button:focus-visible,
.reviewable-message.is-commenting .inline-comment-button {
  border-color: #8fd7ae;
  color: #078f49;
  background: #e8f7ee;
  outline: none;
}

.inline-comment-panel {
  display: none;
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  border-left: 1px solid #d8d8d8;
  background: #fff;
  box-shadow: -8px 0 24px rgba(0,0,0,.06);
  overflow: hidden;
}

.comments-open .inline-comment-panel {
  display: flex;
  flex-direction: column;
}

.inline-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 16px;
  border-bottom: 1px solid #e2e2e2;
  background: #fafafa;
}

.inline-panel-heading {
  min-width: 0;
}

.inline-panel-kicker {
  margin: 0;
  color: #078f49;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.inline-panel-title {
  margin: 1px 0 0;
  color: #222;
  font-size: 16px;
}

.inline-panel-close {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #d2d2d2;
  border-radius: 7px;
  color: #444;
  background: #fff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.inline-panel-close:hover,
.inline-panel-close:focus-visible {
  border-color: #8fd7ae;
  outline: 3px solid rgba(7,168,84,.15);
}

.comment-context {
  margin: 14px 16px 0;
  padding: 11px 12px;
  border-left: 3px solid #07a854;
  border-radius: 0 7px 7px 0;
  color: #555;
  background: #f4f7f5;
  font-size: 12px;
  line-height: 1.65;
}

.inline-giscus-host {
  flex: 1;
  min-height: 0;
  padding: 10px 16px 22px;
  overflow-y: auto;
}

.inline-panel-empty {
  padding: 30px 18px;
  color: #777;
  font-size: 13px;
  line-height: 1.7;
}

dialog.discussion-panel {
  display: none !important;
}

.whole-discussion {
  width: min(860px, calc(100% - 24px));
  margin: 30px auto 22px;
  padding: 22px;
  border: 1px solid #d6d6d6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 20px rgba(0,0,0,.05);
}

.whole-discussion h2 {
  margin: 0 0 7px;
  color: #222;
  font-size: 20px;
}

.whole-discussion-lead {
  margin: 0 0 18px;
  color: #666;
  font-size: 13px;
  line-height: 1.7;
}

.whole-discussion .discussion-card {
  min-height: 0 !important;
}

.whole-discussion .discussion-intro {
  display: none;
}

.whole-discussion .discussion-note {
  margin-top: 12px;
}

@media (max-width: 980px) {
  .archive-site-header {
    padding: 0 10px;
  }

  .archive-site-header-title {
    font-size: 13px;
  }

  .reading-layout.comments-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .reading-layout > .phone,
  .reading-layout > .phone-frame,
  .reading-layout.comments-open > .phone,
  .reading-layout.comments-open > .phone-frame {
    width: min(900px, 100%) !important;
  }

  .inline-comment-panel {
    position: fixed;
    inset: auto 0 0;
    z-index: 200;
    width: 100%;
    height: min(74vh, 720px);
    border-top: 1px solid #ccc;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 32px rgba(0,0,0,.16);
  }

  .comments-open .inline-comment-panel {
    display: flex;
  }
}

@media (max-width: 560px) {
  .reading-layout .bubble-wrapper,
  .reading-layout .bubble-wrap,
  .reading-layout .message-row.user .bubble-wrapper,
  .reading-layout .msg-row.me .bubble-wrap {
    max-width: calc(100% - 48px) !important;
  }

  .inline-comment-button {
    top: auto;
    bottom: -8px;
    opacity: .76;
    padding: 2px 7px;
  }

  .whole-discussion {
    width: calc(100% - 20px);
    padding: 17px 14px;
  }
}
