:root {
  --bg: #0f172a;
  --card: #1e293b;
  --border: rgba(51, 65, 85, 0.6);
  --text: #f1f5f9;
  --muted: #b0bec9;
  --primary: #a5b4fc;
  --accent: #fcd34d;
  --success: #4ade80;
  --info: #60a5fa;
  --topbar-height: 56px;
  --content-max-width: 860px;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  background-image: radial-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  margin: 0;
  padding: 0;
}
.hidden { display: none !important; }

/* ============ TOP BAR ============ */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 50;
  height: 56px;
  display: block;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 100%;
  display: flex !important;
  align-items: center;
  padding: 0 20px;
  gap: 24px;
  box-sizing: border-box;
}
.topbar-logo {
  display: flex !important;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-logo h1 {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  margin: 0;
  padding: 0;
  line-height: 1.4;
  color: var(--text);
}
.topbar-nav {
  display: flex !important;
  align-items: center;
  gap: 4px;
}
button.nav-tab {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  white-space: nowrap;
  line-height: 1.4;
  margin: 0;
}
button.nav-tab:hover {
  background: rgba(165, 180, 252, 0.08);
  color: var(--text);
}
button.nav-tab.active {
  background: rgba(165, 180, 252, 0.15);
  color: var(--primary);
}
button.nav-tab i, button.nav-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ============ MAIN WRAPPER ============ */
#mainWrapper {
  min-height: calc(100vh - var(--topbar-height));
  display: flex;
  flex-direction: column;
}

/* ============ CONTENT AREA ============ */
#contentArea {
  flex: 1;
}

/* ============ CONTENT CONTAINER ============ */
.content-container {
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

/* ============ SECTION STICKY ZONE ============ */
.section-sticky-zone {
  position: sticky;
  top: var(--topbar-height);
  z-index: 40;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/* ============ CARD ============ */
.card {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ============ SEARCH ============ */
.search-highlight { background: #fbbf24; color: #000; padding: 0 2px; border-radius: 2px; }
.craft-item-row { transition: background 0.15s; }
.craft-item-row:hover { background: rgba(165, 180, 252, 0.12) !important; }
.craft-item-row:active { background: rgba(165, 180, 252, 0.2) !important; }
.craft-item-row .craft-item-name { transition: color 0.15s; }
.craft-item-row:hover .craft-item-name { color: var(--primary); }
.craftable-material { transition: color 0.15s; cursor: pointer; }
.craftable-material:hover { color: var(--primary) !important; }
.craftable-block { transition: background 0.15s; cursor: pointer; }
.craftable-block:hover { background: rgba(165, 180, 252, 0.12) !important; }

/* ============ SOURCE TAGS ============ */
.source-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-left: 4px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.source-tag i, .source-tag svg { width: 12px; height: 12px; }
.source-gather { background: #22c55e22; color: #86efac; border: 1px solid #22c55e33; }
.source-craft { background: #818cf822; color: #c7d2fe; border: 1px solid #818cf833; }
.source-shop { background: #fbbf2422; color: #fde68a; border: 1px solid #fbbf2433; }
.source-drop { background: #ef444422; color: #fecaca; border: 1px solid #ef444433; }
.source-trade { background: #ec489922; color: #fbcfe8; border: 1px solid #ec489933; }

/* ============ MODAL ============ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
}
.modal.show { display: flex; }
.modal.show .modal-inner {
  animation: modalSlideIn 0.25s ease-out;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-content { max-height: 80vh; overflow-y: auto; }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  color: var(--muted);
}
.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}
.modal-close i, .modal-close svg { width: 18px; height: 18px; }

/* ============ TIPS ============ */
.tip-content { color: var(--text); line-height: 1.7; }
.tip-content ul, .tip-content ol { padding-left: 1.25rem; margin: 0.25rem 0; }
.tip-content ul { list-style: disc; }
.tip-content ol { list-style: decimal; }
.tip-content li { margin: 0.2rem 0; }
.tip-content ul ul { list-style: circle; }
.tip-content table { border-collapse: collapse; }
.tip-content th { border-bottom: 1px solid var(--border); color: var(--muted); }
.tip-content td { border-bottom: 1px solid var(--border); color: var(--text); }
.tip-content p { margin: 0.25rem 0; }
.tip-content strong { color: #fff; }

/* ============ FILTER PILLS ============ */
.filter-btn, .craft-filter-btn, .tip-filter-btn {
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.filter-btn i, .craft-filter-btn i, .tip-filter-btn i,
.filter-btn svg, .craft-filter-btn svg, .tip-filter-btn svg { width: 14px; height: 14px; }
.filter-btn:hover, .craft-filter-btn:hover, .tip-filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ============ TABLE ============ */
thead th {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}
tbody tr { transition: background 0.15s; }

/* ============ SEARCH INPUT ============ */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-input-area {
  position: relative;
  flex: 1;
  min-width: 0;
}
.search-input-area > i, .search-input-area > svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search-input-area input {
  width: 100%;
  padding-left: 42px;
  transition: all 0.2s;
}
.search-input-area input:focus {
  box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.25);
  border-color: var(--primary);
}
.search-btn {
  padding: 12px 18px;
  border-radius: 8px;
  background: var(--primary);
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.search-btn:hover {
  background: #c7d2fe;
  box-shadow: 0 2px 8px rgba(165, 180, 252, 0.4);
}
.search-btn:active {
  transform: scale(0.97);
}
.search-btn i, .search-btn svg { width: 15px; height: 15px; }

/* ============ LOGO ============ */
.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a5b4fc, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(129, 140, 248, 0.35);
}
.logo-icon i, .logo-icon svg { width: 20px; height: 20px; color: white; }

/* ============ ANIMATIONS ============ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.tab-animate {
  animation: fadeSlideIn 0.3s ease-out;
}

/* ============ SECTION TITLE ============ */
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

/* ============ RESPONSIVE ============ */
/* Mobile: < 768px */
@media (max-width: 767px) {
  .topbar-inner {
    gap: 12px;
    padding: 0 12px;
  }
  .topbar-logo h1 {
    display: none !important;
  }
  button.nav-tab {
    padding: 6px 10px;
    font-size: 13px;
    gap: 4px;
  }
  button.nav-tab span {
    display: none;
  }
  button.nav-tab i, button.nav-tab svg {
    width: 20px;
    height: 20px;
  }
  .content-container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* Tablet: 768-1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  button.nav-tab {
    padding: 7px 12px;
    font-size: 13px;
  }
}
