/**
 * Game Ansiklopedi - 9-Slice Bileşenler ve Retro Arayüz
 */

.codex-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ----------------------------------------------------
 * NAVBAR
 * ---------------------------------------------------- */
.codex-navbar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(14, 16, 26, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--c64-cyan);
  box-shadow: 0 4px 0 #000;
}

.codex-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  height: auto;
  padding: 6px 0;
  gap: 1.2rem;
}

.codex-brand {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  text-decoration: none;
  white-space: nowrap;
}

.codex-brand-logo {
  height: 66px;
  width: auto;
  max-width: 145px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.85));
  transition: transform 0.2s ease;
}

.codex-brand-logo:hover {
  transform: scale(1.04);
}

.codex-brand-title {
  display: flex;
  flex-direction: column;
}

.codex-brand-title span:first-child {
  font-family: var(--font-retro-title);
  font-size: 1.85rem;
  line-height: 1;
  color: var(--c64-cyan);
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 0.05em;
}

.codex-brand-sub {
  font-family: var(--font-pixel);
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c64-amber);
  margin-top: 3px;
}

/* ----------------------------------------------------
 * SEARCH (9-Slice + User Search Toggle + Submit Button)
 * ---------------------------------------------------- */
.codex-search-wrapper {
  position: relative;
  flex: 1;
  max-width: 590px;
}

.codex-search-bar-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.codex-search-input-box {
  position: relative;
  flex: 1;
  min-width: 140px;
}

.codex-search-input {
  width: 100%;
  height: 40px;
  padding: 0 0.7rem 0 2.2rem;
  background-color: var(--c64-dark);
  border: 8px solid transparent;
  border-image: url("../assets/textures/search-9slice.png") 16 fill / 8px repeat;
  background-clip: padding-box;
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
}

.codex-search-input:focus {
  filter: drop-shadow(0 0 6px var(--c64-cyan));
}

.codex-search-user-check-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  height: 36px;
  padding: 0 0.55rem;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(112, 164, 178, 0.45);
  border-radius: 3px;
  color: #cbd5e1;
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.codex-search-user-check-pill:hover {
  border-color: var(--c64-amber);
  color: #fde047;
}

.codex-search-user-check-pill input[type="checkbox"] {
  accent-color: #f59e0b;
  width: 13px;
  height: 13px;
  margin: 0;
  cursor: pointer;
}

.codex-search-user-check-pill:has(input:checked) {
  background: rgba(147, 51, 234, 0.28);
  border-color: #c084fc;
  color: #fde047;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.35);
}

.codex-search-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 0.75rem;
  border: 8px solid transparent;
  border-image: url("../assets/textures/button-primary-9slice.png") 28 fill / 8px repeat;
  background-clip: padding-box;
  background-color: #2c1808;
  color: #fde047;
  font-family: var(--font-pixel);
  font-size: 0.52rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.codex-search-submit-btn:hover {
  filter: brightness(1.18) drop-shadow(0 0 6px rgba(250, 204, 21, 0.45));
  transform: translateY(-1px);
}

.codex-search-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 0.65rem 0.95rem;
  border-radius: 4px;
  margin: 1rem 0;
}

.codex-per-page-btn,
.codex-page-num-btn {
  background: #0f172a;
  border: 1px solid #475569;
  color: #cbd5e1;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.32rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-per-page-btn:hover,
.codex-page-num-btn:hover:not(:disabled) {
  border-color: #fde047;
  color: #fde047;
}

.codex-per-page-btn.active,
.codex-page-num-btn.active {
  background: rgba(234, 179, 8, 0.22);
  border-color: #facc15;
  color: #fde047;
  font-weight: 700;
}

.codex-page-num-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .codex-search-bar-row {
    flex-wrap: wrap;
  }
}

.codex-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c64-cyan);
  pointer-events: none;
  font-size: 0.9rem;
}

.codex-search-shortcut {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--c64-navy);
  color: var(--c64-cyan);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 3px 6px;
  border: 1px solid var(--c64-cyan);
  pointer-events: none;
}

.codex-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 16px solid transparent;
  border-image: url("../assets/textures/panel-9slice.png") 36 fill / 16px repeat;
  background-clip: padding-box;
  box-shadow: 0 8px 0 #000;
  max-height: 420px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.codex-search-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--c64-navy);
  cursor: pointer;
  transition: background 0.15s ease;
}

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

.codex-search-item:hover, .codex-search-item.active {
  background: var(--c64-navy);
}

.codex-search-thumb {
  width: 48px;
  height: 48px;
  border: 2px solid var(--c64-cyan);
  object-fit: cover;
  flex-shrink: 0;
  background: #000;
}

.codex-search-info {
  flex: 1;
  min-width: 0;
}

.codex-search-title {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.codex-search-meta {
  font-size: 0.78rem;
  color: var(--c64-cyan);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ----------------------------------------------------
 * BUTTONS (9-Slice)
 * ---------------------------------------------------- */
.codex-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.codex-btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 0.9rem;
  border: 10px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 10px repeat;
  background-clip: padding-box;
  color: var(--c64-cream);
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
  white-space: nowrap;
}

.codex-btn-nav:hover {
  filter: brightness(1.2) drop-shadow(0 0 6px var(--c64-cyan));
  transform: translateY(-1px);
}

.codex-btn-nav:active {
  transform: translateY(1px);
}

.codex-lang-dropdown-container {
  position: relative;
  display: inline-block;
}

.codex-lang-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 8px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 8px repeat;
  background-clip: padding-box;
  color: #d1d5db;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  padding: 4px 10px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.codex-lang-dropdown-trigger:hover {
  color: #fff;
  border-image: url("../assets/textures/button-primary-9slice.png") 28 fill / 8px repeat;
}

.codex-lang-current-flag {
  font-size: 1rem;
  line-height: 1;
}

.codex-lang-current-code {
  font-weight: bold;
  letter-spacing: 0.5px;
}

.codex-lang-dropdown-arrow {
  font-size: 0.75rem;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.codex-lang-dropdown-container.open .codex-lang-dropdown-arrow {
  transform: rotate(180deg);
}

.codex-lang-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 190px;
  border: 12px solid transparent;
  border-image: url("../assets/textures/panel-inner-9slice.png") 32 fill / 12px repeat;
  background-clip: padding-box;
  background-color: #12151c;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.75), 0 0 1px rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  z-index: 1200;
}

.codex-lang-dropdown-container.open .codex-lang-menu {
  display: flex;
  animation: codexLangFadeIn 0.15s ease-out;
}

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

.codex-lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: 3px;
  color: #cbd5e1;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.codex-lang-option:hover {
  background-color: rgba(59, 130, 246, 0.2);
  color: #fff;
}

.codex-lang-option.active {
  background-color: rgba(234, 179, 8, 0.2);
  color: #fbbf24;
  font-weight: bold;
}

.codex-flag-emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.codex-lang-title {
  flex: 1;
  white-space: nowrap;
}

.codex-lang-tag {
  color: #94a3b8;
  font-size: 0.55rem;
  padding: 1px 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
}

/* ----------------------------------------------------
 * WIKILINKS & HOVER CARD (9-Slice)
 * ---------------------------------------------------- */
.codex-wikilink {
  color: var(--c64-cyan);
  border-bottom: 2px dashed var(--c64-cyan);
  text-decoration: none;
  cursor: pointer;
  padding: 0 2px;
  font-weight: 500;
  position: relative;
  z-index: 1;
  transition: all 0.15s ease;
}

.codex-wikilink:hover {
  color: #fff;
  background: var(--c64-navy);
  border-bottom-style: solid;
  text-shadow: 0 0 8px var(--c64-cyan);
}

.codex-hover-card {
  position: fixed;
  z-index: 500;
  width: 320px;
  border: 18px solid transparent;
  border-image: url("../assets/textures/panel-9slice.png") 36 fill / 18px repeat;
  background-clip: padding-box;
  box-shadow: 0 10px 0 #000, 0 0 24px var(--c64-cyan-glow);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
  display: none;
}

.codex-hover-card.visible {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

.codex-hover-media {
  width: 100%;
  height: 140px;
  position: relative;
  overflow: hidden;
  background: #000;
  border-bottom: 2px solid var(--c64-cyan);
}

.codex-hover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #05070e;
}

.codex-hover-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #000;
  border: 1px solid var(--c64-cyan);
  color: var(--c64-cyan);
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 2px 6px;
  text-transform: uppercase;
}

.codex-hover-body {
  padding: 0.6rem 0.4rem;
}

.codex-hover-title {
  font-family: var(--font-retro-title);
  font-size: 1.35rem;
  color: #fff;
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.codex-hover-meta {
  font-size: 0.75rem;
  color: var(--c64-cyan);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.codex-hover-snippet {
  font-size: 0.82rem;
  color: #c5ced6;
  line-height: 1.45;
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.codex-hover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--c64-amber);
  border-top: 1px solid var(--c64-navy);
  padding-top: 0.4rem;
}

/* ----------------------------------------------------
 * BADGES
 * ---------------------------------------------------- */
.codex-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.codex-badge-verified {
  background: rgba(124, 161, 96, 0.2);
  color: var(--c64-green);
  border-color: var(--c64-green);
}

.codex-badge-primary {
  background: rgba(112, 164, 178, 0.2);
  color: var(--c64-cyan);
  border-color: var(--c64-cyan);
}

.codex-badge-country {
  background: var(--c64-navy);
  color: var(--c64-cream);
  border-color: var(--c64-cyan);
}

.codex-badge-year {
  background: #000;
  color: var(--c64-amber);
  border-color: var(--c64-amber);
}

.codex-badge-category {
  background: rgba(144, 96, 178, 0.25);
  color: #d1b3ff;
  border-color: #a87ee6;
}

.codex-badge-interactive {
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-badge-interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  filter: brightness(1.25);
}

/* Article Tags Row */
.codex-article-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--c64-navy);
}

.codex-tags-label {
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  color: var(--c64-cyan);
  text-transform: uppercase;
}

.codex-tag-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-family: var(--font-retro-title);
  font-size: 0.95rem;
  color: var(--c64-cream);
  background: var(--c64-navy);
  border: 1px solid var(--c64-cyan);
  text-decoration: none;
  transition: all 0.15s ease;
}

.codex-tag-badge:hover {
  background: var(--c64-cyan);
  color: #000;
  border-color: #fff;
  transform: translateY(-1px);
}

/* Active Filter Banner */
.codex-filter-active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.4rem;
  margin-bottom: 1.5rem;
  background: rgba(112, 164, 178, 0.15);
  border: 2px solid var(--c64-cyan);
  box-shadow: 0 4px 0 #000;
}

.codex-filter-active-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-retro-title);
  font-size: 1.3rem;
  color: var(--c64-cream);
}

.codex-btn-clear-filter {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  padding: 0.5rem 0.8rem;
  background: #000;
  color: var(--c64-amber);
  border: 1px solid var(--c64-amber);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-btn-clear-filter:hover {
  background: var(--c64-amber);
  color: #000;
}

/* ----------------------------------------------------
 * ARTICLE LAYOUT (9-Slice Panels)
 * ---------------------------------------------------- */
.codex-main {
  padding: 2rem 0 4rem 0;
  min-height: calc(100vh - 180px);
}

.codex-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 2.2rem;
  align-items: start;
}

@media (max-width: 960px) {
  .codex-article-layout {
    grid-template-columns: 1fr;
  }
}

.codex-article-header {
  margin-bottom: 1.8rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--c64-cyan);
}

.codex-article-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.codex-article-subtitle {
  font-family: var(--font-retro-title);
  font-size: 1.45rem;
  color: var(--c64-amber);
  margin-top: 0.3rem;
  letter-spacing: 0.03em;
}

.codex-lead-box {
  border: 18px solid transparent;
  border-image: url("../assets/textures/panel-9slice.png") 36 fill / 18px repeat;
  background-clip: padding-box;
  padding: 0.8rem 1rem;
  margin-bottom: 2rem;
  font-size: 1.1rem;
  line-height: 1.7;
}

.codex-lead-box p {
  margin-bottom: 0;
  font-size: 1.1rem;
  color: #fff;
}

.codex-section {
  margin-bottom: 2.2rem;
}

.codex-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.65rem;
  color: var(--c64-cyan);
  margin-bottom: 0.8rem;
  border-bottom: 2px solid var(--c64-navy);
  padding-bottom: 0.3rem;
}

/* Sidebar Infobox (9-Slice) */
.codex-infobox {
  border: 18px solid transparent;
  border-image: url("../assets/textures/panel-9slice.png") 36 fill / 18px repeat;
  background-clip: padding-box;
  padding: 0.8rem;
  position: sticky;
  top: 90px;
  box-shadow: 0 6px 0 #000;
}

.codex-infobox-header {
  text-align: center;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--c64-cyan);
  margin-bottom: 0.8rem;
}

.codex-infobox-title {
  font-family: var(--font-retro-title);
  font-size: 1.5rem;
  color: var(--c64-amber);
}

.codex-infobox-media {
  width: 100%;
  border: 2px solid var(--c64-cyan);
  background: #000;
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.codex-infobox-img {
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  background: #05070e;
  display: block;
}

.codex-infobox-caption {
  font-size: 0.78rem;
  color: var(--c64-cyan);
  text-align: center;
  font-style: italic;
  margin-bottom: 0.8rem;
  line-height: 1.35;
}

.codex-infobox-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.codex-infobox-table tr {
  border-bottom: 1px solid var(--c64-navy);
}

.codex-infobox-table tr:last-child {
  border-bottom: none;
}

.codex-infobox-table th {
  text-align: left;
  padding: 0.5rem 0.4rem 0.5rem 0;
  color: var(--c64-amber);
  font-family: var(--font-body);
  font-weight: 600;
  width: 40%;
  vertical-align: top;
}

.codex-infobox-table td {
  padding: 0.5rem 0;
  color: #d1d8df;
  vertical-align: top;
}

/* ----------------------------------------------------
 * CITATIONS & VERIFICATION (9-Slice)
 * ---------------------------------------------------- */
.codex-verification-box {
  border: 8px solid transparent;
  border-image: url("../assets/textures/panel-9slice.png") 36 fill / 8px repeat;
  background-clip: padding-box;
  padding: 0.6rem 0.9rem;
  margin-top: 1rem;
  margin-bottom: 1.2rem;
}

.codex-verification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.codex-verification-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-retro-title);
  font-size: 1.15rem;
  color: var(--c64-cyan);
}

.codex-sources-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .codex-sources-grid {
    grid-template-columns: 1fr;
  }
}

.codex-source-card {
  border: 10px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 10px repeat;
  background-clip: padding-box;
  padding: 0.6rem 0.8rem;
}

.codex-source-type {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  text-transform: uppercase;
  color: var(--c64-amber);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.codex-source-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.codex-source-name a {
  color: var(--c64-cyan);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.codex-source-note {
  font-size: 0.82rem;
  color: #a0abb8;
  line-height: 1.4;
}

/* ----------------------------------------------------
 * FEEDBACK BANNER (9-Slice)
 * ---------------------------------------------------- */
.codex-feedback-banner {
  border: 18px solid transparent;
  border-image: url("../assets/textures/panel-9slice.png") 36 fill / 18px repeat;
  background-clip: padding-box;
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.codex-feedback-title {
  font-family: var(--font-retro-title);
  font-size: 1.45rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.codex-feedback-desc {
  font-size: 0.88rem;
  color: #c5ced6;
  margin-bottom: 0;
}

.codex-btn-feedback {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 10px solid transparent;
  border-image: url("../assets/textures/button-primary-9slice.png") 28 fill / 10px repeat;
  background-clip: padding-box;
  color: #000;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.codex-btn-feedback:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

/* ----------------------------------------------------
 * IMAGE LIGHTBOX / POPUP MODAL
 * ---------------------------------------------------- */
.codex-image-modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  background: rgba(14, 16, 26, 0.96);
  border: 3px solid var(--c64-cyan);
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.95), 0 0 25px rgba(112, 164, 178, 0.4);
  padding: 1rem;
  overflow: hidden;
  animation: codexModalZoomIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes codexModalZoomIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.codex-image-modal-img {
  max-width: 85vw;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
  background: #000;
}

.codex-image-modal-caption {
  margin-top: 0.8rem;
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--c64-light-grey);
  text-align: center;
  max-width: 80vw;
  line-height: 1.45;
  letter-spacing: 0.04em;
}

.codex-image-modal-title {
  font-family: var(--font-retro-title);
  font-size: 1.35rem;
  color: var(--c64-cyan);
  margin-bottom: 0.5rem;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}

.codex-image-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.75);
  border: 2px solid var(--c64-cyan);
  color: #fff;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 10;
}

.codex-image-modal-close:hover {
  background: var(--c64-red);
  border-color: #fff;
  transform: scale(1.12);
}

.codex-infobox-img {
  cursor: zoom-in;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.codex-infobox-img:hover {
  filter: brightness(1.08);
  transform: scale(1.02);
}

/* ----------------------------------------------------
 * MODAL (9-Slice)
 * ---------------------------------------------------- */
.codex-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.codex-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.codex-modal {
  width: 100%;
  max-width: 540px;
  border: 24px solid transparent;
  border-image: url("../assets/textures/window-modal-9slice.png") 40 fill / 24px repeat;
  background-clip: padding-box;
  box-shadow: 0 10px 0 #000, 0 0 30px rgba(112, 164, 178, 0.3);
  overflow: hidden;
}

.codex-modal-header {
  padding: 0.6rem 0.8rem 0.8rem 0.8rem;
  border-bottom: 2px solid var(--c64-cyan);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.codex-modal-title {
  font-family: var(--font-retro-title);
  font-size: 1.6rem;
  color: var(--c64-cyan);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.codex-modal-close {
  background: transparent;
  border: none;
  color: var(--c64-cream);
  font-size: 1.5rem;
  cursor: pointer;
}

.codex-modal-body {
  padding: 1rem 0.8rem;
}

.codex-form-group {
  margin-bottom: 1rem;
}

.codex-form-label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  color: var(--c64-amber);
  margin-bottom: 0.4rem;
}

.codex-form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: #080910;
  border: 2px solid var(--c64-cyan);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
}

.codex-form-control:focus {
  border-color: var(--c64-amber);
  box-shadow: 0 0 8px var(--c64-amber-glow);
}

textarea.codex-form-control {
  min-height: 100px;
  resize: vertical;
}

.codex-modal-footer {
  padding: 0.8rem;
  border-top: 2px solid var(--c64-navy);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}

.codex-btn-secondary {
  border: 10px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 10px repeat;
  background-clip: padding-box;
  color: var(--c64-cream);
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

/* ----------------------------------------------------
 * EXPLORE CATALOG (9-Slice Cards & Filters)
 * ---------------------------------------------------- */
.codex-explore-hero {
  text-align: center;
  padding: 2.2rem 1rem 2rem 1rem;
  margin-bottom: 2rem;
  border-bottom: 3px solid var(--c64-cyan);
}

.codex-explore-title {
  font-size: 3.2rem;
  margin-bottom: 0.3rem;
  color: var(--c64-cyan);
}

.codex-explore-subtitle {
  color: #c5ced6;
  font-size: 1.1rem;
  max-width: 680px;
  margin: 0 auto;
}

.codex-filter-section {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.codex-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.codex-filter-label {
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  text-transform: uppercase;
  color: var(--c64-amber);
  width: 95px;
  flex-shrink: 0;
}

.codex-filter-pill {
  border: 10px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 10px repeat;
  background-clip: padding-box;
  color: var(--c64-cream);
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-filter-pill:hover {
  filter: brightness(1.2);
}

.codex-filter-pill.active {
  border-image: url("../assets/textures/button-primary-9slice.png") 28 fill / 10px repeat;
  color: #000;
  font-weight: bold;
}

/* ----------------------------------------------------
 * CARD GRID (9-Slice)
 * ---------------------------------------------------- */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.6rem;
}

.codex-card {
  border: 14px solid transparent;
  border-image: url("../assets/textures/card-9slice.png") 32 fill / 14px repeat;
  background-clip: padding-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.codex-card:hover {
  transform: translateY(-4px);
  filter: drop-shadow(0 4px 12px var(--c64-cyan-glow));
}

.codex-card-thumb-wrap {
  width: 100%;
  height: 185px;
  overflow: hidden;
  position: relative;
  background: #000;
  border-bottom: 2px solid var(--c64-cyan);
}

.codex-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.codex-card:hover .codex-card-img {
  transform: scale(1.05);
}

.codex-card-country-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #000;
  border: 1px solid var(--c64-cyan);
  font-size: 0.72rem;
  padding: 2px 6px;
  color: #fff;
}

.codex-card-year-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #000;
  border: 1px solid var(--c64-amber);
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 2px 6px;
  color: var(--c64-amber);
}

.codex-card-content {
  padding: 0.6rem 0.4rem 0.2rem 0.4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.codex-card-category {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  text-transform: uppercase;
  color: var(--c64-cyan);
  margin-bottom: 0.3rem;
}

.codex-card-title {
  font-family: var(--font-retro-title);
  font-size: 1.45rem;
  color: #fff;
  margin-bottom: 0.3rem;
  line-height: 1.2;
}

.codex-card-snippet {
  font-size: 0.85rem;
  color: #a0abb8;
  line-height: 1.45;
  margin-bottom: 0.8rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.codex-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--c64-navy);
  padding-top: 0.5rem;
  font-size: 0.75rem;
}

.codex-card-link-text {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--c64-amber);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ----------------------------------------------------
 * RELATED ENTITIES (9-Slice Chips)
 * ---------------------------------------------------- */
.codex-related-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--c64-navy);
}

.codex-related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.codex-related-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 10px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 10px repeat;
  background-clip: padding-box;
  padding: 0.35rem 0.7rem;
  color: #fff;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.codex-related-chip:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

/* ----------------------------------------------------
 * FOOTER
 * ---------------------------------------------------- */
.codex-footer {
  border-top: 3px solid var(--c64-cyan);
  background: #080910;
  padding: 2.5rem 0;
  color: #8c95a6;
  font-size: 0.85rem;
}

.codex-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.codex-footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.codex-footer-badge {
  color: var(--c64-cyan);
  font-family: var(--font-retro-title);
  font-size: 1.4rem;
}

/* ==========================================================================
   GAP Social Share Toolbar & Actions
   ========================================================================== */
.codex-share-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: -1rem 0 1.8rem 0;
  padding: 0.6rem 0.9rem;
  background: rgba(18, 24, 38, 0.7);
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: 4px;
}

.codex-share-label {
  font-family: var(--font-retro-title);
  font-size: 1.1rem;
  color: var(--c64-amber);
  margin-right: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.codex-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-retro-title);
  font-size: 1.05rem;
  color: #fff;
  background: #161f30;
  border: 1px solid #334155;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.codex-share-btn:hover {
  background: #1e293b;
  border-color: var(--c64-cyan);
  color: var(--c64-cyan);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}

.codex-share-btn:active {
  transform: translateY(0);
}

.codex-share-btn.codex-share-x:hover {
  border-color: #ffffff;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
}

.codex-share-btn.codex-share-wa:hover {
  border-color: #22c55e;
  color: #22c55e;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.codex-share-btn.codex-share-copy:hover {
  border-color: var(--c64-amber);
  color: var(--c64-amber);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

/* ==========================================================================
   MOBILE & RESPONSIVE PERFECTION (<960px, <768px, <480px)
   ========================================================================== */
@media (max-width: 960px) {
  .codex-infobox {
    position: static;
    margin-top: 2rem;
    width: 100%;
    max-width: 100%;
  }

  .codex-infobox-img {
    max-height: 260px;
  }
}

@media (max-width: 768px) {
  .codex-container {
    padding: 0 0.9rem;
  }

  .codex-navbar-inner {
    height: auto;
    padding: 0.6rem 0;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .codex-brand {
    flex: 1 1 auto;
    gap: 0.6rem;
  }

  .codex-brand-logo {
    height: 52px;
    width: auto;
    max-width: 110px;
  }

  .codex-brand-title span:first-child {
    font-size: 1.5rem;
  }

  .codex-brand-sub {
    font-size: 0.48rem;
    letter-spacing: 0.08em;
  }

  .codex-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .codex-search-wrapper {
    order: 3;
    flex: 1 1 100%;
    max-width: 100%;
    width: 100%;
    margin-top: 0.2rem;
  }

  .codex-search-input {
    height: 42px;
    font-size: 16px; /* Prevents auto-zoom on iOS Safari */
  }

  .codex-search-shortcut {
    display: none; /* No physical Ctrl key on mobile touchscreens */
  }

  .codex-heading {
    font-size: 1.85rem;
  }

  .codex-article-subtitle {
    font-size: 1.25rem;
  }

  .codex-section-title {
    font-size: 1.4rem;
  }

  .codex-filter-pills {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    gap: 0.4rem;
    scrollbar-width: none;
  }

  .codex-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .codex-filter-pill {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.4rem 0.65rem;
    font-size: 0.52rem;
  }

  .codex-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
  }
}

@media (max-width: 480px) {
  .codex-container {
    padding: 0 0.65rem;
  }

  .codex-brand-logo {
    height: 44px;
    width: auto;
    max-width: 90px;
  }

  .codex-brand-title span:first-child {
    font-size: 1.25rem;
  }

  .codex-brand-sub {
    display: none; /* Keep top row clean and uncluttered */
  }

  .codex-btn-nav span:last-child {
    display: none; /* Only show random icon on ultra small phones */
  }

  .codex-btn-nav {
    padding: 0.45rem 0.6rem;
  }

  .codex-lang-btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.65rem;
  }

  .codex-heading {
    font-size: 1.55rem;
    line-height: 1.15;
  }

  .codex-article-subtitle {
    font-size: 1.15rem;
  }

  .codex-lead-box {
    border-width: 12px;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    line-height: 1.6;
  }

  .codex-lead-box p {
    font-size: 1rem;
  }

  .codex-share-toolbar {
    padding: 0.5rem;
    gap: 0.35rem;
  }

  .codex-share-label {
    width: 100%;
    margin-bottom: 0.2rem;
    font-size: 1rem;
  }

  .codex-share-btn {
    flex: 1 1 calc(50% - 0.35rem);
    justify-content: center;
    padding: 0.45rem 0.5rem;
    font-size: 0.95rem;
    min-height: 38px; /* Comfortable finger tap target */
  }

  .codex-grid {
    grid-template-columns: 1fr; /* Single column on phones */
    gap: 1.2rem;
  }

  .codex-modal-content {
    width: 95%;
    max-width: 95%;
    padding: 1rem;
  }

  .codex-footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .codex-footer-left,
  .codex-footer-inner > div:last-child {
    text-align: center !important;
  }
}

/* Touch screen optimization: disable hovercard sticking on touch */
@media (hover: none) and (pointer: coarse) {
  .codex-hovercard {
    display: none !important; /* Direct tap navigation without floating card popups */
  }
}




/* ==========================================================================
   X SHARE MODAL & COMMUNITY COMMENTS (REDDIT-STYLE VOTING)
   ========================================================================== */
.codex-x-modal-box {
  max-width: 580px;
  width: 92%;
  background: #111827;
  border: 1px solid var(--border-gold, #eab308);
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(234, 179, 8, 0.2);
  padding: 1.4rem;
  color: #f3f4f6;
  position: relative;
  animation: codexModalZoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.codex-x-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.codex-x-modal-title {
  font-family: var(--font-retro-title, sans-serif);
  font-size: 1.25rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.codex-x-preview-chip {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(31, 41, 55, 0.7);
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.9rem;
}

.codex-x-preview-img {
  width: auto;
  max-width: 115px;
  height: auto;
  max-height: 78px;
  object-fit: contain;
  background: #05070e;
  padding: 3px;
  border-radius: 4px;
  border: 1px solid var(--border-gold, #eab308);
  flex-shrink: 0;
}

.codex-x-editor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.codex-x-edit-btn {
  background: #1f2937;
  color: var(--c64-amber, #f59e0b);
  border: 1px solid var(--c64-amber, #f59e0b);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-family: var(--font-retro-title, sans-serif);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.codex-x-edit-btn:hover {
  background: var(--c64-amber, #f59e0b);
  color: #111827;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.codex-x-textarea {
  width: 100%;
  height: 110px;
  background: #0b0f19;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #f9fafb;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 0.75rem;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.codex-x-textarea:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.codex-x-char-bar {
  display: flex;
  justify-content: flex-end;
  font-size: 0.82rem;
  color: #9ca3af;
  margin-top: 0.3rem;
  margin-bottom: 1rem;
}

.codex-x-char-bar.limit-near {
  color: #f59e0b;
}

.codex-x-char-bar.limit-reached {
  color: #ef4444;
  font-weight: bold;
}

.codex-x-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Community Comments & Reddit-style voting */
.codex-community-section {
  margin-top: 2.5rem;
  padding-top: 1.8rem;
  border-top: 2px solid rgba(234, 179, 8, 0.3);
}

.codex-community-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.codex-community-title {
  font-family: var(--font-retro-title, sans-serif);
  font-size: 1.35rem;
  color: var(--c64-amber, #f59e0b);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.codex-comment-form {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-sizing: border-box;
}

.codex-comment-input-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.codex-comment-author-input {
  flex: 1;
  max-width: 260px;
  background: #0b0f19;
  border: 1px solid #4b5563;
  color: #fff;
  padding: 0.45rem 0.7rem;
  border-radius: 4px;
  font-size: 0.88rem;
  box-sizing: border-box;
}

.codex-comment-textarea {
  width: 100%;
  height: 75px;
  background: #0b0f19;
  border: 1px solid #4b5563;
  color: #fff;
  padding: 0.6rem;
  border-radius: 4px;
  font-size: 0.92rem;
  resize: vertical;
  margin-bottom: 0.6rem;
  box-sizing: border-box;
  font-family: inherit;
}

.codex-comment-submit-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 0.45rem 1.1rem;
  border-radius: 4px;
  font-family: var(--font-retro-title, sans-serif);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.95rem;
}

.codex-comment-submit-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
}

.codex-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.codex-comment-card {
  display: flex;
  background: rgba(22, 31, 48, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: visible;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.codex-comment-card:hover {
  border-color: rgba(234, 179, 8, 0.4);
}

.codex-vote-col {
  width: 48px;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  user-select: none;
}

.codex-vote-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  transition: all 0.15s ease;
  border-radius: 3px;
}

.codex-vote-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.codex-vote-btn.up.active {
  color: #60a5fa;
  text-shadow: 0 0 8px rgba(96, 165, 250, 0.6);
}

.codex-vote-btn.down.active {
  color: #93c5fd;
  text-shadow: 0 0 8px rgba(147, 197, 253, 0.5);
}

.codex-vote-score {
  font-family: var(--font-retro-title, sans-serif);
  font-size: 0.88rem;
  font-weight: bold;
  color: #d6eaff;
  background: rgba(96, 165, 250, 0.20);
  border: 1px solid rgba(147, 197, 253, 0.35);
  padding: 0.15rem 0.42rem;
  border-radius: 4px;
  margin: 0.25rem 0;
}

.codex-vote-score.positive {
  color: #d6eaff;
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(96, 165, 250, 0.45);
}

.codex-vote-score.negative {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.3);
}

.codex-comment-main {
  flex: 1;
  padding: 0.8rem 1rem;
}

.codex-comment-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.codex-comment-author {
  font-weight: 600;
  color: #f8fafc;
}

.codex-comment-author.curator-gold {
  color: #eab308;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(234, 179, 8, 0.25);
}

.codex-curator-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.48rem;
  border-radius: 3px;
  background: rgba(234, 179, 8, 0.16);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.45);
}

.codex-comment-card.curator-pinned-card {
  border-color: rgba(234, 179, 8, 0.45);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.92) 0%, rgba(17, 24, 39, 0.92) 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(250, 204, 21, 0.12);
}

.codex-btn-become-curator {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.55) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 5px;
  color: #dbeafe;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
}

.codex-btn-become-curator:hover {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.7) 0%, rgba(30, 58, 138, 0.9) 100%);
  border-color: #93c5fd;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.codex-infobox-curator-box {
  margin-top: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: rgba(234, 179, 8, 0.10);
  border: 1px solid rgba(234, 179, 8, 0.35);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.codex-comment-share-mini {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.codex-comment-share-mini:hover {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(147, 197, 253, 0.45);
  color: #fff;
}

.codex-comment-source-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.codex-comment-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #e5e7eb;
  word-break: break-word;
}

/* ==========================================================================
   REDDIT + X HYBRID 16-BIT THREADED REPLIES & COLLAPSIBLE LINES
   ========================================================================== */

.codex-thread-group {
  display: flex;
  flex-direction: column;
}

.codex-replies-branch-wrapper {
  position: relative;
  margin-left: 22px;
  padding-left: 18px;
  margin-top: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Reddit-style interactive vertical guide rail */
.codex-thread-rail-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 6px;
  width: 12px;
  cursor: pointer;
  display: flex;
  justify-content: center;
}

.codex-thread-rail-line::before {
  content: '';
  width: 2px;
  height: 100%;
  background: rgba(96, 165, 250, 0.28);
  border-radius: 2px;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.codex-thread-rail-line:hover::before {
  background: #60a5fa;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.65);
}

.codex-reply-card {
  position: relative;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 5px;
}

.codex-reply-box-inline {
  margin-top: 0.55rem;
  margin-left: 22px;
  padding: 0.65rem 0.8rem;
  background: rgba(11, 15, 25, 0.95);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 5px;
}

.codex-thread-toggle-pill {
  background: rgba(30, 58, 138, 0.28);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #d6eaff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.codex-thread-toggle-pill:hover {
  background: rgba(59, 130, 246, 0.35);
  border-color: #93c5fd;
  color: #ffffff;
}


/* ==========================================================================
   MODAL BACKDROP & POPUP OVERLAY FIX (.codex-modal-backdrop)
   ========================================================================== */
.codex-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.codex-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.codex-modal-backdrop .codex-modal-content {
  width: 100%;
  background: #0d131f;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.92), 0 0 24px rgba(59, 130, 246, 0.25);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

/* Curator Tier Selector Tabs inside Modal */
.codex-tier-tab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
}

.codex-tier-tab-btn {
  padding: 0.6rem 0.5rem;
  border-radius: 6px;
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  background: #111827;
  color: #94a3b8;
  border: 1px solid #334155;
}

.codex-tier-tab-btn.active-curator {
  background: rgba(234, 179, 8, 0.16);
  color: #facc15;
  border-color: #eab308;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.25);
}

.codex-tier-tab-btn.active-supporter {
  background: rgba(59, 130, 246, 0.18);
  color: #dbeafe;
  border-color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}

/* Sticky / Flush Filter Ribbon right under Hero Banner */
.codex-explore-hero {
  text-align: center;
  padding: 1.5rem 1rem 1.2rem 1rem !important;
  margin-bottom: 0 !important;
  border-bottom: 2px solid var(--c64-cyan);
}

.codex-attached-filter-bar {
  background: rgba(8, 11, 18, 0.96);
  border: 1px solid rgba(112, 164, 178, 0.35);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 1.6rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.codex-attached-filter-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.codex-attached-filter-label {
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--c64-amber);
  text-transform: uppercase;
  margin-right: 0.25rem;
  min-width: 72px;
}

.codex-attached-filter-bar .codex-filter-pill {
  font-size: 0.5rem !important;
  padding: 0.2rem 0.5rem !important;
  border-width: 6px !important;
}

.codex-popular-tag-pill {
  display: inline-block;
  padding: 0.16rem 0.48rem;
  font-family: var(--font-retro-title);
  font-size: 0.85rem;
  color: var(--c64-cream);
  background: rgba(29, 43, 83, 0.75);
  border: 1px solid rgba(112, 164, 178, 0.45);
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-popular-tag-pill:hover,
.codex-popular-tag-pill.active {
  background: var(--c64-cyan);
  color: #000;
  border-color: #fff;
}

/* 4x2 Popular Articles Grid on Desktop */
.codex-popular-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.15rem;
  margin-bottom: 2.2rem;
}

@media (max-width: 1100px) {
  .codex-popular-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .codex-popular-grid {
    grid-template-columns: 1fr;
  }
}

.codex-section-divider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.5rem 0 1rem 0;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid rgba(112, 164, 178, 0.35);
}

.codex-section-divider-title {
  font-family: var(--font-retro-title);
  font-size: 1.45rem;
  color: var(--c64-amber);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* Quarter-size Compact Report Issue Button */
.codex-btn-feedback-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.58rem !important;
  font-family: var(--font-pixel);
  font-size: 0.48rem !important;
  background: rgba(15, 23, 42, 0.85);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-btn-feedback-mini:hover {
  background: rgba(37, 99, 235, 0.3);
  color: #fff;
  border-color: #60a5fa;
}


/* ==========================================================================
   PROMOTED BOXLESS ARTICLE SECTIONS (CURATOR & +10 VOTE COMMUNITY ENTRIES)
   ========================================================================== */
.codex-promoted-sections-wrap {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.codex-promoted-article-section {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  padding: 0.4rem 0 1.2rem 0;
  border-bottom: 1px dashed rgba(112, 164, 178, 0.25);
  background: transparent; /* Kutu içinde DEĞİL, doğrudan makale gibi akar */
}

.codex-promoted-vote-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 44px;
  padding-top: 0.1rem;
  user-select: none;
  background: transparent;
  border: none;
}

.codex-promoted-vote-rail .codex-vote-btn,
.codex-promoted-vote-btn {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(100, 116, 139, 0.32);
  border-radius: 4px;
  color: #94a3b8;
  padding: 3px 5px;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: all 0.15s ease;
}

.codex-promoted-vote-rail .codex-vote-btn:hover,
.codex-promoted-vote-btn:hover {
  opacity: 1;
  border-color: var(--c64-amber);
  background: rgba(30, 41, 59, 0.92);
  transform: translateY(-1px);
}

.codex-promoted-vote-rail .codex-vote-btn.up.active,
.codex-promoted-vote-btn.up.active {
  opacity: 1;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.16);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.35);
}

.codex-promoted-vote-rail .codex-vote-btn.down.active,
.codex-promoted-vote-btn.down.active {
  opacity: 1;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.16);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
}

.codex-promoted-score-big {
  font-family: var(--font-retro-title);
  font-size: 1.35rem;
  font-weight: bold;
  color: var(--c64-amber);
  line-height: 1.1;
  margin: 0.15rem 0;
  background: transparent;
  border: none;
  padding: 0;
}

.codex-promoted-body {
  flex: 1;
  min-width: 0;
}

.codex-promoted-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
  flex-wrap: wrap;
}

.codex-promoted-paragraph {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-primary, #e2e8f0);
  margin: 0 0 0.45rem 0;
  word-break: break-word;
}

.codex-promoted-author-sign {
  text-align: right;
  font-size: 0.84rem;
  font-style: italic;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.codex-promoted-author-sign.curator-gold {
  color: #eab308;
  font-weight: 600;
}

.codex-comment-title-input {
  width: 100%;
  background: #0b0f19;
  border: 1px solid #374151;
  color: #f8fafc;
  padding: 0.48rem 0.65rem;
  border-radius: 4px;
  font-size: 0.86rem;
  margin-bottom: 0.5rem;
  box-sizing: border-box;
  font-family: inherit;
}

.codex-comment-title-input:focus {
  border-color: #60a5fa;
  outline: none;
}


/* Promoted Article Section Footer & Collapsible Replies Drawer */
.codex-promoted-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}
.codex-promoted-replies-drawer {
  margin-top: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: rgba(11, 15, 25, 0.55);
  border-left: 2px solid rgba(56, 189, 248, 0.45);
  border-radius: 0 6px 6px 0;
}
.codex-promoted-replies-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.codex-promoted-reply-item {
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.16);
}
.codex-promoted-reply-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}


/* ==========================================================================
   COMMENT COORDINATES (#1, #5.7), HEX ID, MENTIONS & [B]/[I] TOOLBAR
   ========================================================================== */
.codex-comment-coord {
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(100, 116, 139, 0.28);
  padding: 1px 5px;
  border-radius: 3px;
  user-select: all;
}

.codex-comment-hex {
  font-family: monospace;
  font-size: 0.66rem;
  color: #475569;
  letter-spacing: 0.04em;
}

.codex-mention-tag {
  display: inline-block;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.86em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 0 5px;
  border-radius: 3px;
  text-decoration: none;
}

.codex-cmt-bbcode-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.codex-cmt-bbcode-btn {
  background: #111827;
  border: 1px solid #334155;
  color: #dbeafe;
  font-family: monospace;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-cmt-bbcode-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: #60a5fa;
  color: #fff;
}

.codex-author-profile-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.codex-author-profile-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   TOP-RIGHT PERSONAL USER ACCOUNT DROPDOWN MENU (9-SLICE RETRO CONSOLE)
   ========================================================================== */
.codex-user-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.codex-user-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 8px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 8px repeat;
  background-clip: padding-box;
  background-color: #16102b;
  padding: 0.2rem 0.65rem;
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  color: #f3e8ff;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.codex-user-trigger-btn:hover {
  border-image: url("../assets/textures/button-primary-9slice.png") 28 fill / 8px repeat;
  filter: brightness(1.15) drop-shadow(0 0 8px rgba(192, 132, 252, 0.55));
  transform: translateY(-1px);
}

.codex-notif-badge {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #ffffff;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  font-weight: 700;
  padding: 2px 5px;
  border: 1px solid #fecdd3;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.6);
  line-height: 1.1;
}

.codex-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 445px;
  max-width: 94vw;
  max-height: 84vh;
  overflow-y: auto;
  border: 20px solid transparent;
  border-image: url("../assets/textures/window-modal-9slice.png") 40 fill / 20px repeat;
  background-clip: padding-box;
  background: radial-gradient(circle at top right, rgba(88, 28, 135, 0.48), transparent 65%),
              linear-gradient(180deg, #130d26 0%, #0b0718 100%);
  box-shadow: 0 14px 0 #000, 0 0 36px rgba(168, 85, 247, 0.42), inset 0 0 22px rgba(251, 191, 36, 0.08);
  z-index: 3000;
  padding: 0.45rem 0.55rem 0.65rem 0.55rem;
  display: none;
  text-align: left;
}

.codex-user-dropdown.open {
  display: block;
  animation: codexConsoleDropIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes codexConsoleDropIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.codex-user-dd-console-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(88, 28, 135, 0.65) 0%, rgba(30, 27, 75, 0.85) 100%);
  border: 1px solid rgba(192, 132, 252, 0.45);
  padding: 0.28rem 0.55rem;
  margin-bottom: 0.6rem;
}

.codex-user-dd-leds {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.codex-user-dd-leds i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border: 1px solid #000;
}

.codex-user-dd-leds i:nth-child(1) { background: #fbbf24; box-shadow: 0 0 5px #fbbf24; }
.codex-user-dd-leds i:nth-child(2) { background: #c084fc; box-shadow: 0 0 5px #c084fc; }
.codex-user-dd-leds i:nth-child(3) { background: #34d399; box-shadow: 0 0 5px #34d399; }

.codex-user-dd-console-title {
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  color: #fde047;
  letter-spacing: 0.08em;
}

.codex-user-dd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.6rem;
  background: rgba(24, 15, 46, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.32);
  box-shadow: inset 0 0 12px rgba(168, 85, 247, 0.15);
}

.codex-user-dd-avatar {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 2px solid #fbbf24;
  box-shadow: 2px 2px 0 #000;
}

.codex-user-dd-avatar-fallback {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1e1b4b;
  border: 2px solid #c084fc;
  color: #fde047;
}

.codex-user-dd-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 6px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 6px repeat;
  background-clip: padding-box;
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  padding: 0.18rem 0.45rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.codex-user-dd-action-btn.primary {
  color: #fde047;
}

.codex-user-dd-action-btn.danger {
  color: #fda4af;
}

.codex-user-dd-action-btn:hover {
  filter: brightness(1.25);
  transform: translateY(-1px);
}

.codex-user-dropdown-tabs {
  display: flex;
  gap: 0.32rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0.6rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px dashed rgba(192, 132, 252, 0.3);
}

.codex-user-tab-btn {
  border: 6px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 6px repeat;
  background-clip: padding-box;
  background-color: #170f2e;
  color: #e9d5ff;
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  padding: 0.22rem 0.42rem;
  cursor: pointer;
  transition: all 0.12s ease;
}

.codex-user-tab-btn:hover {
  filter: brightness(1.2);
  color: #ffffff;
}

.codex-user-tab-btn.curator-tab {
  color: #fde047;
}

.codex-user-tab-btn.active {
  border-image: url("../assets/textures/button-primary-9slice.png") 28 fill / 6px repeat;
  color: #000000 !important;
  font-weight: 700;
}

.codex-user-dropdown-section {
  border: 10px solid transparent;
  border-image: url("../assets/textures/panel-inner-9slice.png") 32 fill / 10px repeat;
  background-clip: padding-box;
  background-color: #090614;
  padding: 0.35rem 0.45rem;
  max-height: 330px;
  overflow-y: auto;
}

.codex-user-dd-item {
  padding: 0.5rem 0.55rem;
  border-bottom: 1px dashed rgba(192, 132, 252, 0.24);
  font-size: 0.78rem;
  color: #f3e8ff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.codex-user-dd-item:last-child {
  border-bottom: none;
}

.codex-user-dd-bullet {
  width: 6px;
  height: 6px;
  background: #fbbf24;
  box-shadow: 0 0 6px #fbbf24;
  flex-shrink: 0;
}

.codex-user-dd-link {
  color: #f3e8ff;
  text-decoration: none;
  line-height: 1.4;
}

.codex-user-dd-link:hover {
  color: #fde047;
  text-decoration: underline;
}

.codex-user-dd-empty {
  padding: 1.1rem 0.6rem;
  text-align: center;
  color: #a78bfa;
  font-size: 0.78rem;
  font-style: italic;
}

.codex-user-dd-lang-card {
  background: rgba(30, 17, 58, 0.85);
  border: 1px solid rgba(192, 132, 252, 0.35);
  padding: 0.45rem 0.5rem;
}

.codex-user-dd-select {
  width: 100%;
  background: #090614;
  color: #fde047;
  border: 1px solid #a855f7;
  padding: 0.35rem;
  font-size: 0.76rem;
  font-family: var(--font-body);
  outline: none;
}

.codex-user-dd-curator-card {
  background: linear-gradient(135deg, rgba(46, 16, 101, 0.6) 0%, rgba(24, 15, 46, 0.9) 100%);
  border: 1px solid rgba(250, 204, 21, 0.45);
  padding: 0.65rem;
  margin-bottom: 0.55rem;
}

.codex-user-dd-log-card {
  padding: 0.55rem 0.6rem;
  margin-bottom: 0.45rem;
  background: rgba(26, 16, 51, 0.72);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-left: 3px solid #a855f7;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.codex-user-dd-log-card:hover {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(40, 22, 75, 0.85);
}

.codex-user-dd-log-card.is-pinned {
  background: linear-gradient(90deg, rgba(113, 63, 18, 0.32) 0%, rgba(36, 16, 68, 0.85) 100%);
  border-color: rgba(250, 204, 21, 0.55);
  border-left: 3px solid #facc15;
}

.codex-user-dd-log-title {
  font-family: var(--font-retro-title);
  font-size: 1.08rem;
  color: #fde047;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.codex-user-dd-log-title:hover {
  color: #ffffff;
  text-decoration: underline;
}

.codex-user-dd-pin-tag {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: #facc15;
  background: rgba(250, 204, 21, 0.14);
  border: 1px solid rgba(250, 204, 21, 0.45);
  padding: 2px 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.codex-log-mini-icon-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 10, 28, 0.88);
  border: 1px solid rgba(192, 132, 252, 0.38);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  opacity: 0.72;
}

.codex-log-mini-icon-btn:hover {
  opacity: 1;
  transform: translateY(-1px) scale(1.06);
  border-color: #fde047;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.45);
}

.codex-log-mini-icon-btn.active-pin {
  opacity: 1;
  background: rgba(161, 98, 7, 0.35);
  border-color: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.55);
}

.codex-log-mini-icon-btn.active-showcase {
  opacity: 1;
  background: rgba(16, 185, 129, 0.28);
  border-color: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.55);
}

/* ==========================================================================
   PUBLIC PROFILE PAGE (#profile/<user>) — EXPERIMENTAL COLLECTOR DOSSIER
   ========================================================================== */
.codex-profile-experimental-stage {
  position: relative;
}

.codex-profile-dossier-stamp {
  font-family: var(--font-pixel);
  font-size: 0.52rem;
  color: #fde047;
  background: linear-gradient(90deg, rgba(107, 33, 168, 0.65), rgba(120, 53, 15, 0.65));
  border: 1px solid rgba(251, 191, 36, 0.55);
  padding: 0.38rem 0.75rem;
  letter-spacing: 0.08em;
  box-shadow: 3px 3px 0 #000;
}

.codex-profile-header-card {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  border: 20px solid transparent;
  border-image: url("../assets/textures/window-modal-9slice.png") 40 fill / 20px repeat;
  background-clip: padding-box;
  background: radial-gradient(circle at 88% 18%, rgba(217, 70, 239, 0.22), transparent 55%),
              linear-gradient(135deg, #240f3d 0%, #150926 52%, #291308 100%);
  box-shadow: 0 10px 0 #000, 0 0 32px rgba(192, 132, 252, 0.28);
  padding: 0.85rem 1.05rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.codex-profile-avatar-frame {
  padding: 5px;
  background: linear-gradient(135deg, #fbbf24 0%, #c084fc 50%, #2dd4bf 100%);
  box-shadow: 4px 4px 0 #000, 0 0 16px rgba(251, 191, 36, 0.35);
  display: inline-flex;
}

.codex-profile-avatar-96 {
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  object-fit: cover;
  border: 3px solid #090514;
  background: #090514;
  image-rendering: auto;
  display: block;
}

.codex-profile-hero-name {
  margin: 0;
  font-family: var(--font-retro-title);
  font-size: 2.15rem;
  color: #f3e8ff;
  text-shadow: 2px 2px 0 #000;
  letter-spacing: 0.03em;
}

.codex-profile-hero-name.is-curator {
  color: #fde047;
  text-shadow: 2px 2px 0 #000, 0 0 14px rgba(250, 204, 21, 0.45);
}

.codex-profile-tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-pixel);
  font-size: 0.52rem;
  padding: 0.28rem 0.65rem;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 #000;
}

.codex-profile-tier-pill.curator {
  background: linear-gradient(90deg, rgba(161, 98, 7, 0.55), rgba(88, 28, 135, 0.65));
  color: #fde047;
  border: 1px solid #facc15;
}

.codex-profile-tier-pill.supporter {
  background: rgba(109, 40, 217, 0.45);
  color: #e9d5ff;
  border: 1px solid #c084fc;
}

.codex-profile-tier-pill.member {
  background: rgba(30, 27, 75, 0.75);
  color: #cbd5e1;
  border: 1px solid #6366f1;
}

.codex-profile-headline-text {
  font-size: 0.98rem;
  color: #f0abfc;
  font-weight: 600;
  margin-bottom: 0.65rem;
  letter-spacing: 0.01em;
}

.codex-profile-social-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(14, 116, 144, 0.32);
  border: 1px solid #38bdf8;
  color: #bae6fd;
  font-family: var(--font-pixel);
  font-size: 0.48rem;
  padding: 0.22rem 0.55rem;
  text-decoration: none;
  box-shadow: 2px 2px 0 #000;
  transition: all 0.15s ease;
}

.codex-profile-social-chip:hover {
  background: rgba(56, 189, 248, 0.28);
  color: #ffffff;
  border-color: #fde047;
  transform: translateY(-1px);
}

.codex-profile-cartridge-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.codex-profile-stat-cartridge {
  background: rgba(11, 6, 24, 0.82);
  border: 1px solid rgba(192, 132, 252, 0.38);
  border-top: 3px solid #c084fc;
  padding: 0.4rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-shadow: 2px 2px 0 #000;
}

.codex-profile-stat-cartridge .cart-label {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: #a78bfa;
  letter-spacing: 0.05em;
}

.codex-profile-stat-cartridge .cart-val {
  font-family: var(--font-retro-title);
  font-size: 1.2rem;
  line-height: 1.1;
}

.codex-profile-stat-cartridge .cart-val.gold { color: #fde047; }
.codex-profile-stat-cartridge .cart-val.violet { color: #e9d5ff; }
.codex-profile-stat-cartridge .cart-val.mint { color: #2dd4bf; }
.codex-profile-stat-cartridge .cart-val.amber { color: #fb923c; }

.codex-profile-bio-box {
  border: 16px solid transparent;
  border-image: url("../assets/textures/panel-9slice.png") 36 fill / 16px repeat;
  background-clip: padding-box;
  background: linear-gradient(160deg, rgba(31, 14, 56, 0.92) 0%, rgba(16, 8, 32, 0.96) 100%);
  box-shadow: 0 8px 0 #000;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.55rem;
}

.codex-profile-bio-box.curator-seats-box {
  background: linear-gradient(160deg, rgba(59, 23, 12, 0.88) 0%, rgba(31, 14, 56, 0.94) 100%);
}

.codex-profile-box-header {
  font-family: var(--font-retro-title);
  font-size: 1.3rem;
  color: #e9d5ff;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.codex-profile-box-header.gold {
  color: #fde047;
  margin-bottom: 0.65rem;
}

.codex-profile-curated-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 8px solid transparent;
  border-image: url("../assets/textures/button-default-9slice.png") 28 fill / 8px repeat;
  background-clip: padding-box;
  background-color: #271206;
  padding: 0.25rem 0.65rem;
  font-family: var(--font-retro-title);
  font-size: 1.1rem;
  color: #fde047;
  text-decoration: none;
  transition: transform 0.12s ease, filter 0.15s ease;
}

.codex-profile-curated-chip:hover {
  transform: translateY(-2px);
  filter: brightness(1.2) drop-shadow(0 0 8px rgba(250, 204, 21, 0.5));
}

.codex-profile-section-heading {
  font-family: var(--font-retro-title);
  font-size: 1.65rem;
  color: #fde047;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem 0;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid rgba(192, 132, 252, 0.45);
  text-shadow: 2px 2px 0 #000;
}

.codex-profile-showcase-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.codex-profile-showcase-card {
  display: grid;
  grid-template-columns: 1fr 195px;
  gap: 1.25rem;
  border: 14px solid transparent;
  border-image: url("../assets/textures/card-9slice.png") 32 fill / 14px repeat;
  background-clip: padding-box;
  background: linear-gradient(135deg, rgba(36, 14, 64, 0.94) 0%, rgba(17, 9, 34, 0.97) 100%);
  box-shadow: 0 8px 0 #000, 0 0 22px rgba(168, 85, 247, 0.22);
  padding: 0.65rem 0.75rem;
  align-items: stretch;
}

.codex-profile-showcase-left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.codex-profile-showcase-art-link {
  font-family: var(--font-retro-title);
  font-size: 1.4rem;
  color: #fde047;
  text-decoration: none;
  font-weight: 700;
  text-shadow: 1px 1px 0 #000;
}

.codex-profile-showcase-art-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.codex-profile-showcase-tag {
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  color: #e9d5ff;
  background: rgba(147, 51, 234, 0.35);
  border: 1px solid rgba(192, 132, 252, 0.55);
  padding: 2px 6px;
}

.codex-profile-showcase-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080411;
  border: 2px solid #c084fc;
  box-shadow: 3px 3px 0 #000;
  padding: 0.45rem;
  min-height: 120px;
}

.codex-profile-showcase-media img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 165px;
  object-fit: contain;
  display: block;
  border: 1px solid rgba(251, 191, 36, 0.45);
}

.codex-profile-empty-showcase {
  padding: 1.6rem;
  text-align: center;
  color: #d8b4fe;
  background: rgba(26, 12, 48, 0.72);
  border: 2px dashed rgba(192, 132, 252, 0.4);
  font-size: 0.9rem;
}

@media (max-width: 680px) {
  .codex-profile-showcase-card {
    grid-template-columns: 1fr;
  }
}

.codex-eula-box {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(234, 179, 8, 0.4);
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  color: #cbd5e1;
}

#codex-eula-scroll-box h4 {
  margin: 0.75rem 0 0.3rem 0;
  font-size: 0.78rem;
  color: #facc15;
  font-weight: 700;
  border-bottom: 1px solid rgba(250, 204, 21, 0.22);
  padding-bottom: 0.18rem;
}

#codex-eula-scroll-box h4:first-child {
  margin-top: 0;
}

#codex-eula-scroll-box p {
  margin: 0 0 0.5rem 0;
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.55;
}

/* ==========================================================================
   MULTI-FILTER ACTIVE CHIPS & MULTI-STAGE DETAILED FILTER DRAWER
   ========================================================================== */
.codex-active-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(30, 58, 138, 0.45);
  border: 1px solid #60a5fa;
  color: #f8fafc;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.codex-active-filter-chip:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: #f87171;
}

.codex-btn-detailed-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.65), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--c64-amber, #f59e0b);
  color: #fde047;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  padding: 0.32rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.codex-btn-detailed-filter:hover,
.codex-btn-detailed-filter.open {
  background: rgba(234, 179, 8, 0.22);
  color: #ffffff;
  border-color: #facc15;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.3);
}

.codex-detailed-filter-drawer {
  margin-top: 0.55rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(112, 164, 178, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.codex-df-stage {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 5px;
  overflow: hidden;
}

.codex-df-stage-header {
  width: 100%;
  background: rgba(30, 41, 59, 0.75);
  border: none;
  color: #dbeafe;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.codex-df-stage-header:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #ffffff;
}

.codex-df-stage-body {
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-top: 1px solid rgba(96, 165, 250, 0.18);
}

/* ==========================================================================
   COMMENT CHRONOLOGICAL SORT BAR
   ========================================================================== */
.codex-comment-sort-bar {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.codex-comment-sort-label {
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  color: #94a3b8;
  text-transform: uppercase;
  margin-right: 0.15rem;
}

.codex-comment-sort-pill {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(100, 116, 139, 0.45);
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.22rem 0.58rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.codex-comment-sort-pill:hover {
  border-color: #93c5fd;
  color: #ffffff;
}

.codex-comment-sort-pill.active {
  background: rgba(234, 179, 8, 0.18);
  border-color: #facc15;
  color: #fde047;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.22);
}
