/* ==========================================================================
   WIKIPEDIA VECTOR 2022 MODERN DESIGN SYSTEM & THEME
   ========================================================================== */

:root {
  /* Color Palette - Light Mode */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #eaecf0;
  --bg-hover: #f1f3f5;
  --border-color: #a2a9b1;
  --border-light: #eaecf0;
  --border-subtle: #c8ccd1;
  
  --text-primary: #202122;
  --text-secondary: #54595d;
  --text-muted: #72777d;
  --link-color: #3366cc;
  --link-hover: #447ff5;
  --link-visited: #6b4ba1;
  
  --accent-blue: #36c;
  --accent-blue-hover: #447ff5;
  --accent-blue-bg: #eaf3ff;

  /* Biota Infobox Palette */
  --infobox-header-bg: #90db9b;
  --infobox-header-text: #053b11;
  --infobox-section-bg: #d0f0c0;
  --infobox-border: #8ec396;
  --infobox-bg: #f8fcf9;

  /* Sizing & Layout */
  --header-height: 56px;
  --max-content-width: 1060px;
  --max-content-wide: 1480px;
  --sidebar-toc-width: 240px;
  --sidebar-appearance-width: 180px;

  /* Dynamic Font Scale */
  --base-font-size: 15px;
  --line-height-body: 1.68;
  --heading-font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --body-font: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --serif-font: 'Noto Serif KR', Georgia, serif;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);

  /* Radius */
  --radius-sm: 2px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

/* Dark Mode Theme */
[data-theme="dark"] {
  --bg-primary: #191b1f;
  --bg-secondary: #22252a;
  --bg-tertiary: #2a2e35;
  --bg-hover: #323740;
  --border-color: #40464f;
  --border-light: #2e333a;
  --border-subtle: #4a525d;

  --text-primary: #e6e8ea;
  --text-secondary: #a9b1bb;
  --text-muted: #808894;
  --link-color: #6daaf8;
  --link-hover: #98c6ff;
  --link-visited: #b99aff;

  --accent-blue: #447ff5;
  --accent-blue-hover: #6daaf8;
  --accent-blue-bg: #1c2b3e;

  /* Biota Infobox Dark */
  --infobox-header-bg: #1e4624;
  --infobox-header-text: #a8f0b7;
  --infobox-section-bg: #17361c;
  --infobox-border: #295730;
  --infobox-bg: #1e2420;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);
}

/* Font Size Scales */
[data-font-size="small"] {
  --base-font-size: 13.5px;
}
[data-font-size="standard"] {
  --base-font-size: 15px;
}
[data-font-size="large"] {
  --base-font-size: 17px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--body-font);
  font-size: var(--base-font-size);
  line-height: var(--line-height-body);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

/* Global Link Styles */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

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

/* Button & Icon Base */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-primary);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-button:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ==========================================================================
   HEADER NAVIGATION
   ========================================================================== */

.wiki-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1720px;
  margin: 0 auto;
  padding: 8px 16px;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.hamburger-btn {
  padding: 8px;
}

.wiki-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none !important;
}

.wiki-logo:hover .logo-title {
  color: var(--link-color);
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--serif-font);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.logo-tagline {
  font-size: 11px;
  color: var(--text-muted);
}

/* Header Center - Search */
.header-center {
  flex: 1;
  max-width: 580px;
  position: relative;
}

.search-form-container {
  position: relative;
  display: flex;
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

#wiki-search-input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 36px;
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#wiki-search-input:focus {
  border-color: var(--accent-blue);
  box-shadow: inset 0 0 0 1px var(--accent-blue);
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px;
  border-radius: 50%;
}

.search-submit-btn {
  height: 36px;
  padding: 0 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.search-submit-btn:hover {
  background-color: var(--bg-tertiary);
}

/* Autocomplete Dropdown */
.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  max-height: 340px;
  overflow-y: auto;
}

.search-dropdown.show {
  display: block;
}

.search-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

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

.search-dropdown-item:hover, .search-dropdown-item.active {
  background-color: var(--accent-blue-bg);
}

.search-dropdown-item .item-title {
  font-weight: 600;
  font-size: 14px;
}

.search-dropdown-item .item-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Header Right - User Nav */
.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-nav-link, .user-nav-btn {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}

.donate-link {
  color: #c82829;
  font-weight: 600;
}

.donate-link:hover {
  color: #b01b1c;
}

.user-nav-btn:hover {
  background-color: var(--bg-tertiary);
}

/* Announcement Site Notice Banner */
.site-notice-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #fdf6e2;
  border-top: 1px solid #fae69e;
  border-bottom: 1px solid #fae69e;
  padding: 7px 24px;
  font-size: 13px;
  color: #554400;
}

[data-theme="dark"] .site-notice-banner {
  background-color: #2c2718;
  border-color: #4a4023;
  color: #f6e6aa;
}

.notice-content {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}

.notice-link {
  font-weight: 600;
  text-decoration: underline;
  margin-left: 6px;
}

.notice-close-btn {
  font-size: 14px;
  color: inherit;
  opacity: 0.7;
  padding: 2px 6px;
  border-radius: 4px;
}

.notice-close-btn:hover {
  opacity: 1;
  background-color: rgba(0,0,0,0.06);
}

/* ==========================================================================
   LAYOUT STRUCTURE (3-Column Grid)
   ========================================================================== */

.wiki-layout {
  display: flex;
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 20px 24px 60px;
  gap: 32px;
  position: relative;
  transition: max-width 0.3s ease;
}

[data-width="wide"] .wiki-layout {
  max-width: var(--max-content-wide);
}

/* ==========================================================================
   LEFT SIDEBAR: TABLE OF CONTENTS (Vector 2022)
   ========================================================================== */

.sidebar-toc {
  width: var(--sidebar-toc-width);
  flex-shrink: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.sidebar-toc.collapsed {
  width: 36px;
}

.sidebar-toc.collapsed .toc-body,
.sidebar-toc.collapsed .toc-title {
  display: none;
}

.toc-sticky-container {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding-right: 12px;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.toc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.toc-toggle-btn {
  font-size: 12px;
  color: var(--link-color);
  padding: 2px 4px;
  border-radius: 2px;
}

.toc-toggle-btn:hover {
  text-decoration: underline;
}

.toc-list, .toc-sublist {
  list-style: none;
}

.toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-item {
  position: relative;
}

.toc-link {
  display: block;
  padding: 5px 8px 5px 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.toc-link:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  text-decoration: none;
}

.toc-item.active > .toc-link {
  color: var(--link-color);
  font-weight: 600;
  border-left-color: var(--link-color);
  background-color: var(--accent-blue-bg);
}

.toc-sublist {
  padding-left: 14px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-subitem .toc-link {
  font-size: 12.5px;
  padding: 3px 6px 3px 10px;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.main-content {
  flex: 1;
  min-width: 0;
}

.article-top-bar {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.article-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 16px;
}

.first-heading {
  font-family: var(--serif-font);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.5px;
}

.title-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.tool-btn:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
}

.lang-btn {
  color: var(--link-color);
  font-weight: 600;
}

.arrow-down {
  font-size: 9px;
  margin-left: 2px;
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 1000;
  padding: 6px 0;
}

.dropdown-menu.show {
  display: block;
}

.lang-menu {
  width: 240px;
}

.lang-menu-header {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.lang-list {
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
}

.lang-list li a, .dropdown-menu a {
  display: block;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.12s ease;
}

.lang-list li a:hover, .dropdown-menu a:hover {
  background-color: var(--accent-blue-bg);
  color: var(--link-color);
}

/* Actions Bar (Tabs: 문서, 토론 | 읽기, 편집, 역사 보기) */
.article-actions-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.action-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tab-btn {
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--link-color);
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--link-hover);
  background-color: var(--bg-secondary);
}

.tab-btn.active {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 2px solid var(--accent-blue);
  background-color: transparent;
}

.star-btn {
  font-size: 16px;
  padding: 4px 8px;
  color: var(--text-secondary);
}

.site-sub-tagline {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   ARTICLE CONTENT & SECTIONS
   ========================================================================== */

.article-content {
  font-size: var(--base-font-size);
  line-height: var(--line-height-body);
}

.lead-text {
  font-size: 1.05em;
  margin-bottom: 24px;
}

.lead-text strong {
  font-weight: 700;
}

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

/* Headings */
.wiki-section {
  margin-top: 32px;
  margin-bottom: 24px;
}

.section-title {
  font-family: var(--serif-font);
  font-size: 22px;
  font-weight: 700;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.edit-section {
  font-family: var(--body-font);
  font-size: 12px;
  font-weight: 400;
}

.section-edit-link {
  color: var(--link-color);
}

.subsection-title {
  font-size: 17px;
  font-weight: 700;
  margin: 20px 0 10px;
}

.wiki-bullet-list {
  padding-left: 24px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wiki-bullet-list li {
  line-height: 1.6;
}

/* Citations superscript */
.citation-ref {
  font-size: 11px;
  font-weight: 600;
  padding: 0 2px;
  vertical-align: super;
  color: var(--link-color);
}

/* ==========================================================================
   BIOTA INFOBOX (생물 분류표)
   ========================================================================== */

.infobox {
  float: right;
  clear: right;
  width: 320px;
  margin: 0 0 20px 24px;
  background-color: var(--infobox-bg);
  border: 1px solid var(--infobox-border);
  border-radius: var(--radius-sm);
  padding: 8px;
  box-shadow: var(--shadow-sm);
  font-size: 13.5px;
}

.infobox-header {
  background-color: var(--infobox-header-bg);
  color: var(--infobox-header-text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.infobox-image-wrapper {
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background-color: #000;
}

.coffee-hero-card {
  width: 100%;
}

.coffee-botanical-art {
  width: 100%;
  height: auto;
  display: block;
}

.image-caption {
  font-size: 12px;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  padding: 6px 8px;
  text-align: center;
  border-top: 1px solid var(--border-light);
}

.infobox-section-header {
  background-color: var(--infobox-section-bg);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 13px;
  padding: 5px 8px;
  margin: 8px 0 6px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-sub-btn {
  font-size: 11px;
  color: var(--link-color);
  font-weight: normal;
}

.infobox-table {
  width: 100%;
  border-collapse: collapse;
}

.infobox-table th, .infobox-table td {
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.infobox-table th {
  width: 35%;
  font-weight: 600;
  color: var(--text-secondary);
}

.infobox-binomial {
  text-align: center;
  padding: 8px;
  font-size: 14px;
}

.infobox-binomial em {
  font-weight: 700;
  font-style: italic;
}

.infobox-binomial .author {
  font-size: 12px;
  color: var(--text-muted);
}

.infobox-synonyms {
  padding: 6px 12px;
  font-size: 12.5px;
  background-color: var(--bg-secondary);
  border-radius: 2px;
}

.infobox-synonyms ul {
  padding-left: 18px;
}

/* ==========================================================================
   CARDS, VARIETIES & DATA TABLES
   ========================================================================== */

.fruit-structure-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-left: 4px solid #4caf50;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
}

.variety-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.variety-box:hover {
  box-shadow: var(--shadow-sm);
}

.variety-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  margin-right: 6px;
  vertical-align: middle;
}

.arabica-badge {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.robusta-badge {
  background-color: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
}

.liberica-badge {
  background-color: #f3e5f5;
  color: #7b1fa2;
  border: 1px solid #e1bee7;
}

.feature-highlight {
  margin-top: 10px;
  padding: 10px 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

/* Wiki Comparison Data Table */
.wiki-data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  border: 1px solid var(--border-color);
  font-size: 13.5px;
}

.wiki-data-table th, .wiki-data-table td {
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  text-align: left;
}

.wiki-data-table thead th {
  background-color: var(--bg-secondary);
  font-weight: 700;
  border-bottom: 2px solid var(--border-color);
}

.wiki-data-table tbody tr:hover {
  background-color: var(--bg-hover);
}

/* Photo Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.gallery-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  padding: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

.gallery-thumb {
  border-radius: 2px;
  overflow: hidden;
  background-color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-svg {
  width: 100%;
  height: auto;
  display: block;
}

.gallery-caption {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.4;
  text-align: center;
}

/* References Section */
.references-list {
  padding-left: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ref-jump {
  color: var(--link-color);
  font-weight: bold;
  margin-right: 4px;
}

/* Category Links */
.catlinks-box {
  margin-top: 36px;
  padding: 10px 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.catlinks-header {
  font-weight: 700;
  color: var(--text-secondary);
}

.cat-list {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: 8px;
}

.cat-list li:not(:last-child)::after {
  content: "|";
  margin-left: 8px;
  color: var(--border-color);
}

/* ==========================================================================
   INTERACTIVE VIEWS (TALK, EDIT, HISTORY)
   ========================================================================== */

.talk-notice {
  background-color: #e8f4f8;
  border-left: 4px solid #0288d1;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13.5px;
}

[data-theme="dark"] .talk-notice {
  background-color: #172a36;
  border-color: #29b6f6;
}

.talk-thread {
  border: 1px solid var(--border-light);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}

.talk-thread-title {
  font-size: 16px;
  margin-bottom: 6px;
}

.talk-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.talk-reply {
  margin-top: 12px;
  padding-left: 16px;
  border-left: 3px solid var(--border-color);
}

/* Edit View */
.edit-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.edit-tool-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.edit-tool-btn:hover {
  background-color: var(--bg-tertiary);
}

.wiki-editor-textarea {
  width: 100%;
  font-family: monospace;
  font-size: 14px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  resize: vertical;
  line-height: 1.5;
}

.edit-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-btn {
  background-color: var(--accent-blue);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
}

.primary-btn:hover {
  background-color: var(--accent-blue-hover);
}

.secondary-btn {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.secondary-btn:hover {
  background-color: var(--bg-tertiary);
}

.edit-summary-text {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* History View */
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.history-list li {
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  font-size: 13px;
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.hist-date {
  font-weight: 600;
}

.hist-bytes {
  color: #2e7d32;
  font-weight: 600;
}

.hist-comment {
  color: var(--text-secondary);
}

/* Footer */
.wiki-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 16px;
}

.footer-badges {
  display: flex;
  gap: 12px;
}

.footer-badge {
  padding: 4px 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  font-weight: 600;
  font-size: 11px;
}

/* ==========================================================================
   RIGHT SIDEBAR: APPEARANCE (외관) PANEL (Vector 2022)
   ========================================================================== */

.sidebar-appearance {
  width: var(--sidebar-appearance-width);
  flex-shrink: 0;
}

.sidebar-appearance.collapsed {
  width: 36px;
}

.sidebar-appearance.collapsed .appearance-section,
.sidebar-appearance.collapsed .appearance-title {
  display: none;
}

.appearance-panel {
  position: sticky;
  top: 76px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.appearance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}

.appearance-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.appearance-hide-btn {
  font-size: 12px;
  color: var(--link-color);
}

.appearance-hide-btn:hover {
  text-decoration: underline;
}

.appearance-section {
  margin-bottom: 14px;
}

.appearance-section:last-child {
  margin-bottom: 0;
}

.appearance-section-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
}

.radio-option input[type="radio"] {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.radio-label {
  color: var(--text-primary);
}

/* ==========================================================================
   WIKIPEDIA HOVER PREVIEW POPUP
   ========================================================================== */

.wiki-preview-card {
  display: none;
  position: absolute;
  width: 300px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  padding: 14px 16px;
  pointer-events: auto;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.wiki-preview-card.show {
  display: block;
}

.preview-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
}

.preview-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.preview-footer {
  font-size: 11px;
  color: var(--link-color);
  text-align: right;
  font-weight: 600;
}

/* ==========================================================================
   IMAGE LIGHTBOX MODAL & TOAST
   ========================================================================== */

.wiki-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  align-items: center;
  justify-content: center;
}

.wiki-modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 3001;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 600px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 18px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-image-holder {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  margin-bottom: 12px;
}

.modal-caption {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  text-align: center;
}

/* Toast */
.wiki-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #333;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  z-index: 4000;
  display: none;
  animation: slideUp 0.2s ease;
}

[data-theme="dark"] .wiki-toast {
  background: #f1f3f5;
  color: #111;
}

.wiki-toast.show {
  display: block;
}

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1100px) {
  .sidebar-appearance {
    display: none;
  }
}

@media (max-width: 860px) {
  .sidebar-toc {
    display: none;
  }
  .infobox {
    float: none;
    width: 100%;
    margin: 0 0 20px 0;
  }
  .wiki-layout {
    padding: 16px;
    gap: 0;
  }
  .article-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
