/* =============================================================
   retro.css – CPC Retro Pixel Art reskin of the WhatsApp layout
   nakano-theme v1.0.0
   Same HTML selectors as whatsapp.css – colors and style only.
   ============================================================= */

/* ── 0. HORIZONTAL OVERFLOW FIX ─────────────────────────────── */
html {
  overflow-x: clip;
}
body {
  overflow-x: clip !important;
  max-width: 100%;
}

/* ── 1. HERO OVERRIDE ──────────────────────────────────────── */
.hero {
  overflow: hidden !important;
  margin-bottom: 0 !important;
}
/* Hide decorative shapes that clash with video background */
.is-front .hero-collage {
  display: none !important;
}
/* Hide wave-divider injected by footer-script JS */
.wave-divider {
  display: none !important;
}

/* ── 1b. SEAMLESS HERO → WA-APP TRANSITION ────────────────── */
.is-front .wa-app {
  margin-top: 10px;
  position: sticky;
  top: 0;
  z-index: 4;
  align-items: stretch; /* front page: sidebar does not need to be sticky */
}

/* On front page, sidebar is inside a sticky .wa-app so must NOT be sticky itself */
.is-front .wa-sidebar {
  position: relative;
  height: auto;
  max-height: 100%;
}
.wa-main .filters {
  background: #0f0f2a;
  padding: 12px 16px;
  margin: 0;
  border-bottom: 2px solid rgba(106, 191, 198, 0.25);
}
.wa-main .filters .chip-row {
  justify-content: flex-start;
  padding: 0;
  gap: 8px;
  flex-wrap: wrap;
}
[data-theme="dark"] .wa-main .filters {
  background: #050510;
}

/* ── 2. CRT TV HERO OVERLAY ────────────────────────────────── */
.hero-crt-tv {
  position: absolute;
  right: 2%;
  bottom: 10%;
  z-index: 5;
  transform: rotate(-2deg) scale(0.7);
  filter: drop-shadow(0 20px 50px rgba(0,0,0,0.6));
  pointer-events: auto;
  transform-origin: bottom right;
}


.crt-tv-wrap {
  position: relative;
  z-index: 10;
  animation: crtTvFloat 6s ease-in-out infinite;
}

@keyframes crtTvFloat {
  0%, 100% { transform: translateY(0px);   }
  50%       { transform: translateY(-8px);  }
}

.crt-tv-cabinet {
  background: linear-gradient(160deg, #3a2e22 0%, #2a2018 40%, #1e1710 100%);
  border-radius: 22px 22px 18px 18px;
  padding: 18px 22px 24px;
  position: relative;
  border: 2px solid #4a3828;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.08),
    inset 0 -4px 8px rgba(0,0,0,0.6),
    0 6px 0 #1a1208,
    0 10px 0 #140e06;
}

/* wood-grain texture */
.crt-tv-cabinet::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(
    92deg,
    transparent 0px,
    transparent 18px,
    rgba(0,0,0,0.06) 18px,
    rgba(0,0,0,0.06) 19px
  );
  pointer-events: none;
}

.crt-tv-bezel {
  background: linear-gradient(145deg, #1a1410 0%, #0e0c08 100%);
  border-radius: 10px;
  padding: 14px;
  box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.04),
    inset 4px 4px 12px rgba(0,0,0,0.8),
    inset -2px -2px 8px rgba(255,255,255,0.03);
  position: relative;
}

.crt-tv-screen {
  width: 320px;
  height: 240px;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: filter 0.15s ease;
}
.crt-tv-screen:hover {
  filter: brightness(1.12);
}

/* screen edge vignette */
.crt-tv-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 6px;
  box-shadow:
    inset  6px  0   16px rgba(0,0,0,0.35),
    inset -6px  0   16px rgba(0,0,0,0.35),
    inset  0    6px 16px rgba(0,0,0,0.25),
    inset  0   -6px 16px rgba(0,0,0,0.25);
  pointer-events: none;
  z-index: 20;
}

.crt-tv-screen canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.crt-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 15;
  border-radius: 6px;
  mix-blend-mode: multiply;
}

.crt-phosphor-glow {
  position: absolute;
  inset: -2px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 5;
  transition: box-shadow 1.2s ease;
}

.crt-screen-glass {
  position: absolute;
  top: 5px;
  left: 6px;
  width: 45%;
  height: 30%;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.06) 0%,
    rgba(255,255,255,0.02) 50%,
    transparent 100%
  );
  border-radius: 5px 5px 0 0;
  pointer-events: none;
  z-index: 25;
}

/* controls bar */
.crt-tv-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 0 2px;
}

.crt-tv-brand {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: rgba(200,191,173,0.35);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.crt-knobs {
  display: flex;
  gap: 12px;
  align-items: center;
}

.crt-knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5a4535, #2a1e14);
  border: 2px solid #3a2a1c;
  box-shadow:
    0 3px 6px rgba(0,0,0,0.6),
    inset 0 1px 2px rgba(255,255,255,0.1);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
}

.crt-knob::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 7px;
  background: rgba(200,191,173,0.5);
  border-radius: 2px;
}

.crt-knob:hover  { transform: rotate(30deg); }
.crt-knob:active { transform: rotate(60deg); }

.crt-knob.crt-ch-knob {
  width: 28px;
  height: 28px;
}

.crt-knob.crt-ch-knob::after {
  height: 9px;
  top: 4px;
}

.crt-indicator-row {
  display: flex;
  gap: 5px;
  align-items: center;
}

.crt-led {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c4893a;
  box-shadow: 0 0 5px #c4893a, 0 0 10px rgba(196,137,58,0.5);
  animation: crtLedPulse 2s ease-in-out infinite;
}

@keyframes crtLedPulse {
  0%, 100% { opacity: 1;   }
  50%       { opacity: 0.4; }
}

/* channel strip */
.crt-channel-strip {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 370px;
}

.crt-ch-btn {
  width: 36px;
  height: 24px;
  border: 1px solid rgba(106, 191, 198, 0.25);
  background: rgba(255,255,255,0.03);
  border-radius: 0;
  color: rgba(200,191,173,0.5);
  font-family: 'VT323', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.crt-ch-btn:hover {
  border-color: rgba(106, 191, 198, 0.6);
  color: rgba(232,226,217,0.9);
  transform: translateY(-1px);
}

.crt-ch-btn.is-active {
  border-color: var(--crt-ch-color, #6abfc6);
  color: #e8e2d9;
  box-shadow: 0 0 8px var(--crt-ch-color, #6abfc6), inset 0 0 6px rgba(255,255,255,0.05);
}

/* channel switch animation */
.crt-tv-screen.crt-switching canvas {
  animation: crtSwitch 0.45s ease forwards;
}

@keyframes crtSwitch {
  0%   { transform: scaleY(1);    filter: brightness(1.2);         }
  20%  { transform: scaleY(0.02); filter: brightness(3) blur(1px); }
  55%  { transform: scaleY(0.02); filter: brightness(0.1);         }
  75%  { transform: scaleY(1.04); filter: brightness(1.4);         }
  90%  { transform: scaleY(0.97); filter: brightness(0.9);         }
  100% { transform: scaleY(1);    filter: brightness(1);           }
}

/* ── 3. WA-APP LAYOUT (CPC Retro) ──────────────────────────── */
.wa-app {
  --wa-brand:        #887ecb;
  --wa-soft:         #6abfc6;
  --wa-bg:           #1a1a3e;
  --wa-panel:        #0f0f2a;
  --wa-line:         rgba(106, 191, 198, 0.2);
  --wa-txt:          #e8e2d9;
  --wa-muted:        #8e849a;
  --wa-item-hover:   rgba(106, 191, 198, 0.08);
  --wa-scroll-thumb: rgba(106, 191, 198, 0.3);
  --wa-sidebar-w:    280px;
  --wa-topbar-h:     68px;
  --wa-sidebar-1:    #352879;
  --wa-sidebar-2:    #1a1a3e;
  --wa-avatar-bg:    linear-gradient(135deg, #887ecb, #6abfc6);

  display: flex;
  width: 100%;
  min-height: calc(100vh - 120px);
  border-radius: 0;
  overflow: visible;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.5);
  border: 2px solid #6abfc6;
  margin: 0 auto;
  max-width: calc(100% - 40px);
  background: #0f0f2a;
  align-items: flex-start; /* required for sticky sidebar to work in flex context */
}

/* ── 3b. FORCE TEXT COLORS in MAIN area only (not sidebar!) ── */
.wa-main a,
.wa-main .wa-item,
.wa-main .wa-link-item,
.wa-main .wa-topbar a,
.wa-main .wa-search input {
  color: #e8e2d9 !important;
  font-family: inherit !important;
  -webkit-text-stroke: 0 !important;
  -webkit-text-fill-color: initial !important;
  text-shadow: none !important;
}
.wa-main .wa-col-head h3        { color: #e8e2d9 !important; }
.wa-main .wa-item-name          { color: #e8e2d9 !important; }
.wa-main .wa-item-sub           { color: #8e849a !important; }
.wa-main .wa-item-time          { color: #8e849a !important; }
.wa-main .wa-badge              { color: #fff !important; -webkit-text-fill-color: #fff !important; }
.wa-main .wa-empty              { color: #8e849a !important; }
.wa-main .wa-user-name          { color: #e8e2d9 !important; }
.wa-main .wa-avatar span        { color: #0f0f2a !important; -webkit-text-fill-color: #0f0f2a !important; }
.wa-main .chip                  { font-family: inherit !important; -webkit-text-stroke: 0 !important; -webkit-text-fill-color: initial !important; text-shadow: none !important; }

/* ── 3c. CODE BLOCK: retro color scheme ── */
.wa-main pre,
.wa-main pre code,
.wa-main .wp-block-code,
.wa-main .wp-block-code code {
  color: #6abfc6 !important;
  -webkit-text-fill-color: #6abfc6 !important;
  background: #050510 !important;
  border: 2px solid #352879 !important;
  border-radius: 0 !important;
}
.wa-main pre a,
.wa-main .wp-block-code a {
  color: #887ecb !important;
  -webkit-text-fill-color: #887ecb !important;
}
.wa-main pre,
.wa-main .wp-block-code {
  overflow-x: auto;
  max-width: 100%;
}
.wa-main p > code,
.wa-main li > code,
.wa-main td > code,
.wa-main h1 > code,
.wa-main h2 > code,
.wa-main h3 > code,
.wa-main h4 > code {
  color: var(--wa-soft, #6abfc6) !important;
  -webkit-text-fill-color: var(--wa-soft, #6abfc6) !important;
  background: rgba(106, 191, 198, 0.1) !important;
  border-radius: 0 !important;
}

/* dark mode text overrides (main area only) */
[data-theme="dark"] .wa-main a,
[data-theme="dark"] .wa-main .wa-item,
[data-theme="dark"] .wa-main .wa-link-item,
[data-theme="dark"] .wa-main .wa-search input {
  color: #e8e2d9 !important;
  -webkit-text-fill-color: initial !important;
}
[data-theme="dark"] .wa-main .wa-col-head h3 { color: #e8e2d9 !important; }
[data-theme="dark"] .wa-main .wa-item-name   { color: #e8e2d9 !important; }
[data-theme="dark"] .wa-main .wa-item-sub    { color: #8e849a !important; }
[data-theme="dark"] .wa-main .wa-item-time   { color: #8e849a !important; }
[data-theme="dark"] .wa-main .wa-user-name   { color: #e8e2d9 !important; }

/* ── 4. SIDEBAR ─────────────────────────────────────────────── */
.wa-sidebar {
  width: var(--wa-sidebar-w);
  min-width: var(--wa-sidebar-w);
  background: var(--wa-sidebar-1); /* uses CSS variable for JS theme-color customizer compatibility */
  border-right: 2px solid #6abfc6;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  color: #e8e2d9;
  overflow-x: hidden;
  overflow-y: auto;
}

/* SPA article mode: sidebar becomes FIXED to viewport (never scrolls away) */
.wa-sidebar[data-spa-mode="article"] {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
}

/* pixel scanline overlay for retro feel */
.wa-sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.06) 3px,
    rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
}

.wa-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Press Start 2P', monospace;
  font-weight: 700;
  font-size: 10px;
  margin-bottom: 20px;
  position: relative;
  color: #6abfc6;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.wa-brand-icon {
  opacity: 0.85;
  flex-shrink: 0;
}

.wa-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 0;
  background: rgba(0,0,0,0.25);
  border: 2px solid rgba(106, 191, 198, 0.3);
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.4);
  margin-bottom: 20px;
  position: relative;
}

.wa-profile-info {
  flex: 1;
  min-width: 0;
}

.wa-profile-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-profile-status {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.wa-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  position: relative;
}

.wa-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 0;
  color: rgba(232,226,217,0.8);
  text-decoration: none;
  font-size: 13px;
  font-family: 'VT323', monospace;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  border-left: 2px solid transparent;
}

.wa-nav a svg {
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.wa-nav a:hover,
.wa-nav a.is-active {
  background: rgba(106, 191, 198, 0.12);
  border-left-color: #6abfc6;
  color: #6abfc6;
  transform: translateX(2px);
}

.wa-nav a:hover svg,
.wa-nav a.is-active svg {
  opacity: 1;
}

/* category dropdown in sidebar */
.wa-nav-group {
  position: relative;
}
.wa-nav-sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 4px 32px;
}
.wa-nav-group.is-open .wa-nav-sub {
  display: flex;
}
.wa-nav-toggle::after {
  content: '';
  margin-left: auto;
  border: 4px solid transparent;
  border-top-color: rgba(106, 191, 198, 0.5);
  transition: transform 0.15s ease;
}
.wa-nav-group.is-open .wa-nav-toggle::after {
  transform: rotate(180deg);
}
.wa-nav-sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-radius: 0;
  color: rgba(232,226,217,0.7);
  text-decoration: none;
  font-size: 13px;
  font-family: 'VT323', monospace;
  transition: background 0.15s ease, color 0.15s ease;
  border-left: 2px solid transparent;
}
.wa-nav-sub-item:hover {
  background: rgba(106, 191, 198, 0.1);
  border-left-color: #6abfc6;
  color: #6abfc6;
}
.wa-nav-count {
  font-size: 11px;
  opacity: 0.5;
  min-width: 18px;
  text-align: right;
}

.wa-sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 2px dashed rgba(106, 191, 198, 0.2);
  position: relative;
}

.wa-theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 0;
  border: 2px solid rgba(106, 191, 198, 0.4);
  background: rgba(0,0,0,0.3);
  color: #e8e2d9;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  position: relative;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}

.wa-theme-toggle:hover {
  transform: translateY(-2px);
  background: rgba(106, 191, 198, 0.15);
  border-color: #6abfc6;
}

.wa-icon-sun,
.wa-icon-moon {
  position: absolute;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.wa-icon-sun  { opacity: 1; transform: scale(1); }
.wa-icon-moon { opacity: 0; transform: scale(0.6); }

[data-theme="dark"] .wa-icon-sun  { opacity: 0; transform: scale(0.6); }
[data-theme="dark"] .wa-icon-moon { opacity: 1; transform: scale(1); }

/* ── 4b. SETTINGS PANEL ─────────────────────────────────────── */
.wa-settings-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease, padding 0.35s ease;
  opacity: 0;
  padding: 0 0;
}
.wa-settings-panel.is-open {
  max-height: 300px;
  opacity: 1;
  padding: 14px 0 8px;
}

.wa-settings-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(106, 191, 198, 0.7);
  margin-bottom: 12px;
  border-bottom: 2px dashed rgba(106, 191, 198, 0.3);
  padding-bottom: 6px;
}

.wa-color-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.wa-color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 0;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  outline: none;
  font-size: 0;
  line-height: 30px;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}
.wa-color-swatch:hover {
  transform: scale(1.15) translate(-1px, -1px);
  box-shadow: 4px 4px 0px rgba(0,0,0,0.6);
}
.wa-color-swatch.is-active {
  border-color: #6abfc6;
  box-shadow: 0 0 0 1px #000, 2px 2px 0px rgba(0,0,0,0.5);
}
.wa-color-swatch.is-custom {
  background: conic-gradient(#ff6b6b, #ffd93d, #6bff6b, #6bd9ff, #b388ff, #ff6b6b) !important;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  display: grid;
  place-items: center;
}

.wa-custom-picker {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.wa-custom-picker input[type="color"] {
  width: 36px;
  height: 28px;
  border: 2px solid rgba(106, 191, 198, 0.4);
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.wa-custom-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.wa-custom-picker input[type="color"]::-webkit-color-swatch { border-radius: 0; border: none; }
.wa-custom-picker label {
  font-size: 12px;
  color: rgba(232,226,217,0.7);
}

.wa-settings-reset {
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: rgba(106, 191, 198, 0.6);
  background: none;
  border: 2px solid rgba(106, 191, 198, 0.25);
  border-radius: 0;
  padding: 4px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.4);
}
.wa-settings-reset:hover {
  color: #6abfc6;
  border-color: #6abfc6;
}

/* Category "all" link */
.wa-nav-sub-all {
  font-weight: 600;
  border-bottom: 2px dashed rgba(106, 191, 198, 0.2);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

/* ── 5. MAIN CONTENT AREA ───────────────────────────────────── */
.wa-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f0f2a !important;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible;
  color: #e8e2d9 !important;
}

.wa-topbar {
  height: var(--wa-topbar-h);
  padding: 12px 20px;
  border-bottom: 2px solid #6abfc6;
  background: #0f0f2a;
  display: flex;
  align-items: center;
  gap: 14px;
}

.wa-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.3);
  border-radius: 0;
  padding: 8px 14px;
  border: 2px solid rgba(106, 191, 198, 0.3);
}

.wa-search svg {
  flex-shrink: 0;
  color: var(--wa-muted);
}

.wa-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--wa-txt);
  font-size: 14px;
  font-family: 'VT323', monospace;
  outline: none;
}

.wa-search input::placeholder {
  color: var(--wa-muted);
}

.wa-top-actions {
  display: flex;
  gap: 8px;
}

.wa-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 0;
  border: 2px solid rgba(106, 191, 198, 0.3);
  background: rgba(0,0,0,0.3);
  color: var(--wa-txt);
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.4);
}

.wa-icon-btn:hover {
  transform: translate(-1px, -1px);
  background: rgba(106, 191, 198, 0.1);
  box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
  border-color: #6abfc6;
}

.wa-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 4px;
}

.wa-user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--wa-txt);
}

.wa-user-status {
  font-size: 12px;
  color: var(--wa-muted);
}

/* ── 6. COLUMNS ─────────────────────────────────────────────── */
.wa-columns {
  flex: 1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  min-height: 0;
  overflow: hidden;
}

.wa-col {
  border-right: 2px solid #6abfc6;
  padding: 16px 16px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #0f0f2a;
}

.wa-col:last-child {
  border-right: none;
}

.wa-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(106, 191, 198, 0.3);
}

.wa-col-head h3 {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #6abfc6;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.wa-col-icon {
  color: var(--wa-muted);
  flex-shrink: 0;
}

/* ── 7. CHAT-STYLE ARTICLE ITEMS ────────────────────────────── */
.wa-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 0;
  text-decoration: none;
  color: var(--wa-txt);
  transition: all 0.15s ease;
  align-items: flex-start;
  border-left: 2px solid transparent;
}

.wa-item:hover {
  background: rgba(106, 191, 198, 0.08);
  border-left-color: #6abfc6;
  transform: translate(2px, -2px);
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.4);
}

.wa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 0;
  background: var(--wa-avatar-bg);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #0f0f2a;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid #6abfc6;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.4);
}

.wa-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-avatar-lg {
  width: 50px;
  height: 50px;
  font-size: 16px;
}

.wa-avatar-sm {
  width: 36px;
  height: 36px;
  font-size: 13px;
}

.wa-avatar-link {
  background: linear-gradient(135deg, #352879, #887ecb);
}

.wa-item-meta {
  flex: 1;
  min-width: 0;
}

.wa-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wa-item-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--wa-txt);
}

.wa-item-time {
  font-size: 11px;
  color: var(--wa-muted);
  flex-shrink: 0;
  font-family: 'Share Tech Mono', monospace;
}

.wa-item-sub {
  font-size: 13px;
  color: var(--wa-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 0;
  background: #887ecb;
  border: 1px solid #6abfc6;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  align-self: center;
  font-family: 'Share Tech Mono', monospace;
}

.wa-empty {
  color: var(--wa-muted);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
  font-family: 'VT323', monospace;
}

/* ── 8. LINK ITEMS ──────────────────────────────────────────── */
.wa-link-item {
  align-items: center;
}

.wa-link-arrow {
  color: #6abfc6;
  flex-shrink: 0;
  align-self: center;
}

/* ── 9. CRT ASCII CAT DECORATION ────────────────────────────── */
.crt-ascii-cat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 50;
  font-family: 'VT323', monospace;
  color: #5fe4e4;
  text-shadow: -2px 0px 2px #db7497, 2px 0px 2px #41bcbc;
  font-size: 13px;
  line-height: 1.15;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.crt-ascii-cat:hover {
  opacity: 1;
  pointer-events: auto;
}

.crt-text {
  font-family: 'VT323', monospace;
  white-space: pre;
  margin: 0;
}

.crt-caption {
  display: block;
  text-align: center;
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ── 10. DARK MODE (deeper dark) ────────────────────────────── */
[data-theme="dark"] .wa-app {
  --wa-bg:         #0a0a1a;
  --wa-panel:      #050510;
  --wa-txt:        #e8e2d9;
  --wa-muted:      #8e849a;
  --wa-line:       rgba(106, 191, 198, 0.15);
  --wa-item-hover: rgba(106, 191, 198, 0.06);
  --wa-sidebar-1:  #1e1650;
  --wa-sidebar-2:  #0a0a1a;
}

[data-theme="dark"] .wa-main {
  background: #050510 !important;
  color: #e8e2d9 !important;
}

[data-theme="dark"] .wa-sidebar {
  background: #1e1650;
  border-right-color: rgba(106, 191, 198, 0.3);
}

[data-theme="dark"] .wa-search {
  background: rgba(0,0,0,0.5);
}

[data-theme="dark"] .wa-icon-btn {
  background: rgba(0,0,0,0.4);
}

[data-theme="dark"] .wa-topbar {
  background: #050510;
}

[data-theme="dark"] .wa-col {
  background: #050510;
}

/* ── 11. CUSTOM SCROLLBAR ───────────────────────────────────── */
.wa-col::-webkit-scrollbar,
.wa-sidebar::-webkit-scrollbar,
.wa-main::-webkit-scrollbar {
  width: 4px;
}

.wa-col::-webkit-scrollbar-track,
.wa-sidebar::-webkit-scrollbar-track,
.wa-main::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.3);
}

.wa-col::-webkit-scrollbar-thumb,
.wa-sidebar::-webkit-scrollbar-thumb,
.wa-main::-webkit-scrollbar-thumb {
  background: var(--wa-scroll-thumb);
  border-radius: 0;
}

/* ── 12. SINGLE PAGE LAYOUT ─────────────────────────────────── */
.wa-single-app {
  display: flex;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  gap: 0;
  overflow-x: hidden;
  align-items: flex-start; /* required for position:sticky to work in flex context */
}

.wa-single-sidebar {
  width: 240px;
  min-width: 240px;
  padding: 24px 16px;
  background: #352879;
  border-right: 2px solid #6abfc6;
  color: #e8e2d9;
  border-radius: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

/* Push main content right so it doesn't hide under fixed sidebar */
.wa-single-main {
  flex: 1;
  min-width: 0;
  margin-left: 240px;
  overflow-x: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
  background: #0f0f2a;
}

.wa-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(106, 191, 198, 0.8);
  text-decoration: none;
  font-size: 14px;
  font-family: 'VT323', monospace;
  padding: 8px 12px;
  border-radius: 0;
  border: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-bottom: 16px;
}

.wa-back-btn:hover {
  background: rgba(106, 191, 198, 0.1);
  border-color: rgba(106, 191, 198, 0.3);
  color: #6abfc6;
}

/* TOC wrap inside direct-load single sidebar */
.wa-single-sidebar .wa-toc-wrap {
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(106, 191, 198, 0.3) transparent;
}

.wa-single-sidebar .wa-toc-wrap::-webkit-scrollbar {
  width: 4px;
}
.wa-single-sidebar .wa-toc-wrap::-webkit-scrollbar-thumb {
  background: rgba(106, 191, 198, 0.3);
  border-radius: 2px;
}

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

.wa-toc-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(106, 191, 198, 0.7);
  margin-bottom: 12px;
  border-bottom: 2px dashed rgba(106, 191, 198, 0.3);
  padding-bottom: 6px;
}

.wa-toc li {
  margin-bottom: 4px;
}

.wa-toc a {
  display: block;
  padding: 6px 10px;
  color: rgba(232,226,217,0.65);
  text-decoration: none;
  font-size: 13px;
  font-family: 'VT323', monospace;
  border-radius: 0;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.wa-toc a:hover,
.wa-toc a.is-active {
  background: rgba(106, 191, 198, 0.1);
  color: #6abfc6;
  border-left-color: #6abfc6;
}

.wa-toc a.is-h3 {
  padding-left: 20px;
  font-size: 12px;
}

/* ── 13. RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero-crt-tv { display: none; }

  .wa-app {
    flex-direction: column;
    border-radius: 0;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: auto;
    align-items: stretch; /* reset: sticky needs flex-start only on desktop */
  }

  .wa-sidebar {
    width: 100%;
    min-width: 100%;
    padding: 14px 16px;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 2px solid #6abfc6;
    position: relative; /* reset sticky for mobile */
    height: auto;
    max-height: none;
  }

  .wa-sidebar::before { display: none; }

  .wa-brand { margin-bottom: 0; }

  .wa-profile { display: none; }

  .wa-nav {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex-wrap: wrap;
    flex: unset;
  }

  .wa-nav a {
    padding: 8px 12px;
    font-size: 13px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }

  .wa-nav a:hover,
  .wa-nav a.is-active {
    border-left-color: transparent;
    border-bottom-color: #6abfc6;
    transform: translateY(-2px);
  }

  .wa-sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; }

  .wa-theme-toggle { margin-left: auto; }

  .wa-main {
    overflow-y: auto;
    overflow-x: hidden;
    min-height: auto; /* reset: only needed for desktop sticky layout */
  }

  .wa-columns {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .wa-col {
    border-right: none;
    border-bottom: 2px solid rgba(106, 191, 198, 0.3);
    overflow-y: visible;
  }

  .wa-col:last-child { border-bottom: none; }

  .wa-single-app { flex-direction: column; }

  .wa-single-sidebar {
    width: 100%;
    min-width: 100%;
    border-radius: 0;
    border-right: none;
    border-bottom: 2px solid #6abfc6;
    position: static;
    height: auto;
    max-height: none;
    margin-bottom: 0;
  }

  .wa-single-main {
    margin-left: 0;
  }

  /* Reset fixed sidebar in article SPA mode on tablet/mobile */
  .wa-sidebar[data-spa-mode="article"] {
    position: static;
    height: auto;
  }
  .wa-sidebar[data-spa-mode="article"] ~ .wa-main {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .wa-sidebar { display: none; }
  .crt-ascii-cat { display: none; }

  /* SPA記事ビューのパディング縮小 */
  .wa-main .single-article {
    padding: 16px 12px 32px;
  }
}

/* ── 13b. MOBILE TEXT OVERFLOW FIX ─────────────────────────── */
@media (max-width: 768px) {
  /* ヒーロー画像の負マージンを除去 */
  .single-hero {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* 記事ページ全体のオーバーフロー防止 */
  .wa-single-app {
    max-width: 100%;
  }

  /* 記事のパディング縮小 */
  .single-article {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* コードブロックの幅制限 */
  .single-content pre {
    max-width: calc(100vw - 32px);
  }
}

/* ── 14. SPA ROUTER ────────────────────────────────────────── */

/* Loading spinner */
.wa-spa-spinner {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  pointer-events: none;
}

.wa-spa-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wa-spa-dots span {
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: #6abfc6;
  animation: waSpaBounceDot 1.2s ease-in-out infinite;
}

.wa-spa-dots span:nth-child(2) { animation-delay: 0.15s; }
.wa-spa-dots span:nth-child(3) { animation-delay: 0.30s; }

@keyframes waSpaBounceDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40%           { transform: scale(1); opacity: 1;   }
}

/* wa-main needs position relative for absolute spinner */
.wa-main {
  position: relative;
}

/* Back button inside wa-main (article view) */
.wa-main .wa-spa-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  margin: 16px 24px;
  border-radius: 0;
  border: 2px solid rgba(106, 191, 198, 0.3);
  background: rgba(106, 191, 198, 0.08);
  color: #6abfc6;
  font-size: 14px;
  font-family: 'VT323', monospace;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.4);
}

.wa-main .wa-spa-back:hover {
  background: rgba(106, 191, 198, 0.15);
  border-color: #6abfc6;
  box-shadow: 4px 4px 0px rgba(0,0,0,0.5);
}

/* Article content inside wa-main (SPA view) */
.wa-main .single-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.wa-main .single-header {
  margin-bottom: 24px;
}

.wa-main .single-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.3;
  color: #e8e2d9;
}

.wa-main .single-content {
  font-size: 16px;
  line-height: 1.8;
  color: #e8e2d9;
}

.wa-main .single-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  border: 2px solid rgba(106, 191, 198, 0.3);
}

/* Archive/Search inside wa-main */
.wa-main section.posts {
  padding: 16px 24px;
}

.wa-main .section-head {
  margin-bottom: 20px;
}

.wa-main .section-title {
  font-size: 1.4rem;
  color: #6abfc6;
}

.wa-main .post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Page content inside wa-main */
.wa-main .page-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* Sidebar: SPA back button (hidden by default) */
.wa-spa-sidebar-back {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 0;
  color: rgba(106, 191, 198, 0.8);
  background: rgba(0,0,0,0.25);
  border: 2px solid rgba(106, 191, 198, 0.3);
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 14px;
  margin-bottom: 16px;
  width: 100%;
  text-align: left;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.4);
}

.wa-spa-sidebar-back:hover {
  background: rgba(106, 191, 198, 0.12);
  border-color: #6abfc6;
  color: #6abfc6;
}

/* TOC wrap (hidden by default, shown in article mode) */
.wa-sidebar .wa-toc-wrap {
  display: none;
  position: relative;
  margin-bottom: 16px;
  /* Independent scrolling for long TOC lists */
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(106, 191, 198, 0.3) transparent;
}

.wa-sidebar .wa-toc-wrap::-webkit-scrollbar {
  width: 4px;
}
.wa-sidebar .wa-toc-wrap::-webkit-scrollbar-thumb {
  background: rgba(106, 191, 198, 0.3);
  border-radius: 2px;
}

/* Sidebar article mode: show back + TOC, hide profile + nav */
.wa-sidebar[data-spa-mode="article"] .wa-spa-sidebar-back {
  display: flex;
}

.wa-sidebar[data-spa-mode="article"] .wa-toc-wrap {
  display: block;
}

.wa-sidebar[data-spa-mode="article"] .wa-profile,
.wa-sidebar[data-spa-mode="article"] .wa-nav {
  display: none;
}

/* When sidebar is fixed in article mode, main needs left margin to avoid overlap */
.wa-sidebar[data-spa-mode="article"] ~ .wa-main {
  margin-left: var(--wa-sidebar-w);
}

/* ── 15. REDUCED MOTION ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .crt-tv-wrap                       { animation: none !important; }
  .crt-tv-screen.crt-switching canvas { animation: none !important; }
  .crt-led                           { animation: none !important; opacity: 1 !important; }
  .wa-item                           { transition: none !important; }
}
