/* ─── Tom Says · My Big TOE — фирменный стиль «окно реальности» ───
   Палитра: глубокий индиго + тёплое золото. Тёмная тема — единственная. */

:root {
  --bg: #0a0e1f;
  --bg-alt: #0e1330;
  --panel: #131a3d;
  --panel-2: #1a2250;
  --line: rgba(232, 180, 74, 0.14);
  --gold: #e8b44a;
  --gold-soft: #f3cf85;
  --text: #e9ebf5;
  --muted: #9aa3c0;
  --danger: #ff7676;
  --ok: #7fd98e;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --maxw: 1080px;
  --header-bg: rgba(10, 14, 31, 0.82);
  --user-bubble: linear-gradient(135deg, #2b3a8f, #1e2a6e);
}

/* Светлая тема (переключатель в шапке; выбор запоминается) */
:root[data-theme="light"] {
  --bg: #f7f7fb;
  --bg-alt: #efeff6;
  --panel: #ffffff;
  --panel-2: #f2f0ea;
  --line: rgba(150, 110, 30, 0.22);
  --gold: #b07e1e;
  --gold-soft: #8a6216;
  --text: #1d2233;
  --muted: #5c6478;
  --shadow: 0 10px 30px rgba(30, 35, 60, 0.12);
  --header-bg: rgba(247, 247, 251, 0.88);
  --user-bubble: linear-gradient(135deg, #dfe6ff, #ccd6f8);
}
:root[data-theme="light"] .msg-user { color: #1d2233; }
:root[data-theme="light"] .hero-glow { opacity: 0.5; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; font-weight: 700; }
h2 { font-size: clamp(26px, 4vw, 38px); margin-bottom: 14px; }
.center { text-align: center; }

/* ─── Header ─── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.logo { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: 0.2px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-sub { color: var(--muted); font-weight: 500; font-size: 14px; }
.header-nav { display: flex; gap: 20px; margin-left: 10px; flex: 1; }
.header-nav a { color: var(--text); font-size: 14.5px; font-weight: 600; white-space: nowrap; opacity: 0.85; }
.header-nav a:hover { color: var(--gold); opacity: 1; text-decoration: none; }
.theme-toggle {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 6px 10px; font-size: 15px; cursor: pointer;
}
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.lang-select, .depth-select {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 7px 10px; font-size: 14px; cursor: pointer;
}

/* ─── Buttons ─── */
.btn {
  display: inline-block; border: none; cursor: pointer;
  border-radius: 12px; padding: 14px 26px;
  font-size: 16px; font-weight: 700; font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
  text-align: center;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #d29a2e);
  color: #221a05;
  box-shadow: 0 6px 24px rgba(232, 180, 74, 0.25);
}
.btn-gold:hover { box-shadow: 0 8px 30px rgba(232, 180, 74, 0.4); }
.btn-ghost {
  background: transparent; color: var(--gold-soft);
  border: 1px solid rgba(232, 180, 74, 0.45);
}
.btn-ghost:hover { background: rgba(232, 180, 74, 0.08); }
.btn-tg { background: #2aabee; color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 14px; border-radius: 9px; }

/* ─── Hero ─── */
.hero { position: relative; overflow: hidden; padding: 96px 0 90px; }
.hero-glow {
  position: absolute; inset: -40% -20% auto;
  height: 130%;
  background:
    radial-gradient(ellipse 55% 45% at 70% 20%, rgba(232, 180, 74, 0.14), transparent 60%),
    radial-gradient(ellipse 60% 55% at 25% 80%, rgba(60, 80, 200, 0.20), transparent 65%);
  pointer-events: none;
}
.hero-inner { position: relative; max-width: 780px; }
.hero-title {
  font-size: clamp(44px, 8vw, 84px);
  background: linear-gradient(120deg, var(--gold-soft), var(--gold) 55%, #b47f1e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 14px;
}
.hero-sub { font-size: clamp(19px, 2.6vw, 26px); font-weight: 600; margin-bottom: 16px; }
.hero-lead { color: var(--muted); font-size: 17px; max-width: 640px; margin-bottom: 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-note { color: var(--muted); font-size: 14px; margin-top: 18px; font-style: italic; }

/* ─── Sections ─── */
.section { padding: 74px 0; }
.section-alt { background: var(--bg-alt); }
.section-sub { color: var(--muted); margin-bottom: 30px; max-width: 640px; }

.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 22px;
}
.card-emoji { font-size: 30px; margin-bottom: 12px; }
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; }

/* ─── Theses ─── */
.theses-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.thesis {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  cursor: pointer; transition: border-color 0.15s;
}
.thesis:hover { border-color: rgba(232, 180, 74, 0.45); }
.thesis-num { color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 0.6px; }
.thesis-title { font-weight: 700; font-size: 15px; margin: 6px 0; }
.thesis-body { color: var(--muted); font-size: 14px; display: none; }
.thesis.open .thesis-body { display: block; }

/* ─── Quiz ─── */
.quiz-wrap { max-width: 720px; }
.quiz-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 30px; min-height: 180px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
}
.quiz-progress { color: var(--gold); font-size: 13px; font-weight: 700; letter-spacing: 0.6px; }
.quiz-q { font-size: 19px; font-weight: 700; }
.quiz-opts { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.quiz-opt {
  text-align: left; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 13px 16px; font-size: 15px; cursor: pointer; font-family: inherit;
  transition: border-color 0.12s, background 0.12s;
}
.quiz-opt:hover { border-color: rgba(232, 180, 74, 0.5); }
.quiz-opt.correct { border-color: var(--ok); background: rgba(127, 217, 142, 0.10); }
.quiz-opt.wrong { border-color: var(--danger); background: rgba(255, 118, 118, 0.10); }
.quiz-explain { color: var(--muted); font-size: 14px; border-left: 3px solid var(--gold); padding-left: 12px; }
.quiz-result-score { font-size: 42px; font-weight: 800; color: var(--gold); }
.quiz-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ─── Honest / Final ─── */
.honest-wrap { max-width: 720px; }
.honest-wrap p { color: var(--muted); margin-bottom: 14px; }
.final-cta .hero-cta { justify-content: center; margin-top: 22px; }
.final-cta h2 { max-width: 640px; margin: 0 auto; }

/* ─── Footer ─── */
.site-footer { border-top: 1px solid var(--line); padding: 30px 0 40px; color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; flex-direction: column; gap: 10px; }
.footer-links { display: flex; gap: 18px; }
.footer-note { font-size: 12.5px; opacity: 0.75; }

/* ─── Chat overlay ─── */
.chat-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 7, 18, 0.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.chat-overlay[hidden] { display: none; }
.chat-panel {
  width: 100%; max-width: 680px; height: min(86vh, 760px);
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.chat-title { font-weight: 800; flex: 1; }
.chat-close {
  background: none; border: none; color: var(--muted);
  font-size: 20px; cursor: pointer; padding: 4px 8px;
}
.chat-close:hover { color: var(--text); }
.chat-menu {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.menu-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.menu-btn:hover { border-color: rgba(232, 180, 74, 0.45); color: var(--gold-soft); }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.qlist { display: flex; flex-direction: column; gap: 6px; max-width: 92%; }
.qlist-header { font-weight: 800; font-size: 14.5px; }
.qlist-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.qlist-item {
  text-align: left; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 13px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.qlist-item:hover { border-color: rgba(232, 180, 74, 0.5); }
.msg { max-width: 86%; padding: 12px 15px; border-radius: 14px; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.msg-user { align-self: flex-end; background: var(--user-bubble); }
.msg-bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg-bot a { word-break: break-all; }
.msg-typing { color: var(--muted); font-style: italic; }
.chat-refs { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 2px; align-self: flex-start; max-width: 86%; }
.ref-chip {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--gold-soft);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.ref-chip:hover { border-color: rgba(232, 180, 74, 0.5); background: rgba(232, 180, 74, 0.08); }
.chat-suggests { display: flex; gap: 8px; padding: 0 16px 8px; flex-wrap: wrap; }
.suggest {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.suggest:hover { color: var(--gold-soft); border-color: rgba(232, 180, 74, 0.4); }
.chat-inputbar { display: flex; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.chat-inputbar input {
  flex: 1; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 15px; color: var(--text); font-size: 15px; font-family: inherit;
}
.chat-inputbar input:focus { outline: none; border-color: rgba(232, 180, 74, 0.5); }
.btn-send { padding: 13px 20px; }

/* ─── Mobile ─── */
@media (max-width: 820px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0 8px; row-gap: 6px; }
  .header-nav {
    order: 3; flex-basis: 100%; margin-left: 0; gap: 16px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .header-nav::-webkit-scrollbar { display: none; }
  .header-nav a { font-size: 13.5px; }
  .cards3, .theses-grid { grid-template-columns: 1fr; }
  .hero { padding: 64px 0 60px; }
  .section { padding: 54px 0; }
  .chat-overlay { padding: 0; }
  .chat-panel { height: 100dvh; max-width: none; border-radius: 0; border: none; }
}
@media (min-width: 821px) and (max-width: 1024px) {
  .theses-grid { grid-template-columns: repeat(2, 1fr); }
}
