﻿/* ===================================================
   CROSSWORD FORUM — Modern Design System
   =================================================== */

/* --- CSS Custom Properties — LIGHT (default) --- */
:root {
  --bg-primary: #f4f6fb;
  --bg-secondary: #eaecf4;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f3fa;
  --bg-glass: rgba(0,0,0,0.03);
  --bg-glass-hover: rgba(0,0,0,0.06);

  --accent-blue: #4f8ef7;
  --accent-blue-soft: rgba(79,142,247,0.12);
  --accent-green: #22c55e;
  --accent-green-soft: rgba(34,197,94,0.1);
  --accent-yellow: #f59e0b;
  --accent-yellow-soft: rgba(245,158,11,0.1);
  --accent-red: #ef4444;
  --accent-red-soft: rgba(239,68,68,0.08);
  --accent-purple: #8b5cf6;
  --accent-purple-soft: rgba(139,92,246,0.1);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #4f8ef7;

  --border-subtle: rgba(0,0,0,0.07);
  --border-normal: rgba(0,0,0,0.12);
  --border-accent: rgba(79,142,247,0.35);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-glow-blue: 0 0 20px rgba(79,142,247,0.15);
  --shadow-glow-green: 0 0 20px rgba(34,197,94,0.12);
  --shadow-glow-yellow: 0 0 20px rgba(245,158,11,0.12);

  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
  --radius-full: 0;

  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;

  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --nav-content-height: 64px;
  --nav-height: calc(var(--nav-content-height) + var(--safe-area-top));
  --sidebar-width: 325px;
}


/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420' viewBox='0 0 420 420'%3E%3Cg fill='%233b82f6' fill-opacity='.055' stroke='%233b82f6' stroke-opacity='.16'%3E%3Cg transform='translate(18 18) rotate(-17 33 33)'%3E%3Crect width='20' height='20' rx='4'/%3E%3Crect x='22' width='20' height='20' rx='4'/%3E%3Crect x='44' width='20' height='20' rx='4'/%3E%3Crect x='22' y='22' width='20' height='20' rx='4'/%3E%3Crect x='22' y='44' width='20' height='20' rx='4'/%3E%3C/g%3E%3Cg transform='translate(208 58) rotate(11 33 33) scale(1.08)'%3E%3Crect width='20' height='20' rx='4'/%3E%3Crect x='22' width='20' height='20' rx='4'/%3E%3Crect x='44' width='20' height='20' rx='4'/%3E%3Crect x='22' y='22' width='20' height='20' rx='4'/%3E%3Crect x='22' y='44' width='20' height='20' rx='4'/%3E%3C/g%3E%3Cg transform='translate(330 198) rotate(-6 33 33) scale(.78)'%3E%3Crect width='20' height='20' rx='4'/%3E%3Crect x='22' width='20' height='20' rx='4'/%3E%3Crect x='44' width='20' height='20' rx='4'/%3E%3Crect x='22' y='22' width='20' height='20' rx='4'/%3E%3Crect x='22' y='44' width='20' height='20' rx='4'/%3E%3C/g%3E%3Cg transform='translate(78 306) rotate(23 33 33) scale(.9)'%3E%3Crect width='20' height='20' rx='4'/%3E%3Crect x='22' width='20' height='20' rx='4'/%3E%3Crect x='44' width='20' height='20' rx='4'/%3E%3Crect x='22' y='22' width='20' height='20' rx='4'/%3E%3Crect x='22' y='44' width='20' height='20' rx='4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-position: center top;
  background-size: 420px 420px;
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition-slow), color var(--transition-slow);
}



a { color: var(--accent-blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: #7eaaff; }

img { max-width: 100%; }

ul, ol { list-style: none; }

/* ===================================================
   NAVIGATION
   =================================================== */

.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  padding-top: var(--safe-area-top);
  background: rgba(15, 17, 23, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: background var(--transition-slow);
}

.site-nav {
  background: rgba(244, 246, 251, 0.92);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.nav-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.nav-logo .logo-grid-icon {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  grid-template-rows: repeat(2, 9px);
  gap: 3px;
  place-content: center;
}

.nav-logo .logo-grid-icon span {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.nav-logo .logo-grid-icon span.is-filled {
  background: #fff;
}

.nav-search {
  flex: 1;
  max-width: 460px;
  position: relative;
}

.site-nav .nav-search {
  display: none;
}

.nav-search input {
  width: 100%;
  background: var(--bg-glass);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-full);
  padding: 9px 16px 9px 40px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.nav-search input::placeholder { color: var(--text-muted); }

.nav-search input:focus {
  border-color: var(--accent-blue);
  background: var(--bg-glass-hover);
  box-shadow: var(--shadow-glow-blue);
}

.nav-search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #000000;
  font-size: 15px;
  pointer-events: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 30px;
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-btn {
  background: var(--accent-blue);
  color: #fff !important;
  border-radius: var(--radius-full) !important;
  font-weight: 600 !important;
  transition: opacity var(--transition) !important;
}

.nav-btn:hover { opacity: 0.9; background: #092149; }

.nav-auth-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.nav-auth-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-normal);
  background: var(--accent-green-soft);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  box-sizing: border-box;
}

.nav-auth-pill strong {
  margin-left: 4px;
  color: var(--accent-green);
  font-weight: 700;
  line-height: 1;
}

.nav-auth-status .nav-auth-action,
.nav-auth-status .nav-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  min-height: 38px;
  padding: 0 12px !important;
  line-height: 1;
  box-sizing: border-box;
}

.nav-auth-status .nav-auth-action {
  gap: 8px;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}


/* ===================================================
   LAYOUT
   =================================================== */

.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 32px) 24px 64px;
  display: grid;
  /* sidebar stays right until very small; min content width = 320px */
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  gap: 28px;
  align-items: start;
}

.main-col { min-width: 0; }



/* ===================================================
   BREADCRUMB
   =================================================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  margin-bottom: 5px;
  border-radius: 11px;
  color: var(--text-secondary);
  font-size: .76rem;
  font-weight: 700;
  flex-wrap: wrap;
}

:root[data-site-theme="dark"] {
  --bg-primary: #0f1b2e;
  --bg-secondary: #152238;
  --bg-card: #17253d;
  --bg-card-hover: #1d2d48;
  --bg-glass: rgba(255,255,255,.035);
  --bg-glass-hover: rgba(255,255,255,.065);
  --text-primary: #f8fafc;
  --text-secondary: #b8c4d6;
  --text-muted: #8291a8;
  --border-subtle: rgba(255,255,255,.08);
  --border-normal: rgba(255,255,255,.14);
  --border-accent: rgba(79,142,247,.48);
  color-scheme: dark;
}
:root[data-site-theme="dark"] .site-nav,
:root[data-site-theme="dark"] .app-bottom-nav {
  background: rgba(15, 27, 46, .96);
}

.breadcrumb a { color: var(--accent-blue); font-weight: 800; }
.breadcrumb a:hover { color: var(--accent-blue); }
.breadcrumb .sep { color: var(--text-muted); opacity: .65; }
.home-page .breadcrumb {
  padding: 9px 6px 4px 4px;
}
.section-page .breadcrumb {
  padding: 9px 6px 4px 0;
}

/* ===================================================
   QUESTION CARD (MAIN HERO)
   =================================================== */

.question-card {
  display: flex;
  min-height: 172px;
  padding: 18px;
  margin-bottom: 16px;
  align-items: flex-start;
  flex-direction: column;
  border: 1px solid var(--border-normal);
  border-radius: 16px;
  background: var(--bg-card);
  position: relative;
  overflow: hidden;
}

.question-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* Type 1: no answer */
.question-card.status-none::before { display: none; }
/* Type 2: community */
.question-card.status-community::before { display: none; }
/* Type 3: verified */
.question-card.status-verified::before { display: none; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  margin-bottom: 5px;
  letter-spacing: 0;
  text-transform: none;
}

.status-badge.badge-none {
  background: transparent;
  color: #b70000;
  border: 1px solid rgba(239,68,68,0.2);
}

.status-badge.badge-community {
  background: transparent;
  color: #a77900;
  border: 1px solid rgba(245,158,11,0.25);
}

.status-badge.badge-verified {
  background: transparent;
  color: #327a39;
  border: 1px solid rgba(34,197,94,0.25);
}

.question-title {
  align-self: flex-start;
  margin: 0 0 12px;
  background: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.45;
  text-align: left;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: currentColor;
  background-clip: initial;
}

.question-card-topline {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.question-card-category {
  min-width: 0;
  color: #2563eb;
  font-size: .74rem;
  font-weight: 800;
  line-height: 1.45;
}

.question-card-views {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: .72rem;
  white-space: nowrap;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.question-meta span { display: flex; align-items: center; gap: 5px; }

.question-desc {
  color: var(--text-secondary);
  font-size: .84rem;
  line-height: 1.55;
  margin: 0 0 14px;
}

.question-card-author-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  color: var(--text-muted);
  font-size: .74rem;
  line-height: 1.4;
}

.question-card-author-row a,
.question-card-author-row strong {
  color: #2563eb;
  font-weight: 800;
  text-decoration: none;
}

/* ===================================================
   CTA BLOCK (type 1 — no answer)
   =================================================== */

.cta-community {
  margin: 0 0 20px;
  padding: 18px;
  border: 1px solid var(--border-normal);
  border-radius: 16px;
  background: #fff;
  text-align: left;
}

.cta-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.cta-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.cta-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
  max-width: 480px;
}


.cta-answer-pattern {
  margin-bottom: 14px;
}

.cta-answer-pattern-label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cta-answer-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.ap-box {
  width: 34px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ap-box.is-known {
  background: rgba(79,142,247,0.1);
  border-color: rgba(79,142,247,0.32);
  color: var(--accent-blue);
}

.ap-box.is-empty {
  color: transparent;
}

.ap-box.is-filled {
  background: #fff;
  border-color: rgba(79,142,247,0.32);
  color: var(--text-primary);
}

.ap-box.is-match {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.34);
  color: #166534;
}

.ap-box.is-error {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.34);
  color: #b91c1c;
}

.cta-answer-row .form-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.cta-answer-controls {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.cta-answer-controls .form-input {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.06em;
}

.cta-answer-controls .btn-submit-answer {
  min-height: 44px;
}

.cta-answer-feedback {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.cta-answer-feedback.is-visible {
  display: block;
}

.cta-answer-feedback.is-success {
  color: #166534;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.24);
}

.cta-answer-feedback.is-error {
  color: #b91c1c;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.24);
}

@media (max-width: 560px) {
  .cta-answer-controls {
    flex-direction: column;
  }

  .cta-answer-controls .btn-submit-answer {
    width: 100%;
  }
}

/* ===================================================
   ANSWER DISPLAY (type 2 & 3)
   =================================================== */

.section-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .icon { font-size: 20px; }

.answers-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }

.answer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  cursor: default;
}

.answer-card:hover {
  border-color: var(--border-normal);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}



.answer-card.top-community {
  border-color: rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.05);
}

.answer-letters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}

.letter-box {
  width: 36px;
  height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  transition: background var(--transition), border-color var(--transition);
}

.letter-box-num {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.55rem;
  line-height: 1;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.8;
}

.letter-box-char {
  display: inline-block;
  line-height: 1;
}

.answer-card.verified .letter-box {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.3);
  color: #137a39;
}

.answer-card.top-community .letter-box {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.3);
      color: #a77900;
}

.answer-info {
  flex: 1;
  min-width: 0;
}

.answer-word {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.answer-word.verified-word { color: var(--accent-green); }
.answer-word.community-word { color: #f56e0b; }

.answer-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.answer-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* Verified badge */
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #009536;
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
}

/* ===================================================
   VOTING SYSTEM
   =================================================== */

.vote-group {
  display: grid;
  align-items: center;
  gap: 6px;
}

.vote-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-normal);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.vote-btn:hover { background: var(--bg-glass-hover); }

.vote-btn.vote-yes:hover, .vote-btn.vote-yes.active {
  border-color: #22c55e;
  color: #4ade80;
  background: var(--accent-green-soft);
}

.vote-btn.vote-no:hover, .vote-btn.vote-no.active {
  border-color: #ef4444;
  color: #fc8181;
  background: var(--accent-red-soft);
}

.vote-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

/* Progress to verification */
.vote-progress {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--accent-yellow-soft);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.vote-progress-bar {
  height: 4px;
  background: rgba(245,158,11,0.15);
  border-radius: 99px;
  margin-top: 8px;
  overflow: hidden;
}

.vote-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-yellow), #f97316);
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ===================================================
   SUBMIT FORM
   =================================================== */

.submit-section {
  background: var(--bg-card);
  padding: 28px;
  margin-bottom: 28px;
}

.submit-section h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(79,142,247,0.12);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

.form-select { appearance: none; cursor: pointer; }

.form-textarea { resize: vertical; min-height: 80px; }

.form-select option { background: var(--bg-card); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  padding: 11px 24px;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #6366f1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79,142,247,0.3);
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,142,247,0.4);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-normal);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.btn-success { background: linear-gradient(135deg, var(--accent-green), #16a34a); color: #fff; }
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); color: #fff; }

/* ===================================================
   COMMENTS TREE
   =================================================== */

.comments-section {
  margin-bottom: 28px;
}

.comment {
  position: relative;
  padding: 18px;
  transition: border-color var(--transition);
  background: #ffffff;
}

.comment:hover { border-color: var(--border-normal); }

/* Nested comments */
.comment-children {
  margin-top: 12px;
  margin-left: 28px;
  padding-left: 20px;
  border-left: 2px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}


.comment-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.comment-author-info { flex: 1; }

.comment-author-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.comment-author-name .user-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-moderator { background: rgba(139,92,246,0.2); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }
.badge-expert { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.badge-active { background: rgba(79,142,247,0.15); color: #93c5fd; border: 1px solid rgba(79,142,247,0.25); }
.badge-newbie { background: rgba(100,116,139,0.15); color: #94a3b8; border: 1px solid rgba(100,116,139,0.2); }

.comment-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.comment-body { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }

.comment-solution {
  background: var(--accent-yellow-soft);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #fbbf24;
  font-size: 0.9rem;
  display: inline-block;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.comment-solution.solution-verified {
  background: var(--accent-green-soft);
  border-color: rgba(34,197,94,0.25);
  color: #4ade80;
}

/* ===================================================
   COMMENT SOLUTION — LETTER BOXES
   =================================================== */

.comment-solution-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 10px;
  align-items: center;
}

.comment-solution-boxes .cs-letter {
  width: 28px;
  height: 31px;
  background: var(--accent-yellow-soft);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #af7e00;
  text-transform: uppercase;
  animation: letterPop 0.25s ease both;
}

.comment-solution-boxes.verified-boxes .cs-letter {
  background: var(--accent-green-soft);
  border-color: rgba(34,197,94,0.3);
  color: #4ade80;
}

.comment-solution-boxes .cs-letter-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 6px;
  font-family: inherit;
  font-weight: 500;
  align-self: center;
}

@keyframes letterPop {
  from { opacity: 0; transform: scale(0.7) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===================================================
   LETTER COUNTER (form input badge)
   =================================================== */

.letter-counter {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}

.letter-counter.has-letters {
  color: var(--accent-blue);
  background: var(--accent-blue-soft);
  border-color: rgba(79,142,247,0.3);
}

/* ===================================================
   SOLUTION PREVIEW (live letter boxes under input)
   =================================================== */

.solution-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-normal);
  border-radius: var(--radius-md);
  min-height: 52px;
  align-items: center;
  transition: border-color var(--transition);
}

.solution-preview.has-input {
  border-color: rgba(79,142,247,0.3);
  border-style: solid;
}

.solution-preview .prev-letter {
  width: 32px;
  height: 36px;
  background: var(--accent-blue-soft);
  border: 1px solid rgba(79,142,247,0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-blue);
  text-transform: uppercase;
  animation: letterPop 0.15s ease both;
}

.solution-preview .prev-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 auto;
  font-style: italic;
}

.letter-counter { background: #f1f5f9; }
.letter-counter.has-letters { background: rgba(79,142,247,0.1); }
.solution-preview { background: #f8fafc; }
.comment-solution-boxes .cs-letter { background: rgba(245,158,11,0.08); }
.comment-solution-boxes.verified-boxes .cs-letter { background: rgba(34,197,94,0.08); }

.comment-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-like, .btn-dislike, .btn-reply {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-weight: 500;
}

.btn-like { color: var(--text-muted); }
.btn-like:hover, .btn-like.active { color: var(--accent-green); background: var(--accent-green-soft); }

.btn-dislike { color: var(--text-muted); }
.btn-dislike:hover, .btn-dislike.active { color: var(--accent-red); background: var(--accent-red-soft); }

.btn-reply { color: var(--accent-blue); }
.btn-reply:hover { background: var(--accent-blue-soft); }

.comment-separator {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

/* ===================================================
   SEO TEXT BLOCK
   =================================================== */

.seo-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
}

.seo-block h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.seo-block p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 8px;
}

.seo-block p:last-child { margin-bottom: 0; }

/* ===================================================
   NAVIGATION BETWEEN CLUES
   =================================================== */

.clue-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 28px;
}

.comment-solution-word {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 11px;
  border-radius: 8px;
}

.comment-solution-word strong {
  color: #059669;
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.comment-solution-word span {
  color: #477568;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Legacy markup also looks correct before JavaScript converts it. */
.clue-discussion .comment-solution-boxes {
  justify-content: flex-start;
  padding: 8px 10px;
  border: 1px solid rgba(5, 150, 105, .15);
  border-radius: 8px;
  background: rgba(5, 150, 105, .055);
}

.clue-discussion .comment-solution-boxes .cs-letter {
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: #059669;
}

.clue-nav-btn {
  display: flex;
  min-width: 0;
  min-height: 82px;
  padding: 13px 14px;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--border-normal);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
}

.clue-nav-btn:hover {
  border-color: rgba(37, 99, 235, .3);
  color: var(--text-primary);
  background: var(--bg-card-hover);
  box-shadow: 0 7px 18px rgba(37, 99, 235, .08);
  transform: translateY(-1px);
}

.clue-nav-btn .nav-dir {
  display: block;
  margin-bottom: 4px;
  color: var(--accent-blue);
  font-size: .72rem;
  font-weight: 800;
}

.clue-nav-copy {
  min-width: 0;
  flex: 1;
}

.clue-nav-question {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-primary);
  font-size: .84rem;
  font-weight: 750;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.clue-nav-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 10px;
  background: rgba(37, 99, 235, .09);
  color: var(--accent-blue);
}

.clue-nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clue-nav-btn.nav-next { text-align: right; }

.clue-nav > div:empty {
  display: none;
}

.clue-nav-btn.nav-next:only-child {
  grid-column: 2;
}

/* ===================================================
   SIDEBAR
   =================================================== */

.sidebar { display: flex; flex-direction: column; gap: 20px;     margin-top: 40px; }

.widget {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* App-style discussion on clue detail pages */
.clue-discussion {
  margin-top: 26px;
  margin-bottom: 28px;
}

.clue-discussion-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.clue-discussion-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.clue-discussion-icon {
  display: inline-flex;
  color: var(--accent-blue);
}

.clue-discussion-heading h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}

.clue-discussion-rules {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: 9px;
  background: rgba(37, 99, 235, .09);
  color: var(--accent-blue);
  font-size: .73rem;
  font-weight: 800;
  text-decoration: none;
}

.clue-discussion-rules:hover {
  background: rgba(37, 99, 235, .14);
  color: var(--accent-blue);
}

.clue-discussion-empty,
.clue-discussion-login {
  padding: 18px;
  border: 1px solid var(--border-normal);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .86rem;
  line-height: 1.5;
  text-align: center;
}

.clue-discussion-login {
  margin-top: 12px;
  padding: 20px 18px;
  border-color: #ef4444;
  background: rgba(239, 68, 68, .045);
  color: #ef2f2f;
  font-size: .9rem;
  line-height: 1.55;
}

.clue-discussion .comment-separator {
  gap: 8px;
  margin-bottom: 12px;
}

.clue-discussion .comment {
  padding: 14px;
  border: 1px solid var(--border-normal);
  border-radius: 12px;
  background: var(--bg-card-hover);
}

.clue-discussion .comment-header {
  align-items: center;
  margin-bottom: 9px;
}

.clue-discussion .comment-avatar {
  width: 32px;
  height: 32px;
  font-size: .78rem;
  background: var(--accent-blue);
}

.clue-discussion .comment-body {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: .86rem;
  line-height: 1.5;
}

.clue-discussion .comment-footer {
  justify-content: flex-start;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  gap: 8px;
}

.clue-discussion .btn-reply {
  margin-left: 0;
}

.clue-discussion .btn-like svg,
.clue-discussion .btn-dislike svg,
.clue-discussion .btn-reply svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clue-discussion .btn-like,
.clue-discussion .btn-dislike {
  padding: 3px 2px;
  border: 0 !important;
  color: var(--text-muted);
}

.clue-discussion .btn-reply {
  color: var(--accent-blue);
  border: 0 !important;
}

.clue-discussion .comment-footer .btn-like,
.clue-discussion .comment-footer .btn-dislike,
.clue-discussion .comment-footer .btn-reply {
  flex: 0 0 auto;
}

.clue-discussion .comment-footer .comment-helpful-label {
  flex: 0 0 100%;
}

.clue-discussion [data-admin-comment-edit] {
  color: var(--text-secondary);
}

.clue-discussion [data-admin-comment-delete] {
  color: var(--accent-red);
}

.clue-discussion .comment-children {
  margin: 8px 0 0 16px;
  padding-left: 12px;
  border-left: 1px solid var(--border-normal);
}

.reply-target-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: .78rem;
}

.discussion-reply-target {
  min-height: 42px;
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border-normal);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: .82rem;
}

.discussion-reply-target[hidden] {
  display: none;
}

.reply-target-notice strong {
  color: var(--text-primary);
}

.reply-target-notice button {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(239, 68, 68, .08);
  color: var(--accent-red);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.clue-discussion-form {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border-normal);
  border-radius: 12px;
  background: var(--bg-card);
}

.clue-discussion .clue-discussion-textarea {
  min-height: 82px;
  resize: vertical;
  border-radius: 10px !important;
  background: var(--bg-secondary);
  border-color: var(--border-normal);
  color: var(--text-primary);
}

.clue-discussion .clue-discussion-textarea::placeholder {
  color: var(--text-muted);
}

.clue-discussion-solution-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0;
  padding: 2px 0;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text-secondary);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}

.clue-discussion-checkbox {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--accent-blue);
  border-radius: 4px;
  background: transparent;
  position: relative;
}

.clue-discussion-solution-toggle.is-active .clue-discussion-checkbox {
  background: var(--accent-blue);
}

.clue-discussion-solution-toggle.is-active .clue-discussion-checkbox::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.clue-discussion-solution-field {
  margin-bottom: 10px;
}

.clue-discussion-solution-field .form-input {
  text-transform: uppercase;
  border-radius: 10px !important;
  background: var(--bg-secondary);
  border-color: var(--border-normal);
  color: var(--text-primary);
}

.clue-discussion-solution-field .form-input::placeholder {
  color: var(--text-muted);
}

.clue-discussion-letter-count {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 700;
  text-align: left;
}

.clue-discussion-letter-count.has-letters {
  color: var(--accent-blue);
}

.clue-discussion-submit {
  display: flex;
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 10px !important;
  background: #2563eb !important;
  color: #fff;
  font: inherit;
  font-size: .88rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: none !important;
  cursor: pointer;
  transition: background-color .16s ease, transform .12s ease, opacity .16s ease;
}

.clue-discussion-submit:hover { background: #1d4ed8 !important; }
.clue-discussion-submit:active { transform: scale(.99); }
.clue-discussion-submit:disabled { cursor: wait; opacity: .65; }

.clue-discussion-feedback {
  display: none;
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 700;
}

.clue-discussion-feedback.is-visible { display: block; }
.clue-discussion-feedback.is-success { color: #047857; background: rgba(16, 185, 129, .09); }
.clue-discussion-feedback.is-error { color: #b91c1c; background: rgba(239, 68, 68, .08); }

.clue-discussion-login a {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

.clue-discussion-login a:hover {
  text-decoration: underline;
}

@media (max-width: 560px) {
  .clue-discussion .comment { padding: 12px; }
  .clue-discussion .comment-children { margin-left: 8px; padding-left: 8px; }
  .clue-discussion-form { padding: 12px; }
}

.widget-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #000000;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Search widget */
.widget-search {
  display: flex;
  gap: 8px;
}

.widget-search input {
flex: 1;
    background: #ffffff;
    border: 1px solid var(--border-normal);
    border-radius: 12px;
    padding: 13px 15px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
	width: 100%;
}

.widget-search input:focus { border-color: var(--accent-blue); }
.widget-search input::placeholder { color: var(--text-muted); }

.widget-search button {
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid;
    font-family: inherit;
    transition: opacity var(--transition);
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
    color: var(--text-secondary);
}

.widget-search button:hover { opacity: 0.85; }

.widget-search .clue-search-submit-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: var(--accent-blue);
  color: #fff;
  cursor: pointer;
  box-sizing: border-box;
  transition: opacity var(--transition), transform var(--transition);
}

.widget-search .clue-search-submit-btn:hover {
  opacity: .9;
  transform: translateY(-1px);
}

.widget-search .clue-search-submit-btn svg {
  display: block;
  flex: none;
}

.search-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.search-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.search-chip:hover {
  border-color: var(--border-accent);
  color: var(--accent-blue);
  background: var(--bg-card);
}

.mobile-add-fab {
  position: fixed;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 1090;
  width: 53px;
  height: 53px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50% !important;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .34);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, transform .12s ease, box-shadow .15s ease;
  animation: mobileAddFabIn .24s ease;
}

.mobile-add-fab span {
  display: block;
  margin-top: -7px;
  font-size: 42px;
  font-weight: 300;
  line-height: 1;
}

.mobile-add-fab:hover {
  background: #1d4ed8;
  color: #fff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .4);
}

.mobile-add-fab:active {
  transform: scale(.94);
}

@media (max-width: 680px) {
  .mobile-add-fab {
    display: inline-flex;
  }
}

@keyframes mobileAddFabIn {
  from { opacity: 0; transform: translateY(10px) scale(.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Shared app-style mobile navigation */
.app-bottom-nav {
  display: none;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1100;
  height: calc(74px + var(--safe-area-bottom));
  padding: 8px max(8px, env(safe-area-inset-right)) calc(10px + var(--safe-area-bottom)) max(8px, env(safe-area-inset-left));
  background: #fff;
  border-top: 1px solid rgba(15, 23, 42, .12);
  box-shadow: 0 -6px 20px rgba(15, 23, 42, .06);
}

.app-bottom-nav-inner {
  width: 100%;
  max-width: 1100px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin: 0 auto;
}

.app-bottom-tab {
  min-width: 0;
  height: 100%;
  display: flex;
  flex: 1 1 20%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #64748b;
  font-size: .68rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: color .15s, transform .12s;
}

.app-bottom-tab > span:last-child,
.site-nav .header-app-tab > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-bottom-tab.is-authenticated .app-bottom-icon,
.site-nav .header-app-tab.is-authenticated .app-bottom-icon {
  color: #2563eb;
}

.app-bottom-tab:hover,
.app-bottom-tab.active {
  color: #2563eb;
}

.app-bottom-tab:active {
  transform: scale(.96);
}

.app-bottom-icon {
  width: 22px;
  height: 22px;
  display: block;
  background-color: currentColor;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.app-bottom-icon-home {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 10.7 12 3l9 7.7V21h-6v-6H9v6H3V10.7Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 10.7 12 3l9 7.7V21h-6v-6H9v6H3V10.7Z'/%3E%3C/svg%3E");
}

.app-bottom-icon-search {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' d='m21 21-4.4-4.4m2.4-5.1A7.5 7.5 0 1 1 4 11.5a7.5 7.5 0 0 1 15 0Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='2' d='m21 21-4.4-4.4m2.4-5.1A7.5 7.5 0 1 1 4 11.5a7.5 7.5 0 0 1 15 0Z'/%3E%3C/svg%3E");
}

.app-bottom-icon-game {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.5 7h9a5.5 5.5 0 0 1 5.2 7.3l-1.4 4A2.5 2.5 0 0 1 16 19l-2-2h-4l-2 2a2.5 2.5 0 0 1-4.3-.7l-1.4-4A5.5 5.5 0 0 1 7.5 7ZM7 11v2H5v2h2v2h2v-2h2v-2H9v-2H7Zm9 2h2v-2h-2v2Zm-2 3h2v-2h-2v2Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.5 7h9a5.5 5.5 0 0 1 5.2 7.3l-1.4 4A2.5 2.5 0 0 1 16 19l-2-2h-4l-2 2a2.5 2.5 0 0 1-4.3-.7l-1.4-4A5.5 5.5 0 0 1 7.5 7ZM7 11v2H5v2h2v2h2v-2h2v-2H9v-2H7Zm9 2h2v-2h-2v2Zm-2 3h2v-2h-2v2Z'/%3E%3C/svg%3E");
}

.app-bottom-icon-ranking {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 3h10v3h4v2c0 3.3-1.8 5.4-5 6.1A5 5 0 0 1 13 17v2h4v2H7v-2h4v-2a5 5 0 0 1-3-2.9C4.8 13.4 3 11.3 3 8V6h4V3Zm0 5H5c0 1.8.7 3 2.2 3.7A9 9 0 0 1 7 10V8Zm10 0v2c0 .6-.1 1.2-.2 1.7C18.3 11 19 9.8 19 8h-2Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 3h10v3h4v2c0 3.3-1.8 5.4-5 6.1A5 5 0 0 1 13 17v2h4v2H7v-2h4v-2a5 5 0 0 1-3-2.9C4.8 13.4 3 11.3 3 8V6h4V3Zm0 5H5c0 1.8.7 3 2.2 3.7A9 9 0 0 1 7 10V8Zm10 0v2c0 .6-.1 1.2-.2 1.7C18.3 11 19 9.8 19 8h-2Z'/%3E%3C/svg%3E");
}

.app-bottom-icon-profile {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-5 0-9 2.5-9 5.5V22h18v-2.5c0-3-4-5.5-9-5.5Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a5 5 0 1 0 0-10 5 5 0 0 0 0 10Zm0 2c-5 0-9 2.5-9 5.5V22h18v-2.5c0-3-4-5.5-9-5.5Z'/%3E%3C/svg%3E");
}

@media (max-width: 680px) {
  body {
    padding-bottom: calc(74px + var(--safe-area-bottom));
  }

  .app-bottom-nav {
    display: block;
  }
}

/* Shared app-style website header */
.site-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-normal);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.site-nav .nav-inner {
  padding-right: 16px;
  padding-left: 16px;
}

.site-nav .app-brand {
  min-width: 0;
  gap: 8px;
  color: var(--text-primary);
  line-height: 1;
}

.site-nav .app-brand:hover {
  color: var(--text-primary);
}

.app-brand-logo {
  width: 36px;
  height: 36px;
  display: block;
  flex: 0 0 36px;
  border-radius: 8px !important;
  object-fit: contain;
}

.app-brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.app-brand-copy strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-brand-copy small {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: .64rem;
  font-weight: 400;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav .nav-links {
  align-self: stretch;
  gap: 2px;
}

.site-nav .nav-links > .header-app-tab {
  width: 64px;
  min-height: 100%;
  padding: 7px 4px 6px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent;
  color: #64748b !important;
  font-size: .67rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
}

.site-nav .header-app-tab .app-bottom-icon {
  width: 21px;
  height: 21px;
}

.site-nav .nav-links > .header-app-tab:hover {
  border: 0 !important;
  background: #f1f5f9;
  color: #2563eb !important;
  transform: none;
}

.site-nav .nav-links > .header-app-tab:active {
  transform: scale(.95);
}

.site-nav .nav-links > .header-app-tab.active,
.site-nav .nav-links > .header-app-tab[aria-current="page"] {
  border: 0 !important;
  background: #eff6ff;
  color: #2563eb !important;
}

.site-nav .nav-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  background: #f8fafc;
  color: #334155;
  font-size: 20px;
  line-height: 1;
}

.site-nav .nav-toggle:hover {
  border-color: #bfdbfe !important;
  background: #eff6ff;
  color: #2563eb;
}

@media (max-width: 860px) {
  .site-nav .nav-links.open {
    gap: 6px;
  }

  .site-nav .nav-links.open > .header-app-tab {
    width: 100%;
    min-height: 46px;
    padding: 8px 12px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    border: 1px solid #e2e8f0 !important;
    font-size: .82rem;
  }
}

@media (max-width: 680px) {
  .site-nav .nav-inner {
    padding-right: 14px;
    padding-left: 14px;
  }

  .app-brand-logo {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .app-brand-copy strong {
    font-size: 1rem;
  }

  .app-brand-copy small {
    max-width: 205px;
    font-size: .58rem;
  }
}

@media (max-width: 390px) {
  .app-brand-copy small {
    max-width: 170px;
  }
}

.sidebar-legal-note {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 4px 14px;
  color: #94a3b8;
  font-size: .68rem;
  line-height: 1.65;
}

.sidebar-legal-links {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}

.sidebar-legal-links a {
  color: #64748b;
  text-decoration: none;
}

.sidebar-legal-links a:hover {
  color: #2563eb;
}

.profile-widget-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.profile-widget-btn:hover {
  opacity: 0.96;
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

/* User rating widget */
.user-rank-list { display: flex; flex-direction: column; gap: 10px; }

.user-rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  cursor: pointer;
}

.user-rank-item:hover { background: var(--bg-glass); }

.rank-pos {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.rank-pos.gold { color: #f59e0b; }
.rank-pos.silver { color: #94a3b8; }
.rank-pos.bronze { color: #cd7c3a; }

.rank-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.rank-info { flex: 1; min-width: 0; }

.rank-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-score {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.rank-badge-icon { font-size: 16px; }

/* Popular / recent clue list */
.clue-list { display: flex; flex-direction: column; gap: 2px; }

.clue-list-item {
    display: block;
    padding: 7px 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    transition: all var(--transition);
    white-space: normal;
    overflow: visible;
    border-bottom: 1px solid #eee;
    text-overflow: clip;
    line-height: 1.35;
}

.clue-list-item:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.clue-list-item .clue-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 7px;
  background: var(--text-muted);
  vertical-align: middle;
}

.clue-list-item .clue-dot.green { background: var(--accent-green); }
.clue-list-item .clue-dot.yellow { background: var(--accent-yellow); }
.clue-list-item .clue-dot.red { background: var(--accent-red); }

/* App-style sidebar on clue detail pages */
.clue-sidebar-widget {
  padding: 12px;
  border: 1px solid var(--border-normal);
  border-radius: 16px !important;
  background: var(--bg-card);
  box-shadow: none;
}

.clue-sidebar-widget > .widget-title {
  margin: 0;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.clue-sidebar-widget .clue-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.clue-sidebar-widget .clue-list-item {
  display: flex;
  min-height: 54px;
  align-items: center;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: .75rem;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

.clue-sidebar-widget .clue-list-item:last-child { border-bottom: 0; }

.clue-sidebar-widget .clue-list-item::after {
  content: '›';
  margin-left: auto;
  padding-left: 8px;
  color: var(--text-secondary);
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1;
}

.clue-sidebar-widget .clue-list-item:hover {
  background: var(--bg-card-hover);
  color: #2563eb;
}

.clue-sidebar-widget .clue-list-item .clue-dot {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  margin: 0 9px 0 0;
  place-items: center;
  border-radius: 11px !important;
  background: rgba(37, 99, 235, .1);
  color: #2563eb;
  font-size: .76rem;
  font-weight: 900;
  line-height: 1;
}

.clue-sidebar-widget .clue-list-item .clue-dot::before { content: '⌕'; }
.clue-sidebar-widget .clue-list-item .clue-dot.red {
  background: rgba(220, 38, 38, .1);
  color: #dc2626;
}
.clue-sidebar-widget .clue-list-item .clue-dot.red::before { content: '?'; }
.clue-sidebar-widget .clue-list-item .clue-dot.yellow {
  background: rgba(217, 119, 6, .11);
  color: #d97706;
}
.clue-sidebar-widget .clue-list-item .clue-dot.yellow::before { content: '•'; }
.clue-sidebar-widget .clue-list-item .clue-dot.green {
  background: rgba(5, 150, 105, .1);
  color: #059669;
}
.clue-sidebar-widget .clue-list-item .clue-dot.green::before { content: '✓'; }

.clue-sidebar-about {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
}

.clue-sidebar-about-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: 11px !important;
  background: rgba(37, 99, 235, .1);
  color: #2563eb;
  font-size: .85rem;
  font-weight: 900;
}

.clue-sidebar-about-copy { min-width: 0; }
.clue-sidebar-about .widget-title {
  margin: 0 0 5px;
  padding: 0;
  border: 0;
  color: var(--text-primary);
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}
.clue-sidebar-about .question-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: .69rem;
  line-height: 1.5;
}

/* ===================================================
   FOOTER
   =================================================== */

.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 48px 0 24px;
  margin-top: 64px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.footer-col ul { display: flex; flex-direction: column; gap: 8px; }

.footer-col ul li a {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.footer-col ul li a:hover { color: var(--text-secondary); }

.footer-search {
  display: flex;
  gap: 8px;
}

.footer-search input {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.footer-search input::placeholder { color: var(--text-muted); }

.footer-search input:focus { border-color: var(--accent-blue); }

.footer-search button {
  background: var(--accent-blue);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  color: #fff;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

/* ===================================================
   TOAST NOTIFICATION
   =================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.85rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  max-width: 320px;
}

.toast.toast-success { border-left: 3px solid var(--accent-green); }
.toast.toast-info { border-left: 3px solid var(--accent-blue); }
.toast.toast-warning { border-left: 3px solid var(--accent-yellow); }
.toast.toast-error { border-left: 3px solid var(--accent-red); }

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* ===================================================
   REPLY FORM (inline)
   =================================================== */

.reply-form {
  margin-top: 12px;
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: none;
}

.reply-form.open { display: block; animation: expandIn 0.2s ease; }

@keyframes expandIn {
  from { opacity: 0; transform: scaleY(0.9); transform-origin: top; }
  to { opacity: 1; transform: scaleY(1); }
}

.reply-form textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  padding: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 70px;
  outline: none;
  margin-bottom: 10px;
}

.reply-form textarea:focus { border-color: var(--accent-blue); }
.reply-form textarea::placeholder { color: var(--text-muted); }

.reply-form .reply-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===================================================
   MODERATOR PANEL (type 3)
   =================================================== */

.moderator-panel {
  background: rgba(139,92,246,0.08);
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 28px;
}

.moderator-panel h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #7b63d7;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.moderator-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.moderator-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f8ef7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}

/* ===================================================
   RESPONSIVE
   =================================================== */

/* ---- 1100px: shrink sidebar a bit ---- */
@media (max-width: 1100px) {
  :root { --sidebar-width: 325px; }
}

.sidebar-profile-card {
  padding: 16px;
  border: 1px solid var(--border-normal);
  border-radius: 16px !important;
  background: var(--bg-card);
  box-shadow: none;
}

.sidebar-profile-heading {
  margin-bottom: 14px !important;
  color: var(--text-primary) !important;
  font-size: .9rem !important;
  font-weight: 800 !important;
}

.sidebar-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  background: transparent;
}

.sidebar-profile-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 50% !important;
  background: #2563eb;
  color: #fff;
}

.sidebar-profile-identity {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 7px;
}
.sidebar-profile-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-role {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  margin-top: 0;
  padding: 3px 7px;
  border-radius: 5px !important;
  background: rgba(37, 99, 235, .1);
  color: #1d4ed8;
  font-size: .66rem;
  font-weight: 800;
}

.sidebar-profile-role.is-admin {
  background: rgba(139, 92, 246, .12);
  color: #7c3aed;
}

.sidebar-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 12px;
  padding: 0;
  border: 0;
}

.sidebar-profile-stat {
  min-width: 0;
  text-align: center;
}

.sidebar-profile-stat strong {
  display: block;
  color: var(--text-primary);
  font-size: .92rem;
  line-height: 1.2;
}

.sidebar-profile-stat span {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: .59rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-card .profile-widget-btn {
  min-height: 38px;
  border-radius: 10px !important;
  box-shadow: none;
  font-size: .76rem;
}

.clue-author-widget {
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px !important;
  background: var(--bg-card);
  box-shadow: none;
}

.clue-author-widget-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
  color: var(--text-primary);
  font-size: .86rem;
  font-weight: 800;
}

.clue-author-widget-icon {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 9px !important;
  background: rgba(37, 99, 235, .1);
  color: #2563eb;
}

.clue-author-widget-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clue-author-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px !important;
  background: var(--bg-secondary);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

a.clue-author-profile:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.clue-author-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 50% !important;
  background: #2563eb;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.clue-author-identity {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 5px;
}

.clue-author-identity > strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: .9rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clue-author-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.clue-author-role,
.clue-author-level {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 6px !important;
  font-size: .62rem;
  font-weight: 800;
  line-height: 1;
}

.clue-author-role {
  background: rgba(37, 99, 235, .1);
  color: #2563eb;
}

.clue-author-role.is-moderator {
  background: rgba(139, 92, 246, .12);
  color: #7c3aed;
}

.clue-author-level {
  background: rgba(16, 185, 129, .11);
  color: #059669;
}

.clue-author-chevron {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.clue-author-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.clue-author-facts > div {
  min-width: 0;
  padding: 8px 5px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px !important;
  background: var(--bg-secondary);
  text-align: center;
}

.clue-author-facts strong,
.clue-author-facts span {
  display: block;
}

.clue-author-facts strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: .78rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clue-author-facts span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: .6rem;
  line-height: 1.2;
}

.answer-directory-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 16px;
}

.answer-directory-links a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 9px !important;
  background: var(--bg-card);
  color: var(--accent-blue);
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.answer-directory-links a:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

/* ---- 860px: narrower sidebar, hide some nav links ---- */
@media (max-width: 860px) {
  :root { --sidebar-width: 280px; }
  .nav-toggle { display: block; }
  .nav-links { display: none; }
  .nav-inner { gap: 12px; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    position: absolute;
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    width: auto;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open a {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    min-height: 42px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-weight: 600;
  }
  .nav-links.open > a[aria-current="page"] {
    background: var(--accent-blue-soft);
    border-color: var(--border-accent);
    color: var(--accent-blue);
  }
  .nav-auth-status {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 12px 0 0;
  }
  .nav-links.open .nav-auth-status {
    display: flex;
    border-top: 1px solid var(--border-subtle);
    margin-top: 2px;
  }
  .nav-links.open .nav-auth-pill {
		width: 100%;
        max-width: 100%;
        min-height: 42px;
        padding: 10px 12px;
        text-align: center;
  }
  .nav-links.open .nav-btn,
  .nav-links.open .nav-logout {
    justify-content: center;
  }
  .nav-links.open .nav-logout {
    display: flex;
    align-items: center;
    min-height: 42px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-weight: 600;
  }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- 680px: stack sidebar below main ---- */
@media (max-width: 680px) {
  :root { --nav-height: 56px; }

  .page-wrap {
    grid-template-columns: 1fr;
    padding: calc(var(--nav-height) + 16px) 14px 48px;
    gap: 20px;
  }

  /* sidebar moves below main content */
  .sidebar {
    position: static;
    max-height: none;
    order: 1; 
	margin: 0;
  }

  .widget[data-clue-search-widget] {
    display: none;
  }

  /* hide theme toggle label on small screens */
  .theme-toggle-label { display: none; }

  .nav-search { max-width: none; flex: 1; }

  .question-title { font-size: 1.12rem; }
  .question-card { min-height: 172px; padding: 16px; }
  .submit-section { padding: 20px; }

  .form-grid { grid-template-columns: 1fr; }

  .clue-nav { grid-template-columns: 1fr; }
  .clue-nav-btn.nav-next,
  .clue-nav-btn.nav-next:only-child { grid-column: auto; text-align: left; }

  .answer-card { flex-wrap: wrap; display: block;}
  .answer-info { margin-bottom: 10px; margin-top: 5px; margin-left: 5px;}
  .answer-actions { width: 100%; flex-direction: row; justify-content: flex-end; }

  .vote-group {  display: flex;}

  .footer-grid { grid-template-columns: 1fr; gap: 20px; }

  .toast-container { right: 10px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .toast { max-width: 260px; font-size: 0.82rem; }
}

@media (max-width: 480px) {
  .page-wrap { padding-left: 12px; padding-right: 12px; }
  .question-title { font-size: 1.08rem; }
  .answer-letters { gap: 3px; }
  .letter-box { width: 30px; height: 34px; font-size: 0.82rem; }
  .letter-box-num { top: 2px; left: 3px; font-size: 0.5rem; }
  .vote-group { flex-wrap: wrap; }
  .nav-search { display: none; }

}

/* ===================================================
   LIGHT THEME — extra overrides (always active)
   =================================================== */

.nav-search input {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.12);
  color: var(--text-primary);
}

.nav-search input::placeholder { color: var(--text-muted); }

.form-input,
.form-select,
.form-textarea {
  background: #fff;
  border-color: rgba(0,0,0,0.14);
  color: var(--text-primary);
}

.form-select option { background: #fff; color: #0f172a; }

.vote-btn {
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.12);
  color: var(--text-secondary);
}

.vote-btn:hover { background: #e2e8f0; }

.letter-box {
  background: #f8fafc;
  border-color: rgba(0,0,0,0.14);
  color: var(--text-primary);
}

.reply-form {
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.08);
}

.reply-form textarea {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
  color: var(--text-primary);
}

.widget {
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

.answer-card:hover {
  background: #f8fafc;
}

.answer-card.top-community {
  background: rgba(245,158,11,0.06);
}

.site-footer {
  background: #e8edf5;
  border-top-color: rgba(0,0,0,0.08);
}

.toast {
  background: #fff;
  border-color: rgba(0,0,0,0.12);
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.clue-list-item {
  color: var(--text-secondary);
}

.clue-list-item:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-primary);
}

.user-rank-item:hover {
  background: rgba(0,0,0,0.04);
}

.btn-secondary {
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.12);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.moderator-panel {
  background: rgba(139,92,246,0.05);
  border-color: rgba(139,92,246,0.15);
}

.vote-progress {
  background: rgba(245,158,11,0.08);
}

.seo-block {
  background: #fff;
  border-color: rgba(0,0,0,0.08);
}

.clue-nav-btn {
  background: var(--bg-card);
  border-color: var(--border-normal);
}

.clue-nav-btn:hover {
  background: rgba(79,142,247,0.07);
  border-color: var(--accent-blue);
}

.footer-search input {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.12);
  color: var(--text-primary);
}

.question-title {
  background: none;
  color: var(--text-primary);
  -webkit-background-clip: initial;
  -webkit-text-fill-color: currentColor;
  background-clip: initial;
}

.nav-logo { color: var(--text-primary); }

.nav-links a:hover { color: #ffffff; background: #4e607d; }
.section-desc {
    padding-left: 10px;
}
/* ===== Comment Solution Boxes ===== */
.comment-solution-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 10px 0 6px;
}

.cs-letter {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--accent-blue);
  border-radius: 6px;
  background: rgba(79,142,247,0.08);
  color: var(--accent-blue);
  font-weight: 700;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  animation: csLetterPop 0.3s ease both;
}

@keyframes csLetterPop {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

.cs-letter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 6px;
}

/* ===== Like / Dislike Buttons ===== */
.btn-like, .btn-dislike {
  background: none;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-like:hover {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
  color: #22c55e;
}

.btn-dislike:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: #ef4444;
  color: #ef4444;
}

.btn-reply {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition);
  font-family: inherit;
}

.btn-reply:hover { color: var(--accent-blue); }

/* ===== Reply Form ===== */
.reply-form {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
}

.reply-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

/* ===== Nested Comment Children ===== */
.comment-children {
  margin-top: 12px;
  padding-left: 20px;
  border-left: 2px solid var(--border-normal);
}

.comment-children .comment {
  margin-top: 12px;
}

/* ===== Comment separator ===== */
.comment-separator > .comment + .comment {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

/* ===== Square Template Override ===== */
:root {
  --radius-sm: 0;
  --radius-md: 0;
  --radius-lg: 0;
  --radius-xl: 0;
  --radius-full: 0;
}

button,
.btn,
.nav-btn,
.nav-toggle,
.nav-logout,
.social-btn,
.clue-search-submit-btn,
.btn-search-mask,
.mask-toggle-btn,
.mask-close-btn,
.profile-widget-btn,
.answer-admin-btn,
.vote-btn,
.btn-like,
.btn-dislike,
.btn-reply,
input,
textarea,
select,
.form-input,
.form-select,
.form-textarea {
  border-radius: 0 !important;
}

button,
.btn,
.nav-btn,
.nav-toggle,
.nav-logout,
.social-btn,
.clue-search-submit-btn,
.btn-search-mask,
.mask-toggle-btn,
.mask-close-btn,
.profile-widget-btn,
.answer-admin-btn,
.vote-btn,
.btn-like,
.btn-dislike,
.btn-reply {
  border-width: 1px !important;
  border-style: solid !important;
  border-color: var(--border-normal) !important;
}

input,
textarea,
select,
.form-input,
.form-select,
.form-textarea {
  border-width: 1px !important;
  border-style: solid !important;
  border-color: var(--border-normal) !important;
}

.clue-discussion .comment-footer .btn-like,
.clue-discussion .comment-footer .btn-dislike,
.clue-discussion .comment-footer .btn-reply {
  border-radius: 8px !important;
}

/* ===== PWA install invitation ===== */
.pwa-install-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1600;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 11px;
  width: min(520px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid #d9e0ea;
  border-radius: 16px !important;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .2);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .2s ease, transform .2s ease;
}

.pwa-install-banner[hidden] { display: none; }
.pwa-install-banner.is-visible { opacity: 1; transform: translateY(0); }
.pwa-install-icon { width: 46px; height: 46px; border-radius: 11px !important; }
.pwa-install-copy { min-width: 0; display: grid; gap: 3px; }
.pwa-install-copy strong { color: #0f172a; font-size: .9rem; }
.pwa-install-copy span { color: #64748b; font-size: .75rem; line-height: 1.35; }
.pwa-install-action,
.pwa-install-close {
  border: 0 !important;
  border-radius: 10px !important;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
}
.pwa-install-action { min-height: 40px; padding: 0 14px; background: #2563eb; color: #fff; }
.pwa-install-close { width: 32px; height: 32px; padding: 0; background: #f1f5f9; color: #64748b; font-size: 1.25rem; }

@media (max-width: 680px) {
  .pwa-install-banner {
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: auto;
    grid-template-columns: 42px minmax(0, 1fr) 30px;
    gap: 9px;
  }
  .pwa-install-icon { width: 42px; height: 42px; }
  .pwa-install-action { grid-column: 1 / -1; width: 100%; }
  .pwa-install-close { grid-column: 3; grid-row: 1; }
}





