/* ========================================
   AI Insights — Academic Sidebar Theme
   Inspired by jryoungw.github.io
   ======================================== */

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Theme Variables */
:root {
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --bg-sidebar: #faf8f5;
  --text: #2c2c2c;
  --text-secondary: #555555;
  --text-muted: #999999;
  --border: #e0dbd5;
  --accent: #8b7355;
  --accent-hover: #6b5740;
  --tag-bg: #f0ebe4;
  --tag-border: #d5cec4;
  --tag-text: #6b5e50;
  --link: #4a6fa5;
  --link-hover: #365580;
  --font-sans: 'Pretendard Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Noto Serif', 'Pretendard Variable', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

body.dark-mode {
  --bg: #1a1a1a;
  --bg-card: #242424;
  --bg-sidebar: #1a1a1a;
  --text: #e0dcd6;
  --text-secondary: #b0a898;
  --text-muted: #777068;
  --border: #3a3632;
  --accent: #c4a882;
  --accent-hover: #d4bc9a;
  --tag-bg: #2e2a25;
  --tag-border: #4a4540;
  --tag-text: #b0a898;
  --link: #7aabdb;
  --link-hover: #9dc2e8;
}

/* Base */
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--link-hover);
}

/* ---- Layout ---- */
.layout {
  display: flex;
  min-height: 100vh;
  max-width: 1060px;
  margin: 0 auto;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
}

.sidebar-inner {
  padding: 2.5rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

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

.sidebar-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: block;
}

.sidebar-name:hover {
  color: var(--accent);
}

.sidebar-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  line-height: 1.6;
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
}

.sidebar-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
  margin-top: 1.2rem;
}

.sidebar-section-title:first-child {
  margin-top: 0;
}

.sidebar-pages,
.sidebar-topics {
  list-style: none;
  margin-bottom: 0.5rem;
}

.sidebar-pages li,
.sidebar-topics li {
  margin-bottom: 0.1rem;
}

.sidebar-pages a,
.sidebar-topics a {
  display: block;
  padding: 0.25rem 0 0.25rem 1rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.sidebar-pages a:hover,
.sidebar-topics a:hover {
  color: var(--accent);
}

.sidebar-pages a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* Sidebar Sub-list (Posts subcategories) */
.sidebar-sub-list {
  list-style: none;
  margin: 0 0 0.2rem 0;
}

.sidebar-sub-list li {
  margin-bottom: 0;
}

.sidebar-sub-list a {
  display: block;
  padding: 0.2rem 0 0.2rem 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-left: none;
  transition: all 0.15s;
}

.sidebar-sub-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.sidebar-sub-list a.active {
  color: var(--accent);
  font-weight: 600;
}

/* Post Section (grouped view on home) */
.post-section {
  margin-bottom: 2.5rem;
}

.post-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.post-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.post-section-more {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.post-section-more:hover {
  color: var(--accent);
}

/* Sidebar Footer */
.sidebar-footer {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar-links {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.sidebar-links a {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-links a:hover {
  color: var(--accent);
}

/* Dark Mode Toggle */
.dark-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.dark-toggle input {
  display: none;
}

.dark-slider {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}

.dark-slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.dark-toggle input:checked + .dark-slider {
  background: var(--accent);
}

.dark-toggle input:checked + .dark-slider::after {
  transform: translateX(16px);
}

.dark-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Language Toggle */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.8rem;
}

.lang-btn {
  background: none;
  border: none;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.lang-btn + .lang-btn {
  border-left: 1px solid var(--border);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

.lang-btn:hover:not(.active) {
  background: var(--tag-bg);
  color: var(--text);
}

.lang-ko {
  display: none;
}

/* Global Language Toggle */
.global-lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.global-lang-btn {
  background: none;
  border: none;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}

.global-lang-btn + .global-lang-btn {
  border-left: 1px solid var(--border);
}

.global-lang-btn.active {
  background: var(--accent);
  color: #fff;
}

.global-lang-btn:hover:not(.active) {
  background: var(--tag-bg);
  color: var(--text);
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.2rem;
  align-items: center;
  justify-content: space-between;
}

.mobile-menu-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  max-width: 750px;
  padding: 2.5rem 3rem;
  min-width: 0;
}

/* ---- Page Header (Index) ---- */
.page-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.page-heading {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.page-description {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ---- Post List ---- */
.post-list {
  list-style: none;
}

.post-item {
  padding: 1.5rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.15s;
}

.post-item:hover {
  border-color: var(--accent);
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.post-item h2 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}

.post-item h2 a {
  color: var(--text);
}

.post-item h2 a:hover {
  color: var(--accent);
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.55;
}

.post-read {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  transition: color 0.15s;
}

.post-read:hover {
  color: var(--accent);
}

/* Subcategory Badge */
.post-item-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.subcategory-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  letter-spacing: 0.02em;
}

.subcategory-paper-review {
  background: #e8f0fe;
  color: #1a56db;
}

.subcategory-stock-report {
  background: #e6f4ea;
  color: #137333;
}

.subcategory-index-report {
  background: #fef3e0;
  color: #b06000;
}

html.dark .subcategory-paper-review {
  background: #1e3a5f;
  color: #93bbf5;
}

html.dark .subcategory-stock-report {
  background: #1a3d2a;
  color: #81c995;
}

html.dark .subcategory-index-report {
  background: #3d2e0f;
  color: #f5c462;
}

/* Tags */
.post-tags {
  margin-bottom: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.tag {
  display: inline-block;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  padding: 0.12rem 0.5rem;
  border-radius: 2px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 400;
}

.category {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
}

/* ---- Single Post ---- */
.post {
  padding-bottom: 2rem;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.paper-link-banner {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.6rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
}

.paper-link-banner a {
  color: var(--accent);
  font-weight: 500;
}

.paper-link-banner a:hover {
  text-decoration: underline;
}

.post-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

/* Post Content */
.post-content {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.post-content h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.post-content h3 {
  font-size: 1.08rem;
  font-weight: 600;
  margin-top: 1.8rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.post-content p {
  margin-bottom: 1.15rem;
}

.post-content ul, .post-content ol {
  margin-bottom: 1.15rem;
  padding-left: 1.3rem;
}

.post-content li {
  margin-bottom: 0.25rem;
}

.post-content strong {
  color: var(--text);
  font-weight: 600;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1rem;
  margin: 1.25rem 0;
  background: var(--tag-bg);
  border-radius: 0 4px 4px 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.post-content blockquote p {
  margin: 0;
}

.post-content code {
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  font-size: 0.84em;
  font-family: var(--font-mono);
  color: var(--tag-text);
}

.post-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-secondary);
}

.post-content .table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 400px;
}

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

.post-content th {
  font-weight: 600;
  color: var(--text-secondary);
}

.post-content img {
  max-width: 100%;
  border-radius: 4px;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
}

.post-content a {
  text-decoration: underline;
  text-decoration-color: rgba(74, 111, 165, 0.3);
  text-underline-offset: 2px;
}

.post-content a:hover {
  text-decoration-color: var(--link);
}

/* Post Navigation */
.post-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}

.post-nav a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.post-nav a:hover {
  color: var(--accent);
}

/* ---- About Page ---- */
.about-page {
  max-width: 600px;
}

.profile-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.profile-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.profile-info h1 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
}

.profile-info .role {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 0.15rem;
}

.about-section {
  margin-bottom: 2rem;
}

.about-section h2 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.about-section ul {
  list-style: none;
  padding: 0;
}

.about-section ul li {
  padding: 0.3rem 0 0.3rem 0.9rem;
  position: relative;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.about-section ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Timeline */
.timeline-item {
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 1px solid var(--border);
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 0.85rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item .period {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.timeline-item .title {
  font-weight: 600;
  font-size: 0.92rem;
  margin-top: 0.05rem;
  color: var(--text);
}

.timeline-item .org {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Contact */
.contact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.contact-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.15s;
}

.contact-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Publications ---- */
.pub-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-item .pub-title {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.4;
}

.pub-item .pub-authors {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.15rem;
}

.pub-item .pub-venue {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

/* ---- Projects ---- */
.project-card {
  padding: 1.2rem 1.5rem;
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.15s;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-card h3 {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.project-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.project-tech {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.project-tech span {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.45rem;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--tag-text);
  border-radius: 2px;
}

/* ---- Search ---- */
.search-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  margin-bottom: 1.5rem;
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-results {
  list-style: none;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.pagination a, .pagination span {
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
}

.pagination a {
  color: var(--text-muted);
}

.pagination a:hover {
  color: var(--accent);
}

.pagination .current {
  background: var(--accent);
  color: #fff;
}

/* ---- Sidebar TOC ---- */
.sidebar-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

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

.sidebar-toc-list li {
  margin: 0;
}

.sidebar-toc-list li a {
  display: block;
  padding: 0.25rem 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1.4;
}

.sidebar-toc-list li a:hover {
  text-decoration: underline;
}

.sidebar-toc-list li a.active {
  color: var(--text);
  font-weight: 500;
}

.sidebar-toc-list li.toc-indent a {
  padding-left: 1.2rem;
  font-size: 0.75rem;
}

/* ---- Comments ---- */
.post-comments {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* ---- Footer (hidden in sidebar layout) ---- */
.site-footer {
  display: none;
}

/* ---- Stock List ---- */
.stock-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.stock-card {
  display: block;
  padding: 1.2rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s;
}

.stock-card:hover {
  border-color: var(--accent);
}

.stock-card-ticker {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}

.stock-card-name {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.stock-card-exchange {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  opacity: 0.7;
}

.stock-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.2rem 0 0;
}

/* ---- Stock Widget ---- */
.stock-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fullscreen-btn {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.fullscreen-btn:hover {
  background: var(--accent);
  color: #fff;
}

.stock-widget {
  margin-top: 1rem;
  height: 21vh;
  min-height: 200px;
}

.stock-widget .tradingview-widget-container,
.stock-widget .tradingview-widget-container > div {
  height: 100%;
}

.stock-research {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.stock-research h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.stock-research table {
  width: 100%;
  margin: 1rem 0;
}

.stock-research td,
.stock-research th {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.stock-research th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
}

.fullscreen-close-btn {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.fullscreen-close-btn:hover {
  background: var(--accent);
  color: #fff;
}

.stock-widget.stock-fullscreen .fullscreen-close-btn {
  display: block;
}

.stock-widget.stock-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  margin: 0;
  background: var(--bg);
  padding: 0;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100%;
    max-height: -webkit-fill-available;
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-inner {
    padding-bottom: calc(3rem + env(safe-area-inset-bottom, 2rem));
  }

  .sidebar.open {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    padding: 1.5rem;
  }

  .page-heading {
    font-size: 1.4rem;
  }

  .post-title {
    font-size: 1.4rem;
  }

  .profile-section {
    flex-direction: column;
    text-align: center;
  }
}

@media (min-width: 769px) {
  .mobile-header {
    display: none;
  }
}

/* Scroll to top button (mobile only) */
.scroll-top-btn {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 150;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .scroll-top-btn {
    display: block;
  }
}

/* Image Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox.active {
  display: flex;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
}

.lightbox-close:hover {
  opacity: 1;
}

.post-content img {
  transition: opacity 0.15s;
}

.post-content img:hover {
  opacity: 0.85;
}
