:root {
  --bg: #efe6d6;
  --bg-2: #e6dccb;
  --ink: #123d31;
  --muted: #5e6d64;
  --line: rgba(16, 63, 49, 0.26);
  --panel: rgba(255, 252, 242, 0.88);
  --panel-solid: rgba(255, 252, 242, 0.92);
  --green: #123f32;
  --green-2: #164d3c;
  --gold: #9d6a24;
  --orange: #d17a13;
  --edge: rgba(12, 72, 52, 0.18);
  --primary-edge: rgba(12, 72, 52, 0.36);
  --primary-ring: rgba(12, 72, 52, 0.78);
  --node-fill: rgba(255, 252, 242, 0.9);
  --node-stroke: rgba(12, 72, 52, 0.56);
  --node-text: #103f31;
  --category-fill: rgba(255, 255, 248, 0.92);
  --category-stroke: rgba(12, 72, 52, 0.78);
  --category-text: #0b3b2e;
  --selected-fill: rgba(249, 223, 173, 0.95);
  --selected-text: #2b2112;
  --neighbor-fill: rgba(255, 244, 211, 0.92);
  --neighbor-stroke: #b6812f;
  --neighbor-text: #2b2112;
  --neighbor-edge: rgba(157, 106, 36, 0.48);
  --root-fill: rgba(245, 235, 213, 0.74);
  --root-stroke: rgba(12, 72, 52, 0.36);
  --shadow: 0 20px 52px rgba(27, 38, 32, 0.14);
  --radius: 8px;
  --font-scale: 1;
  color-scheme: light;
}

html.theme-dark,
body.theme-dark {
  --bg: #101613;
  --bg-2: #17211d;
  --ink: #f2efe6;
  --muted: #aeb9b2;
  --line: rgba(237, 225, 202, 0.16);
  --panel: rgba(25, 34, 30, 0.84);
  --panel-solid: #1a241f;
  --green: #d7eadb;
  --green-2: #9fc9ad;
  --gold: #d9ad60;
  --orange: #f09a3e;
  --edge: rgba(215, 234, 219, 0.2);
  --primary-edge: rgba(255, 255, 255, 0.52);
  --primary-ring: rgba(255, 255, 255, 0.84);
  --node-fill: #1a241f;
  --node-stroke: #9fc9ad;
  --node-text: #f2efe6;
  --category-fill: color-mix(in srgb, var(--panel-solid) 82%, var(--green-2));
  --category-stroke: rgba(255, 255, 255, 0.84);
  --category-text: #fffaf0;
  --selected-fill: color-mix(in srgb, var(--orange) 24%, var(--panel-solid));
  --selected-text: #f2efe6;
  --neighbor-fill: rgba(45, 61, 52, 0.9);
  --neighbor-stroke: #d9ad60;
  --neighbor-text: #fffaf0;
  --neighbor-edge: rgba(217, 173, 96, 0.5);
  --root-fill: color-mix(in srgb, var(--green) 72%, transparent);
  --root-stroke: color-mix(in srgb, var(--primary-ring) 46%, transparent);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  color-scheme: dark;
}

html.font-small,
body.font-small { --font-scale: 0.92; }
html.font-large,
body.font-large { --font-scale: 1.12; }

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: calc(16px * var(--font-scale));
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(255, 250, 238, 0.24), transparent 42%),
    linear-gradient(235deg, rgba(142, 96, 36, 0.09), transparent 40%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.zoom-controls button:focus-visible,
.globe-node:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--orange) 78%, white);
  outline-offset: 3px;
}

.page-globe {
  height: 100vh;
  overflow: hidden;
}

.top-search {
  position: fixed;
  z-index: 40;
  top: 28px;
  left: 104px;
  width: min(300px, calc(100vw - 128px));
  display: grid;
  gap: 3px;
  padding: 0;
  background: transparent;
}

.search-form {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: center;
  height: 34px;
  padding-left: 2px;
  background: rgba(255, 252, 242, 0.1);
  backdrop-filter: blur(4px);
  transition: background 0.18s ease, backdrop-filter 0.18s ease;
}

.search-form:focus-within {
  background: rgba(255, 252, 242, 0.3);
  backdrop-filter: blur(8px);
}

.search-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--muted);
  opacity: 0.74;
}

.search-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-form input {
  width: 100%;
  padding: 5px 2px;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--green) 58%, transparent);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  outline-offset: 2px;
  transition: border-color 0.18s ease;
}

.search-form:focus-within input {
  border-bottom-color: color-mix(in srgb, var(--green-2) 72%, var(--gold));
}

.search-message {
  min-height: 14px;
  margin: -2px 0 0 22px;
  color: var(--orange);
  font-size: 0.72em;
}

.search-suggestions {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 18px rgba(27, 38, 32, 0.06);
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 6px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.search-suggestions button:hover,
.search-suggestions button:focus-visible {
  background: rgba(182, 129, 47, 0.14);
}

.search-suggestions strong {
  font-size: 0.9em;
}

.search-suggestions span,
.search-suggestions p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76em;
}

.globe-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.globe-stage.dragging {
  cursor: grabbing;
}

.globe-edges,
.globe-nodes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.globe-edges {
  z-index: 1;
  pointer-events: none;
}

.globe-edge {
  stroke: var(--edge);
  stroke-width: 0.85;
  stroke-linecap: round;
  transition: opacity 0.16s ease, stroke 0.16s ease, stroke-width 0.16s ease;
}

.globe-edge.primary {
  stroke: var(--primary-edge);
  stroke-width: 1.15;
}

.globe-edge.active {
  stroke: var(--orange);
  stroke-width: 3;
}

.globe-edge.hierarchy-child-edge:not(.active) {
  stroke: color-mix(in srgb, var(--orange) 58%, var(--gold));
  stroke-width: 2.1;
}

.globe-edge.neighbor-edge:not(.active):not(.component-neighbor):not(.influences-neighbor):not(.contrast-neighbor) {
  stroke: var(--neighbor-edge);
  stroke-width: 1.85;
}

.globe-edge.component-neighbor:not(.active) {
  stroke: var(--neighbor-edge);
  stroke-width: 1.7;
  stroke-dasharray: 2 5;
}

.globe-edge.influences-neighbor:not(.active) {
  stroke: color-mix(in srgb, #2e8b74 70%, var(--gold));
  stroke-width: 1.8;
  stroke-dasharray: 8 4;
}

.globe-edge.contrast-neighbor:not(.active) {
  stroke: color-mix(in srgb, #6b6f7a 68%, var(--gold));
  stroke-width: 1.55;
  stroke-dasharray: 3 6;
}

.globe-edge.related-neighbor:not(.active),
.globe-edge.related:not(.active):not(.neighbor-edge) {
  stroke: var(--neighbor-edge);
  stroke-dasharray: 4 8;
  stroke-width: 1;
}

.globe-edge.context-edge:not(.active):not(.neighbor-edge) {
  stroke: color-mix(in srgb, var(--green) 36%, transparent);
  stroke-width: 0.9;
  stroke-dasharray: 2 8;
}

.globe-nodes {
  z-index: 2;
  pointer-events: none;
}

.globe-node {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: var(--node-size, 74px);
  height: var(--node-size, 74px);
  border: 2px solid var(--node-stroke);
  border-radius: 50%;
  background: var(--node-fill);
  color: var(--node-text);
  box-shadow: 0 10px 22px rgba(18, 31, 26, 0.1);
  cursor: pointer;
  pointer-events: auto;
  transform:
    translate3d(calc(var(--screen-x, 0px) - 50%), calc(var(--screen-y, 0px) - 50%), 0)
    scale(var(--node-scale, 1));
  transition:
    opacity 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.globe-node:not(.hidden) {
  animation: nodeMaterialize 0.22s ease;
}

.globe-node span {
  display: block;
  max-width: 88%;
  color: inherit;
  font-size: var(--label-size, 0.86rem);
  font-weight: 700;
  line-height: 1.04;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  word-break: keep-all;
  overflow-wrap: anywhere;
  opacity: var(--label-opacity, 1);
  transition: opacity 0.16s ease;
}

.globe-node.depth-0 {
  --node-size: 124px;
  --label-size: 1rem;
  border-color: var(--root-stroke);
  border-width: 2px;
  background: var(--root-fill);
  color: var(--green);
  box-shadow:
    0 0 20px rgba(12, 72, 52, 0.1),
    0 10px 30px rgba(18, 31, 26, 0.08);
}

.globe-node.depth-1 {
  --node-size: 96px;
  --label-size: 0.96rem;
  border-color: var(--category-stroke);
  border-width: 2.8px;
  background: var(--category-fill);
  color: var(--category-text);
  box-shadow: 0 14px 32px rgba(18, 31, 26, 0.14);
}

.globe-node.depth-2 {
  --node-size: 64px;
  --label-size: 0.78rem;
  --label-opacity: 0.08;
  border-width: 1.5px;
}

.globe-node.depth-3 {
  --node-size: 50px;
  --label-size: 0.64rem;
  --label-opacity: 0;
  border-width: 1.2px;
  background: color-mix(in srgb, var(--node-fill) 86%, var(--gold));
}

.globe-node.active {
  border-color: var(--orange);
  border-width: 3px;
  background: var(--selected-fill);
  color: var(--selected-text);
  box-shadow: 0 16px 34px rgba(209, 122, 19, 0.26);
}

.globe-node.neighbor:not(.active):not(.path-active) {
  border-color: var(--neighbor-stroke);
  background: var(--neighbor-fill);
  color: var(--neighbor-text);
  box-shadow: 0 14px 30px rgba(157, 106, 36, 0.18);
}

.globe-node.component-neighbor:not(.active):not(.path-active) {
  border-color: color-mix(in srgb, var(--neighbor-stroke) 82%, var(--node-stroke));
  background: color-mix(in srgb, var(--neighbor-fill) 68%, var(--node-fill));
}

.globe-node.influences-neighbor:not(.active):not(.path-active) {
  border-color: color-mix(in srgb, #2e8b74 70%, var(--neighbor-stroke));
}

.globe-node.contrast-neighbor:not(.active):not(.path-active) {
  border-color: color-mix(in srgb, #6b6f7a 68%, var(--neighbor-stroke));
}

.globe-node.related:not(.active):not(.path-active):not(.neighbor) {
  border-color: color-mix(in srgb, var(--neighbor-stroke) 58%, var(--node-stroke));
}

.globe-node.context:not(.active):not(.path-active):not(.neighbor) {
  border-color: color-mix(in srgb, var(--node-stroke) 62%, transparent);
  background: color-mix(in srgb, var(--node-fill) 82%, transparent);
  color: color-mix(in srgb, var(--node-text) 72%, transparent);
  box-shadow: none;
}

.globe-node.label-visible span,
.globe-node:hover span,
.globe-node:focus-visible span {
  opacity: 1;
}

.globe-node.depth-2:hover,
.globe-node.depth-2:focus-visible,
.globe-node.depth-3:hover,
.globe-node.depth-3:focus-visible {
  border-color: var(--gold);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(157, 106, 36, 0.18);
}

body.theme-dark .globe-node.depth-2:hover,
body.theme-dark .globe-node.depth-2:focus-visible,
body.theme-dark .globe-node.depth-3:hover,
body.theme-dark .globe-node.depth-3:focus-visible {
  color: var(--ink);
}

.globe-node.depth-0.active {
  border-color: var(--root-stroke);
  background: var(--root-fill);
  color: var(--green);
}

.globe-node.depth-1.active,
.globe-node.depth-1.path-active {
  border-color: var(--orange);
  color: var(--selected-text);
}

.globe-node.path-active {
  border-color: var(--orange);
}

.globe-node.muted {
  filter: saturate(0.72);
}

.globe-node.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.debug-badge {
  position: fixed;
  z-index: 54;
  right: 18px;
  top: 18px;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--orange) 52%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.debug-badge[hidden] {
  display: none;
}

body.debug-all-nodes .globe-edge {
  stroke: color-mix(in srgb, var(--green) 42%, transparent);
  stroke-width: 0.75;
}

body.debug-all-nodes .globe-edge.active {
  stroke: var(--orange);
  stroke-width: 2.5;
}

body.debug-all-nodes .globe-edge.primary {
  stroke-width: 1;
}

body.debug-all-nodes .globe-node {
  --label-opacity: 1;
  border-color: color-mix(in srgb, var(--node-stroke) 78%, transparent);
  box-shadow: 0 8px 18px rgba(18, 31, 26, 0.08);
}

body.debug-all-nodes .globe-node.depth-2 {
  --node-size: 58px;
  --label-size: 0.68rem;
}

body.debug-all-nodes .globe-node.depth-3 {
  --node-size: 46px;
  --label-size: 0.56rem;
}

body.debug-all-nodes .globe-node span {
  max-width: 96%;
  opacity: 1;
  font-weight: 700;
  word-break: break-word;
  overflow-wrap: anywhere;
}

body.debug-all-nodes .globe-node.muted {
  filter: none;
}

@keyframes nodeMaterialize {
  from {
    transform:
      translate3d(calc(var(--screen-x, 0px) - 50%), calc(var(--screen-y, 0px) - 50%), 0)
      scale(calc(var(--node-scale, 1) * 0.86));
  }
  to {
    transform:
      translate3d(calc(var(--screen-x, 0px) - 50%), calc(var(--screen-y, 0px) - 50%), 0)
      scale(var(--node-scale, 1));
  }
}

@media (prefers-reduced-motion: reduce) {
  .globe-node,
  .globe-edge {
    transition: none;
  }

  .globe-node:not(.hidden) {
    animation: none;
  }
}

.brand-icon {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.brand-icon-dark {
  display: none;
}

html.theme-dark .brand-icon-light,
body.theme-dark .brand-icon-light {
  display: none;
}

html.theme-dark .brand-icon-dark,
body.theme-dark .brand-icon-dark {
  display: block;
}

.page-nav {
  position: fixed;
  z-index: 45;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 80px;
  height: 100vh;
  padding: 24px 12px 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.page-nav a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1;
}

.page-nav a:not(.nav-logo) {
  font-size: 1.52rem;
}

.page-nav .nav-logo {
  margin-bottom: 4px;
}

.page-nav .nav-logo .brand-icon {
  width: 40px;
  height: 40px;
}

.page-nav a.active:not(.nav-logo) {
  background: var(--green);
  color: var(--panel-solid);
}

.page-nav .nav-star svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-nav .nav-search svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-nav .nav-star:hover,
.page-nav .nav-star:focus-visible,
.page-nav .nav-search:hover,
.page-nav .nav-search:focus-visible {
  color: var(--orange);
}

.page-nav .nav-star.active svg {
  fill: currentColor;
}

.node-drawer,
.settings-drawer {
  position: fixed;
  z-index: 50;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
  border: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

.drawer-backdrop.open {
  pointer-events: auto;
}

.node-drawer {
  right: 0;
  top: 0;
  bottom: 0;
  width: clamp(380px, 30vw, 440px);
  height: 100vh;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 8px 32px;
  border-width: 0 0 0 1px;
  border-radius: 0;
  box-shadow: -18px 0 42px rgba(3, 12, 10, 0.22);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.node-drawer.open {
  transform: translateX(0);
}

.node-drawer.has-threads {
  padding: 26px 8px 30px;
}

.drawer-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78em;
  font-weight: 700;
}

.node-drawer h1 {
  margin: 0 0 12px;
  font-size: clamp(1.55em, 2.1vw, 1.95em);
  line-height: 1.28;
}

.node-drawer.has-threads h1 {
  margin-bottom: 8px;
}

.node-drawer p {
  line-height: 1.8;
}

.node-drawer .drawer-label {
  padding-right: 0;
}

.thread-action.favorite-pop svg {
  animation: favoriteStarPop 240ms cubic-bezier(0.2, 1.5, 0.35, 1);
  transform-origin: center;
}

.thread-action.favorite-pop::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle, currentColor 0 2px, transparent 2.5px) 50% 0 / 5px 5px no-repeat,
    radial-gradient(circle, currentColor 0 1.5px, transparent 2px) 100% 45% / 5px 5px no-repeat,
    radial-gradient(circle, currentColor 0 1.5px, transparent 2px) 50% 100% / 5px 5px no-repeat,
    radial-gradient(circle, currentColor 0 1.5px, transparent 2px) 0 45% / 5px 5px no-repeat;
  opacity: 0;
  animation: favoriteBurst 260ms ease-out;
}

.sample-cards {
  display: grid;
  gap: 0;
  width: 100%;
  margin: 14px 0 0;
  padding: 0;
}

.node-drawer.has-threads .sample-cards {
  margin: 10px 0 0;
}

.sample-card,
.thread-card {
  width: 100%;
  margin: 0;
  padding: 12px 0 10px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.drawer-empty {
  width: 100%;
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9em;
  line-height: 1.6;
}

.auth-required-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 18px;
  background: color-mix(in srgb, var(--bg) 58%, transparent);
  backdrop-filter: blur(10px);
}

.auth-required-dialog,
.account-list-popover {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(27, 38, 32, 0.18);
}

.auth-required-dialog {
  width: min(320px, 100%);
  padding: 16px;
}

.auth-required-dialog p {
  margin: 0 0 14px;
  color: var(--ink);
  line-height: 1.6;
}

.auth-required-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auth-required-actions a,
.auth-required-actions button {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0 12px;
  text-decoration: none;
  cursor: pointer;
}

.account-list-popover {
  position: fixed;
  z-index: 90;
  width: 238px;
  max-width: calc(100vw - 24px);
  display: grid;
  gap: 5px;
  padding: 10px;
  backdrop-filter: blur(18px);
}

.account-list-popover[hidden] {
  display: none;
}

.account-popover-list,
.account-popover-form {
  display: grid;
  align-items: center;
}

.account-popover-list {
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 7px 2px;
  text-align: left;
  cursor: pointer;
}

.account-popover-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82em;
  font-weight: 700;
}

.account-popover-list small,
.account-empty-list {
  color: var(--muted);
  font-size: 0.76em;
}

.account-popover-list svg,
.account-popover-form svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-popover-form {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.account-popover-form input {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 2px;
  font-size: 0.78em;
}

.account-popover-form button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.thread-list {
  display: grid;
  gap: 0;
  width: 100%;
  margin: 0;
  padding: 0;
}

.thread-list > strong {
  display: none;
}

body.theme-dark .thread-card {
  background: transparent;
}

.thread-card-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 8px;
  color: var(--muted);
  font-size: 0.76em;
  line-height: 1.38;
}

.thread-card-head strong {
  color: var(--ink);
  font-size: 1em;
  font-weight: 800;
  line-height: inherit;
  overflow-wrap: anywhere;
}

.thread-card-head span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.thread-source-media {
  display: inline-flex;
  align-items: center;
  min-height: 1em;
  line-height: 1;
}

.thread-source-logo-img,
.thread-source-logo-svg {
  display: inline-block;
  flex: 0 0 auto;
  width: 1.02em;
  height: 1.02em;
  color: currentColor;
  opacity: 0.82;
  vertical-align: -0.14em;
}

.thread-source-logo-img {
  object-fit: contain;
}

.thread-source-logo-img-x {
  box-sizing: border-box;
  padding: 0.18em;
  border-radius: 999px;
  background: #111;
}

.thread-source-logo-img-instagram {
  box-sizing: border-box;
  padding: 0.06em;
  border-radius: 0.24em;
  background: rgba(255, 255, 255, 0.86);
}

.thread-source-logo-img-youtube {
  width: 1.16em;
}

.thread-source-logo-svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thread-card-head span::before,
.thread-card-head time::before {
  content: "/";
  margin-right: 8px;
  color: color-mix(in srgb, var(--muted) 58%, transparent);
}

.thread-card-head time {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  font-size: 1em;
  font-weight: 600;
}

.thread-card-body {
  margin-top: 6px;
  margin-left: 12px;
}

.thread-card-title {
  display: none;
}

.thread-card-body p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 1em;
  line-height: 1.66;
  overflow-wrap: anywhere;
}

.thread-media {
  display: grid;
  gap: 6px;
  margin-top: 9px;
  margin-left: 12px;
  width: calc(100% - 12px);
}

.thread-media-item {
  display: block;
  width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: color-mix(in srgb, var(--panel-solid) 82%, var(--green) 8%);
  object-fit: cover;
}

.thread-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
  margin-left: 12px;
  max-width: calc(100% - 12px);
}

.thread-action {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  overflow: visible;
}

.thread-action svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thread-action.active {
  color: var(--orange);
}

.thread-action.active svg {
  fill: currentColor;
}

.thread-action:hover,
.thread-action:focus-visible {
  background: transparent;
  color: var(--orange);
}

.thread-action-detail {
  margin-left: auto;
  width: 28px;
  height: 28px;
  color: color-mix(in srgb, var(--muted) 82%, var(--ink));
}

.thread-action-detail svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.65;
}

.thread-action-detail:hover,
.thread-action-detail:focus-visible {
  color: var(--green);
}

@keyframes favoriteStarPop {
  0% {
    transform: scale(0.92);
  }
  45% {
    transform: scale(1.28);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes favoriteBurst {
  0% {
    opacity: 0;
    transform: scale(0.72);
  }
  40% {
    opacity: 0.62;
  }
  100% {
    opacity: 0;
    transform: scale(1.42);
  }
}

@media (prefers-reduced-motion: reduce) {
  .thread-action.favorite-pop svg,
  .thread-action.favorite-pop::after {
    animation: none;
  }
}

.settings-button {
  position: fixed;
  z-index: 52;
  left: 19px;
  right: auto;
  bottom: 24px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--green);
  box-shadow: none;
  backdrop-filter: none;
  cursor: pointer;
  opacity: 0.88;
  transition: left 0.22s ease, bottom 0.22s ease, opacity 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

body.drawer-open .settings-button {
  left: 19px;
}

.settings-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zoom-controls {
  position: fixed;
  z-index: 52;
  left: 96px;
  right: auto;
  bottom: 27px;
  display: grid;
  grid-template-columns: 30px 116px 30px 34px;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(27, 38, 32, 0.16);
  transition: left 0.22s ease, bottom 0.22s ease, transform 0.22s ease;
}

body.drawer-open .zoom-controls {
  left: 96px;
}

.zoom-controls button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--green);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.zoom-controls button:hover {
  background: color-mix(in srgb, var(--green) 9%, transparent);
}

.zoom-controls input[type="range"] {
  width: 116px;
  accent-color: var(--gold);
}

body:not(.theme-dark) .zoom-controls input[type="range"] {
  accent-color: var(--orange);
}

.settings-button:hover,
.settings-button:focus-visible {
  opacity: 1;
  color: var(--orange);
  transform: translateY(-1px);
}

body.theme-dark .settings-button {
  color: var(--muted);
}

body:not(.theme-dark) .settings-button {
  color: var(--muted);
}

body:not(.theme-dark) .node-drawer,
body:not(.theme-dark) .settings-drawer,
body:not(.theme-dark) .search-suggestions {
  background: rgba(255, 252, 242, 0.94);
  border-color: rgba(16, 63, 49, 0.2);
}

.settings-drawer {
  left: 96px;
  right: auto;
  bottom: 24px;
  width: 286px;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}

.settings-drawer.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.settings-drawer h2 {
  margin: 0 38px 14px 0;
  font-size: 1.1em;
}

.setting-group + .setting-group {
  margin-top: 14px;
}

.setting-group p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9em;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  padding: 8px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: var(--green);
  color: var(--panel-solid);
}

.operator-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74em;
}

.operator-logo {
  display: block;
  width: 82px;
  height: 22px;
  object-fit: contain;
  object-position: left center;
}

.logo-dark {
  display: none;
}

body.theme-dark .logo-light {
  display: none;
}

body.theme-dark .logo-dark {
  display: block;
}

@media (max-width: 899px) {
  .node-drawer {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 78px;
    width: auto;
    height: auto;
    max-height: 46vh;
    padding: 18px 8px 20px;
    border-width: 1px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transform: translateY(calc(100% + 96px));
  }

  .node-drawer.has-threads {
    padding: 18px 8px 20px;
  }

  .node-drawer.open {
    transform: translateY(0);
  }

  .node-drawer h1 {
    font-size: 1.65em;
  }

  body.drawer-open .zoom-controls {
    left: 96px;
    right: auto;
    bottom: calc(46vh + 98px);
    transform: none;
  }

  body.drawer-open .settings-button {
    left: 96px;
    right: auto;
    bottom: calc(46vh + 150px);
  }
}

@media (max-width: 760px) {
  .top-search {
    top: 10px;
    left: 10px;
    width: min(330px, calc(100vw - 20px));
  }

  .node-drawer {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 78px;
    width: auto;
    max-height: 46vh;
    transform: translateY(calc(100% + 96px));
  }

  .node-drawer.open {
    transform: translateY(0);
  }

  .sample-card,
  .thread-card {
    padding: 13px 0 11px;
  }

  .thread-card-head {
    font-size: 0.76em;
    line-height: 1.38;
  }

  .thread-card-body {
    margin-top: 6px;
    margin-left: 10px;
  }

  .thread-card-body p {
    -webkit-line-clamp: 3;
    font-size: 1em;
    line-height: 1.68;
  }

  .thread-actions {
    margin-top: 6px;
    margin-left: 10px;
    width: calc(100% - 10px);
  }

  .page-nav {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    flex-direction: row;
    justify-content: space-around;
    gap: 6px;
    width: auto;
    height: auto;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
  }

  .page-nav a {
    flex: 1;
    width: auto;
    height: 40px;
  }

  .page-nav .nav-logo {
    display: none;
  }

  .zoom-controls {
    left: 14px;
    right: auto;
    bottom: 82px;
    grid-template-columns: 28px 88px 28px 30px;
    height: 40px;
    padding: 5px 7px;
  }

  .zoom-controls button {
    width: 28px;
    height: 28px;
  }

  .zoom-controls input[type="range"] {
    width: 88px;
  }

  body.drawer-open .zoom-controls {
    left: 14px;
    right: auto;
    bottom: calc(46vh + 96px);
    transform: none;
  }

  .settings-button {
    left: 14px;
    right: auto;
    bottom: 134px;
    width: 40px;
    height: 40px;
  }

  body.drawer-open .settings-button {
    left: 14px;
    right: auto;
    bottom: calc(46vh + 146px);
  }

  .settings-drawer {
    left: 14px;
    right: 14px;
    bottom: 186px;
    width: auto;
  }
}
