/* =====================================
   Portfolio - Dead Simple Style
   ===================================== */

:root {
  /* Colors - Light Theme */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F5F5F5;
  --bg-hover: #EBEBEB;
  --text-primary: #000000;
  --text-secondary: #5f5f5f;
  --text-muted: #6f6f6f;
  --border-color: #E5E5E5;

  /* Typography */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Spacing */
  --sidebar-width: 320px;
  --main-max-width: 1560px;
  --desktop-frame-half: 940px;
  --content-padding: 32px;
  --card-padding: 24px;
  --card-gap: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-family);
  font-weight: 400;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 4px;
}

/* =====================================
   Two-Column Layout
   ===================================== */

.layout {
  display: flex;
  max-width: calc(var(--sidebar-width) + var(--main-max-width));
  margin: 0 auto;
  min-height: 100vh;
  padding-left: var(--sidebar-width);
}

/* Sidebar - Fixed Left Column */
.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  padding: var(--content-padding);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-content {
  flex: 1;
}

.sidebar-mobile-toggle {
  display: none;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
}

/* Main Content - Scrollable Right Column */
.main-content {
  flex: none;
  margin-left: auto;
  margin-right: auto;
  max-width: var(--main-max-width);
  padding: var(--content-padding);
  width: 100%;
  min-height: 100vh;
}

/* =====================================
   Sidebar Elements
   ===================================== */

.logo {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 32px;
  display: inline-block;
}

.logo:hover {
  opacity: 0.7;
}

.profile-section {
  margin-bottom: 32px;
}

.profile-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
}

.profile-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.profile-bio {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.social-link {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.social-link:hover {
  color: var(--text-primary);
}

/* Photo Grid in Sidebar */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 24px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.photo-grid img:hover {
  opacity: 1;
}

.sidebar-credits {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-credits a {
  color: var(--text-muted);
  text-decoration: none;
}

.sidebar-credits a:hover {
  color: var(--text-primary);
}

/* =====================================
   Category Tabs
   ===================================== */

.category-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg-primary);
}

.category-tab {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 0;
  cursor: pointer;
  transition: color 0.2s ease;
  background: none;
  border: none;
  position: relative;
}

.category-tab:hover {
  color: var(--text-secondary);
}

.category-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -17px;
  height: 2px;
  background-color: transparent;
}

.category-tab.active {
  color: var(--text-primary);
  font-weight: 600;
}

.category-tab.active::after {
  background-color: var(--text-primary);
}

/* =====================================
   Card Grid
   ===================================== */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--card-gap);
}

.card {
  background-color: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: var(--card-padding);
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 16px;
}

.card-kicker {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-meta span::after {
  content: "•";
  margin-left: 8px;
}

.card-meta span:last-child::after {
  content: "";
  margin-left: 0;
}

.card-action {
  display: inline-block;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  width: fit-content;
}

a.card-action {
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

a.card-action:hover,
a.card-action:focus-visible {
  border-bottom-color: currentColor;
}

.featured-section {
  margin-bottom: 48px;
}

.featured-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 1200px;
}

.featured-card {
  min-height: 220px;
}

.section-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-summary {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-top: -12px;
  max-width: 560px;
}

.writing-intro {
  margin-bottom: 32px;
}

.writing-title {
  margin-bottom: 20px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.writing-intro .section-summary {
  margin-top: 0;
}

.writing-group + .writing-group {
  margin-top: 48px;
}

.writing-group-title {
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.research-feature-grid {
  max-width: 720px;
  grid-template-columns: minmax(0, 1fr);
}

.research-feature-card {
  min-height: 220px;
}

.blog-writing-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 1600px) {
  .blog-writing-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--card-gap);
  max-width: 920px;
}

.skill-group {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 18px;
}

.skill-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.skill-list {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* Tag/Badge Styles */
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background-color: var(--bg-hover);
  color: var(--text-secondary);
}

/* =====================================
   Timeline / Roadmap Styles
   ===================================== */

.timeline {
  position: relative;
  padding-left: 0;
  max-width: 920px;
}

.timeline-item {
  position: relative;
  padding-left: 24px;
  padding-bottom: 32px;
  border-left: 1px solid var(--border-color);
}

.timeline-item:last-child {
  padding-bottom: 0;
  border-left-color: transparent;
}

.timeline-item:first-child {
  border-left-color: var(--text-primary);
}

.timeline-content {
  padding: 0;
  transition: opacity 0.2s ease;
}

.timeline-content:hover {
  opacity: 0.7;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-date {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.timeline-company {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.timeline-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.timeline-description + .timeline-description {
  margin-top: 8px;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}

.timeline-meta span {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  line-height: 1;
  padding: 5px 9px;
}

/* =====================================
   Section Headers
   ===================================== */

.section-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* =====================================
   Blog/Writing Cards
   ===================================== */

.blog-card {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.blog-card:last-child {
  border-bottom: none;
}

.blog-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.blog-card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.blog-card-date {
  font-size: 14px;
  color: var(--text-muted);
}

.blog-card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
}

/* =====================================
   Animations
   ===================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Staggered animation for cards */
.cards-grid .card {
  animation: fadeIn 0.4s ease-out both;
}

.cards-grid .card:nth-child(1) {
  animation-delay: 0.05s;
}

.cards-grid .card:nth-child(2) {
  animation-delay: 0.1s;
}

.cards-grid .card:nth-child(3) {
  animation-delay: 0.15s;
}

.cards-grid .card:nth-child(4) {
  animation-delay: 0.2s;
}

.cards-grid .card:nth-child(5) {
  animation-delay: 0.25s;
}

.cards-grid .card:nth-child(6) {
  animation-delay: 0.3s;
}

.cards-grid .card:nth-child(7) {
  animation-delay: 0.35s;
}

.cards-grid .card:nth-child(8) {
  animation-delay: 0.4s;
}

/* Staggered animation for timeline items */
.timeline .timeline-item {
  animation: fadeIn 0.4s ease-out both;
}

.timeline .timeline-item:nth-child(1) {
  animation-delay: 0.05s;
}

.timeline .timeline-item:nth-child(2) {
  animation-delay: 0.1s;
}

.timeline .timeline-item:nth-child(3) {
  animation-delay: 0.15s;
}

.timeline .timeline-item:nth-child(4) {
  animation-delay: 0.2s;
}

.timeline .timeline-item:nth-child(5) {
  animation-delay: 0.25s;
}

/* =====================================
   Responsive Design
   ===================================== */

@media (min-width: 1800px) {
  :root {
    --content-padding: 40px;
    --card-padding: 28px;
    --card-gap: 20px;
  }

  #projects > .cards-grid,
  #writing > .cards-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .featured-card {
    min-height: 230px;
  }

  .card-title,
  .timeline-title {
    font-size: 17px;
  }

  .card-subtitle,
  .section-summary,
  .timeline-company,
  .timeline-description {
    font-size: 15px;
  }

  .timeline-date {
    font-size: 14px;
  }

  .skills-grid,
  .timeline {
    max-width: 1000px;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 280px;
    --content-padding: 24px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 900px) {
  .layout {
    max-width: none;
    margin: 0;
    flex-direction: column;
    padding-left: 0;
  }

  .sidebar {
    position: relative;
    left: auto;
    width: 100%;
    height: auto;
    padding: 16px var(--content-padding);
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
    overflow: visible;
  }

  .sidebar-mobile-bar {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .sidebar-mobile-bar .logo {
    margin-bottom: 0;
  }

  .sidebar-mobile-toggle {
    min-width: 64px;
    min-height: 44px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
  }

  .sidebar-profile-content {
    display: none;
    padding-top: 24px;
  }

  .sidebar-profile-content.is-open {
    display: block;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin: 0;
    max-width: none;
    padding-top: 0;
    width: 100%;
  }

  .category-tabs {
    padding-top: 16px;
  }
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
    padding-left: 0;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    overflow: visible;
  }

  .main-content {
    margin: 0;
    max-width: none;
    padding-top: 0;
    width: 100%;
  }

  .logo {
    margin-bottom: 24px;
  }

  .profile-section {
    margin-bottom: 20px;
  }

  .profile-photo {
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
  }

  .social-links {
    flex-direction: row;
    flex-wrap: wrap;
    column-gap: 18px;
    row-gap: 10px;
  }

  .sidebar-footer {
    margin-top: 16px;
    padding-top: 16px;
  }

  .photo-grid {
    grid-auto-columns: 72px;
    grid-auto-flow: column;
    grid-template-columns: none;
    margin-top: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .photo-grid img {
    width: 72px;
    border-radius: 6px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .category-tabs {
    overflow: visible;
    margin-bottom: 24px;
    padding-top: 16px;
  }
}

@media (max-width: 480px) {
  :root {
    --content-padding: 16px;
    --card-padding: 16px;
  }

  .photo-grid {
    grid-auto-columns: 72px;
    grid-template-columns: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-delay: 0s !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* =====================================
   Utility Classes
   ===================================== */

.hidden {
  display: none !important;
}

.portfolio-chat {
  --chat-bg-selected: var(--bg-secondary);
  --chat-border: var(--border-color);
  --chat-default: var(--text-secondary);
  --chat-hover: var(--bg-hover);
  --chat-panel-height: auto;
  --chat-panel-min-height: 0;
  --chat-strong: var(--text-primary);
  --chat-subtle: var(--text-muted);
  bottom: 24px;
  color: var(--chat-default);
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font-family);
  letter-spacing: 0;
  line-height: 1.5;
  position: fixed;
  right: max(24px, calc(50vw - var(--desktop-frame-half) + var(--content-padding)));
  z-index: 30;
}

.portfolio-chat.has-conversation {
  --chat-panel-height: min(600px, calc(100vh - 32px));
  --chat-panel-min-height: min(460px, calc(100vh - 32px));
}

.chat-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--chat-strong);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
  height: 40px;
  isolation: isolate;
  justify-content: center;
  overflow: hidden;
  padding: 0 14px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.08),
    0 10px 28px rgba(37, 99, 235, 0.1);
  transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  width: auto;
}

.chat-toggle::before {
  animation: chat-border-trace 2s linear infinite;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 54deg,
    #38bdf8 68deg,
    #2563eb 94deg,
    #8b5cf6 122deg,
    #22c55e 146deg,
    transparent 162deg 360deg
  );
  content: "";
  inset: -40px;
  position: absolute;
  z-index: 0;
}

.chat-toggle::after {
  background-color: var(--chat-bg-selected);
  border-radius: 6px;
  content: "";
  inset: 2px;
  position: absolute;
  transition: background-color 0.2s ease;
  z-index: 1;
}

.chat-toggle > span {
  position: relative;
  z-index: 2;
}

.portfolio-chat.is-open .chat-toggle {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
}

.chat-toggle-arrow {
  color: var(--chat-default);
  line-height: 1;
}

.chat-toggle:hover {
  color: var(--chat-strong);
}

.chat-toggle:hover::after {
  background-color: var(--chat-hover);
}

.chat-toggle:focus-visible {
  outline: 1px solid var(--chat-strong);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .chat-toggle {
    box-shadow:
      0 0 0 1px rgba(37, 99, 235, 0.1),
      0 8px 22px rgba(37, 99, 235, 0.08);
  }

  .chat-toggle::before {
    animation: none !important;
    background: linear-gradient(135deg, #22c55e, #38bdf8 38%, #2563eb 68%, #8b5cf6);
    inset: 0;
  }
}

.chat-panel {
  background-color: var(--bg-primary);
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  bottom: 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  height: var(--chat-panel-height);
  max-height: min(600px, calc(100vh - 32px));
  min-height: var(--chat-panel-min-height);
  overflow: hidden;
  position: absolute;
  right: 0;
  width: min(420px, calc(100vw - 32px));
}

.chat-header {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  padding: 18px 16px 8px;
}

.chat-title-row {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.chat-profile {
  background-color: var(--chat-bg-selected);
  border-radius: 999px;
  display: block;
  height: 28px;
  object-fit: cover;
  width: 28px;
}

.chat-title {
  color: var(--chat-strong);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
}

.chat-actions {
  align-items: center;
  display: flex;
}

.chat-close {
  align-items: center;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--chat-subtle);
  cursor: pointer;
  display: flex;
  height: 30px;
  justify-content: center;
  padding: 0;
  width: 30px;
}

.chat-close:hover {
  color: var(--chat-strong);
}

.chat-close-icon {
  display: block;
  height: 18px;
  position: relative;
  width: 18px;
}

.chat-close-icon::before,
.chat-close-icon::after {
  background-color: currentColor;
  border-radius: 999px;
  content: "";
  height: 19px;
  left: 8px;
  position: absolute;
  top: 0;
  width: 1px;
}

.chat-close-icon::before {
  transform: rotate(45deg);
}

.chat-close-icon::after {
  transform: rotate(-45deg);
}

.chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overscroll-behavior: contain;
  overflow-y: auto;
  padding: 12px 16px;
  scrollbar-width: thin;
}

.chat-messages:empty {
  display: none;
}

.chat-message {
  border-radius: 8px;
  color: var(--chat-default);
  font-size: 14px;
  line-height: 1.5;
  max-width: 84%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
}

.chat-message.assistant {
  align-self: flex-start;
  background-color: var(--chat-bg-selected);
}

.chat-message.user {
  align-self: flex-end;
  background-color: var(--chat-strong);
  color: var(--bg-primary);
  white-space: pre-wrap;
}

.chat-message p {
  margin: 0;
}

.chat-message p + p {
  margin-top: 6px;
}

.chat-message ul {
  margin: 6px 0 0;
  padding-left: 16px;
}

.chat-message li + li {
  margin-top: 3px;
}

.chat-message strong {
  color: var(--chat-strong);
  font-weight: 500;
}

.chat-loading {
  align-items: center;
  display: inline-flex;
  gap: 7px;
  max-width: max-content;
}

.chat-spinner {
  animation: chat-spin 0.8s linear infinite;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  border-top-color: var(--chat-default);
  flex: 0 0 auto;
  height: 12px;
  width: 12px;
}

.chat-suggestions {
  align-items: flex-start;
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding: 8px 16px 16px;
}

.chat-suggestions.is-hidden {
  display: none;
}

.chat-suggestions button {
  align-items: center;
  background-color: var(--chat-bg-selected);
  border: none;
  border-radius: 8px;
  color: var(--chat-default);
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  justify-content: space-between;
  line-height: 1.35;
  min-height: 42px;
  padding: 0 12px;
  text-align: left;
  text-transform: none;
  transition: background-color 0.2s ease, color 0.2s ease;
  width: 100%;
}

.chat-suggestions button::after {
  color: var(--chat-subtle);
  content: "→";
  flex: 0 0 auto;
  margin-left: 12px;
}

.chat-suggestions button:hover,
.chat-suggestions button:focus-visible {
  background-color: var(--chat-hover);
  color: var(--chat-strong);
}

.chat-suggestions button:focus-visible,
.chat-close:focus-visible,
.chat-send:focus-visible {
  outline: 1px solid var(--chat-strong);
  outline-offset: 2px;
}

.chat-form {
  background-color: var(--bg-primary);
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  margin: 0 16px 16px;
  min-height: 50px;
  padding: 0 8px 0 14px;
}

.chat-input {
  background: transparent;
  border: none;
  color: var(--chat-strong);
  flex: 1;
  font: inherit;
  font-size: 14px;
  height: 48px;
  min-width: 0;
  padding: 0;
}

.chat-input::placeholder {
  color: var(--chat-subtle);
}

.chat-input:focus {
  outline: none;
}

.chat-model-pill {
  align-items: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--chat-border);
  border-radius: 6px;
  color: var(--chat-strong);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  gap: 7px;
  height: 30px;
  line-height: 1;
  padding: 0 10px;
}

.chat-gemini-icon {
  display: block;
  height: 16px;
  width: 16px;
}

.chat-send {
  align-items: center;
  background-color: var(--chat-bg-selected);
  border: none;
  border-radius: 999px;
  color: var(--chat-subtle);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font: inherit;
  height: 36px;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  width: 36px;
}

.chat-send:hover {
  background-color: var(--chat-strong);
  color: var(--bg-primary);
}

.chat-send-icon {
  display: block;
  height: 18px;
  position: relative;
  width: 18px;
}

.chat-send-icon::before {
  background-color: currentColor;
  border-radius: 999px;
  content: "";
  height: 13px;
  left: 8px;
  position: absolute;
  top: 3px;
  width: 1px;
}

.chat-send-icon::after {
  border-left: 1px solid currentColor;
  border-top: 1px solid currentColor;
  border-radius: 1px;
  content: "";
  height: 8px;
  left: 4px;
  position: absolute;
  top: 3px;
  transform: rotate(45deg);
  width: 8px;
}

.chat-form.is-loading .chat-send-icon {
  animation: chat-spin 0.8s linear infinite;
  border: 1px solid currentColor;
  border-radius: 999px;
  border-top-color: transparent;
  height: 14px;
  width: 14px;
}

.chat-form.is-loading .chat-send-icon::before,
.chat-form.is-loading .chat-send-icon::after {
  display: none;
}

.chat-send:disabled,
.chat-input:disabled {
  cursor: wait;
  opacity: 0.6;
}

.chat-input:disabled {
  color: var(--chat-subtle);
}

@keyframes chat-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes chat-border-trace {
  to {
    transform: rotate(360deg);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =====================================
   Blog Article Styles
   ===================================== */

.blog-content {
  max-width: 720px;
}

.blog-content figure {
  margin-bottom: 2rem;
}

.blog-content figure img {
  width: 100%;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.blog-content figure img:hover {
  opacity: 0.9;
}

.blog-content figcaption {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
}

.blog-content h2 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.blog-content h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.blog-content h4 {
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.blog-content p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.blog-content ul,
.blog-content ol {
  margin-bottom: 2rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.blog-content li {
  margin-bottom: 0.375rem;
  line-height: 1.6;
}

.blog-content code {
  background-color: var(--bg-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.blog-content pre {
  background-color: #1a1a1a;
  color: #e5e5e5;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.blog-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.blog-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.blog-content th,
.blog-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.blog-content th {
  font-weight: 500;
  color: var(--text-muted);
}

.blog-content td {
  color: var(--text-secondary);
}

.blog-content blockquote,
.blog-content .note {
  border-left: 2px solid var(--border-color);
  padding-left: 1rem;
  margin: 2rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.blog-content .warning {
  border-left-color: #eab308;
}

.blog-header {
  margin-bottom: 2rem;
}

.blog-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.blog-date {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.blog-body {
  color: var(--text-secondary);
}

/* =====================================
   Article Page Layout (No Sidebar)
   ===================================== */

.article-layout {
  --article-wide-width: 920px;
  --article-header-width: 800px;
  --article-toc-width: 720px;
  --article-reading-width: 680px;
  --article-layout-gutter: var(--content-padding);
  min-height: 100vh;
  background-color: var(--bg-primary);
}

.article-container {
  max-width: calc(var(--article-wide-width) + (2 * var(--content-padding)));
  margin: 0 auto;
  padding: 2rem var(--content-padding);
}

.article-nav {
  max-width: var(--article-header-width);
  margin-right: auto;
  margin-bottom: 3rem;
  margin-left: auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--text-primary);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

.article-header {
  max-width: var(--article-header-width);
  margin-right: auto;
  margin-bottom: 2rem;
  margin-left: auto;
}

.article-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.article-meta .divider {
  color: var(--border-color);
}

.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.reading-time svg {
  width: 14px;
  height: 14px;
}

/* Hero Image */
.article-hero {
  margin: 2rem 0 2.5rem 0;
  border-radius: 8px;
  overflow: hidden;
}

.article-hero img {
  width: 100%;
  max-height: 280px;
  height: auto;
  display: block;
  object-fit: contain;
}

.article-hero figcaption {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
  padding: 0 1rem;
}

/* Table of Contents */
.article-toc {
  width: min(100%, var(--article-toc-width));
  border-left: 2px solid var(--border-color);
  padding-left: 1.25rem;
  margin-right: auto;
  margin-bottom: 3rem;
  margin-left: auto;
}

.toc-trigger {
  width: 100%;
  min-height: 44px;
  margin-bottom: 0.5rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  user-select: none;
  text-align: left;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.toc-toggle-icon {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 0.2s ease;
}

.toc-trigger[aria-expanded="false"] .toc-toggle-icon {
  transform: rotate(-90deg);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

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

.toc-item {
  counter-increment: toc-counter;
  margin-bottom: 0.25rem;
}

.toc-item:last-child {
  margin-bottom: 0;
}

.toc-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  padding: 0.125rem 0;
  transition: color 0.15s ease;
}

.toc-link::before {
  content: counter(toc-counter, decimal-leading-zero);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 1rem;
}

.toc-link:hover {
  color: var(--text-primary);
}

.toc-link:hover::before {
  color: var(--text-secondary);
}

.article-body,
.docstack-body {
  width: min(100%, var(--article-reading-width));
  margin-right: auto;
  margin-left: auto;
  color: var(--text-secondary);
}

.article-body figure,
.article-body .code-block-shell,
.article-body table,
.docstack-body .diagram,
.docstack-body .code-block-shell,
.docstack-body table {
  width: min(var(--article-wide-width), calc(100vw - (2 * var(--article-layout-gutter))));
  max-width: none;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.docstack-container .back-link {
  margin-bottom: 0;
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figure img {
  width: 100%;
  border-radius: 4px;
  cursor: default;
  transition: opacity 0.2s ease;
}

.article-body figure img[data-lightbox]:hover {
  opacity: 0.9;
}

.article-layout [data-lightbox] {
  cursor: zoom-in;
}

.article-layout [data-lightbox]:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 4px;
}

.article-layout .article-body .text-neutral-400,
.article-layout .article-body .text-neutral-500 {
  color: #6b6b6b;
}

.article-body figcaption {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.75rem;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.article-body h3 {
  font-size: 1.125rem;
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.article-body h4 {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.article-body p {
  margin-bottom: 1.5rem;
  line-height: 1.8;
}

.article-body ul,
.article-body ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

.article-body code {
  background-color: rgba(0, 0, 0, 0.06);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
  color: #d63384;
}

.article-body pre {
  background: linear-gradient(145deg, #1e1e1e 0%, #252525 100%);
  color: #e5e5e5;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.code-block-shell {
  position: relative;
  margin: 2rem 0;
  overflow: hidden;
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.code-block-shell pre,
.docstack-article .docstack-body pre {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.code-block-toolbar {
  min-height: 44px;
  padding: 0.375rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  background: #181818;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.code-block-action {
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  color: #d9d9d9;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.75rem;
}

.code-block-action:hover,
.code-block-action:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

.code-block-shell.is-collapsible.is-collapsed pre {
  max-height: 32rem;
  overflow: hidden;
}

.code-block-shell.is-collapsible.is-collapsed::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: max(0px, calc((100vw - var(--sidebar-width) - var(--main-max-width)) / 2));
  height: 5rem;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, #1e1e1e);
}

.docstack-article .docstack-body pre {
  padding: 1.5rem;
  color: #e5e5e5;
  background: linear-gradient(145deg, #1e1e1e 0%, #252525 100%);
  font-size: 0.875rem;
  line-height: 1.6;
}

.docstack-article .docstack-body pre code { color: inherit; }
.docstack-article .code-comment { color: #a8b0bb; }
.docstack-article .code-keyword { color: #c4b5fd; }
.docstack-article .code-string { color: #6ee7b7; }
.docstack-article .code-function { color: #93c5fd; }

.docstack-article .diagram {
  padding: 24px;
  background: #f7f7f7;
  border-color: var(--border-color);
}

.docstack-article .diagram-box { border-width: 1px; }
.docstack-article .diagram-box.blue { color: #29475a; background: #eef4f8; border-color: #9db3c2; }
.docstack-article .diagram-box.purple { color: #4a3f5c; background: #f2eff7; border-color: #b4a8c6; }
.docstack-article .diagram-box.green { color: #315742; background: #edf5f0; border-color: #9ebaa8; }
.docstack-article .diagram-box.yellow { color: #5d4f28; background: #f7f3e8; border-color: #c2b38a; }
.docstack-article .diagram-box.pink { color: #5d3f48; background: #f7eef1; border-color: #c5a4ae; }
.docstack-article .diagram-box.gray { color: #3f474b; background: #f1f2f2; border-color: #b5b9bb; }

.article-reading-progress {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  pointer-events: none;
}

.article-reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--text-primary);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.article-body th,
.article-body td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.article-body th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.article-body blockquote {
  border-left: 3px solid var(--border-color);
  padding-left: 1.25rem;
  margin: 2rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.csgo-memory-article .article-demo-shot {
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  padding: 10px;
}

.csgo-memory-article .demo-shot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.csgo-memory-article .demo-shot-frame {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
}

.csgo-memory-article .article-demo-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: default;
}

.csgo-memory-article .demo-shot-frame img {
  border-radius: 0;
}

.csgo-memory-article .demo-shot-frame p {
  margin: 0;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.csgo-memory-article .article-demo-shot img:hover {
  opacity: 1;
}

.csgo-memory-article .article-demo-shot figcaption {
  padding: 10px 10px 8px;
}

.csgo-memory-article .article-code-gallery {
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
}

.csgo-memory-article .code-shot-stack {
  display: grid;
  gap: 16px;
}

.csgo-memory-article .code-shot {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  display: grid;
  gap: 0;
  overflow: hidden;
}

.csgo-memory-article .code-shot img {
  background: #1f1f1f;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  cursor: default;
  display: block;
  height: auto;
  width: 100%;
}

.csgo-memory-article .code-shot img:hover {
  opacity: 1;
}

.csgo-memory-article .code-shot-note {
  padding: 16px;
}

.csgo-memory-article .code-shot-note strong {
  color: var(--text-primary);
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.csgo-memory-article .code-shot-note p {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.65;
  margin: 0;
}

.csgo-memory-article .article-code-gallery figcaption {
  padding: 4px 10px 8px;
}

.csgo-memory-article .article-visual {
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin: 2.5rem 0;
}

.csgo-memory-article .visual-kicker {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.csgo-memory-article .visual-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 1.25rem;
}

.csgo-memory-article .process-boundary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.csgo-memory-article .process-card,
.csgo-memory-article .memory-node {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.csgo-memory-article .process-card {
  padding: 18px;
}

.csgo-memory-article .process-card-strong {
  border-color: #d7e7ff;
  box-shadow: inset 0 0 0 1px #eef5ff;
}

.csgo-memory-article .process-label {
  color: var(--text-muted);
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.csgo-memory-article .process-card strong,
.csgo-memory-article .memory-node strong {
  color: var(--text-primary);
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.csgo-memory-article .process-card p,
.csgo-memory-article .memory-node p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0;
}

.csgo-memory-article .process-bridge {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  font-size: 0.7rem;
  font-weight: 600;
  gap: 0.75rem;
  justify-content: center;
  letter-spacing: 0.08em;
  min-height: 136px;
  text-align: center;
  text-transform: uppercase;
}

.csgo-memory-article .process-bridge i {
  background: linear-gradient(90deg, #78d8b2, #4f8cff, #7c5cff);
  display: block;
  height: 2px;
  width: 100%;
}

.csgo-memory-article .memory-flow {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  position: relative;
}

.csgo-memory-article .memory-flow::before {
  background: var(--border-color);
  content: "";
  height: 1px;
  left: 36px;
  position: absolute;
  right: 36px;
  top: 28px;
}

.csgo-memory-article .memory-node {
  padding: 16px;
  position: relative;
  z-index: 1;
}

.csgo-memory-article .memory-node span {
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 600;
  height: 28px;
  justify-content: center;
  margin-bottom: 0.85rem;
  width: 28px;
}

.csgo-memory-article .memory-node:nth-child(4) span {
  background: #eef5ff;
  border-color: #cfe2ff;
  color: #2f6fce;
}

.csgo-memory-article .entity-map {
  align-items: stretch;
  display: grid;
  gap: 16px;
  grid-template-columns: 170px 88px minmax(0, 1fr);
}

.csgo-memory-article .entity-index,
.csgo-memory-article .entity-record {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.csgo-memory-article .entity-index {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.csgo-memory-article .entity-index-title,
.csgo-memory-article .record-label {
  color: var(--text-muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.csgo-memory-article .entity-slot {
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr);
  padding: 10px;
}

.csgo-memory-article .entity-slot span {
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 999px;
  color: var(--text-muted);
  display: inline-flex;
  font-size: 0.7rem;
  font-weight: 600;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.csgo-memory-article .entity-slot strong {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 500;
}

.csgo-memory-article .entity-slot-active {
  border-color: #cfe2ff;
  box-shadow: inset 0 0 0 1px #eef5ff;
}

.csgo-memory-article .entity-slot-active span {
  background: #eef5ff;
  color: #2f6fce;
}

.csgo-memory-article .entity-pointer {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  font-weight: 600;
  gap: 0.75rem;
  justify-content: center;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.csgo-memory-article .entity-pointer i {
  background: linear-gradient(90deg, #78d8b2, #4f8cff);
  display: block;
  height: 2px;
  width: 100%;
}

.csgo-memory-article .entity-record {
  border-color: #d7e7ff;
  padding: 18px;
}

.csgo-memory-article .entity-record strong {
  color: var(--text-primary);
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.csgo-memory-article .entity-record ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.csgo-memory-article .entity-record li {
  align-items: center;
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  line-height: 1.3;
  margin: 0;
  padding: 9px 10px;
}

.csgo-memory-article .entity-record li span {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.csgo-memory-article .entity-record li b {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: right;
}

.csgo-memory-article .privilege-rings {
  align-items: center;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 170px;
}

.csgo-memory-article .ring-shell {
  align-items: center;
  border: 1px solid;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 auto;
  position: relative;
  text-align: center;
}

.csgo-memory-article .ring-shell span {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.csgo-memory-article .ring-shell small {
  color: var(--text-secondary);
  display: block;
  font-size: 0.72rem;
  line-height: 1.45;
  margin-top: 0.35rem;
  max-width: 250px;
}

.csgo-memory-article .ring-shell-3 {
  background: #f2fbf6;
  border-color: #cdeedb;
  height: 360px;
  max-width: 460px;
  padding: 28px;
  width: 100%;
}

.csgo-memory-article .ring-shell-2 {
  background: #fffbe8;
  border-color: #eee4a7;
  height: 260px;
  margin-top: 20px;
  width: 78%;
}

.csgo-memory-article .ring-shell-1 {
  background: #fff3e2;
  border-color: #efd1a8;
  height: 178px;
  margin-top: 12px;
  width: 72%;
}

.csgo-memory-article .ring-shell-0 {
  background: #fff0f0;
  border-color: #efc0c0;
  height: 98px;
  margin-top: 10px;
  width: 62%;
}

.csgo-memory-article .ring-shell-0 strong {
  color: var(--text-secondary);
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.csgo-memory-article .ring-legend {
  display: grid;
  gap: 10px;
}

.csgo-memory-article .ring-legend div {
  align-items: center;
  color: var(--text-secondary);
  display: flex;
  font-size: 0.78rem;
  gap: 0.6rem;
  line-height: 1.35;
}

.csgo-memory-article .ring-legend i {
  border: 1px solid;
  border-radius: 4px;
  display: block;
  flex: none;
  height: 18px;
  width: 18px;
}

.csgo-memory-article .legend-user {
  background: #f2fbf6;
  border-color: #cdeedb;
}

.csgo-memory-article .legend-driver {
  background: #fff3e2;
  border-color: #efd1a8;
}

.csgo-memory-article .legend-kernel {
  background: #fff0f0;
  border-color: #efc0c0;
}

@media (max-width: 768px) {
  html.chat-mobile-open,
  body.chat-mobile-open {
    background-color: var(--bg-primary);
    height: 100%;
    overflow: hidden;
    width: 100%;
  }

  body.chat-mobile-open {
    left: 0;
    position: fixed;
    right: 0;
  }

  .article-layout {
    --article-layout-gutter: 1rem;
  }

  .article-container {
    padding: 1.5rem 1rem;
  }

  .article-title {
    font-size: clamp(1.625rem, 7vw, 2rem);
  }

  .article-hero img {
    max-height: 220px;
  }

  .article-body h2 {
    font-size: 1.25rem;
  }

  .csgo-memory-article .demo-shot-grid {
    grid-template-columns: 1fr;
  }

  .csgo-memory-article .article-visual {
    border-radius: 10px;
    padding: 18px;
  }

  .csgo-memory-article .process-boundary-grid,
  .csgo-memory-article .memory-flow {
    grid-template-columns: 1fr;
  }

  .csgo-memory-article .process-bridge {
    min-height: auto;
    padding: 6px 0;
  }

  .csgo-memory-article .process-bridge i {
    height: 36px;
    width: 2px;
  }

  .csgo-memory-article .memory-flow::before {
    display: none;
  }

  .csgo-memory-article .entity-map {
    grid-template-columns: 1fr;
  }

  .csgo-memory-article .entity-pointer {
    padding: 4px 0;
  }

  .csgo-memory-article .entity-pointer i {
    height: 36px;
    width: 2px;
  }

  .csgo-memory-article .privilege-rings {
    gap: 18px;
    grid-template-columns: 1fr;
  }

  .csgo-memory-article .ring-shell-3 {
    height: 300px;
    padding: 20px;
  }

  .csgo-memory-article .ring-shell-2 {
    height: 214px;
    width: 82%;
  }

  .csgo-memory-article .ring-shell-1 {
    height: 144px;
    width: 74%;
  }

  .csgo-memory-article .ring-shell-0 {
    height: 78px;
    width: 66%;
  }

  .csgo-memory-article .ring-shell small {
    display: none;
  }

  .csgo-memory-article .ring-legend {
    grid-template-columns: 1fr;
  }

  .portfolio-chat {
    --chat-panel-height: 100%;
    --chat-panel-min-height: 0;
    bottom: 16px;
    right: 16px;
  }

  .portfolio-chat.is-open {
    background-color: var(--bg-primary);
    bottom: auto;
    height: 100%;
    height: -webkit-fill-available;
    left: 0;
    min-height: 100vh;
    position: fixed;
    right: auto;
    top: 0;
    width: 100%;
    z-index: 100;
  }

  .chat-toggle {
    height: 40px;
    padding: 0 14px;
  }

  .chat-panel {
    border: none;
    border-radius: 0;
    bottom: auto;
    box-shadow: none;
    height: 100%;
    height: -webkit-fill-available;
    left: 0;
    max-height: none;
    min-height: 0;
    position: fixed;
    right: auto;
    top: 0;
    width: 100vw;
  }

  .chat-header {
    border-bottom: 1px solid var(--chat-border);
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 18px 12px;
  }

  .chat-messages {
    gap: 8px;
    padding: 18px;
  }

  .chat-message {
    font-size: 14px;
    max-width: 90%;
    padding: 10px 12px;
  }

  .chat-suggestions {
    gap: 8px;
    padding: 8px 18px 16px;
  }

  .chat-suggestions button {
    font-size: 14px;
    min-height: 42px;
    padding: 0 12px;
  }

  .chat-form {
    gap: 10px;
    margin: 0 18px calc(env(safe-area-inset-bottom, 0px) + 18px);
    min-height: 50px;
    padding: 0 8px 0 14px;
  }

  .chat-input {
    font-size: 16px;
    height: 48px;
    padding: 0;
  }

  .chat-model-pill {
    padding: 0 9px;
  }

  .chat-send {
    height: 32px;
    padding: 0;
    width: 32px;
  }
}

/* Image Modal */
.image-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-modal[hidden] {
  display: none;
}

body.image-modal-open {
  overflow: hidden;
}

.image-modal img {
  max-height: 90vh;
  max-width: 90vw;
  object-fit: contain;
}

.image-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  padding: 0.625rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.image-modal-close:hover {
  color: #ccc;
}
