*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  height: 100%;
}
:root {
  --bg: #0a0f1e;
  --surface: #111827;
  --surface2: #1a2235;
  --border: rgba(255, 255, 255, 0.08);
  --accent: #4ade80;
  --accent2: #22d3ee;
  --accent3: #f59e0b;
  --pink: #ff0090;
  --red: #ff1155;
  --yellow: #ffd600;
  --text: #f1f5f9;
  --muted: #64748b;
  --user-bubble: #1e3a5f;
  --ai-bubble: #162032;
  --font-d: "Unbounded", sans-serif;
  --font-b: "Golos Text", sans-serif;
  --font-m: "JetBrains Mono", monospace;
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  min-height: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(74, 222, 128, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 222, 128, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
}
.orb-1 {
  width: 500px;
  height: 500px;
  background: #4ade80;
  top: -150px;
  right: -150px;
}
.orb-2 {
  width: 400px;
  height: 400px;
  background: #22d3ee;
  bottom: 50px;
  left: -120px;
}

/* ====== MODAL ====== */
#modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#modal-box {
  background: var(--surface);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 0 60px rgba(74, 222, 128, 0.1);
}
.m-title {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}
.m-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 6px;
}
.m-steps {
  background: rgba(74, 222, 128, 0.05);
  border: 1px solid rgba(74, 222, 128, 0.15);
  border-radius: 10px;
  padding: 14px;
  margin: 14px 0;
  font-size: 12px;
  line-height: 2.1;
  color: var(--muted);
}
.m-steps b {
  color: var(--accent);
}
.m-inp {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 10px;
  font-family: var(--font-b);
  font-size: 13px;
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.m-inp:focus {
  border-color: var(--accent);
}
.m-inp::placeholder {
  color: var(--muted);
}
.m-btn {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 13px;
  color: #0a0f1e;
  cursor: pointer;
  transition: all 0.2s;
}
.m-btn:hover {
  background: #86efac;
  transform: scale(1.01);
}
.m-note {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
}

/* ====== TOAST ====== */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid var(--accent);
  padding: 10px 22px;
  border-radius: 8px;
  font-family: var(--font-m);
  font-size: 12px;
  color: var(--accent);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  pointer-events: none;
}
#toast.on {
  opacity: 1;
}

/* ====== HEADER ====== */
header {
  position: relative;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.88);
  backdrop-filter: blur(14px);
  flex-wrap: wrap;
  gap: 10px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 800;
}
.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.logo span {
  color: var(--accent);
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.alem-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(74, 222, 128, 0.07);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 20px;
  padding: 5px 11px;
  font-family: var(--font-m);
  font-size: 10px;
  color: rgba(74, 222, 128, 0.75);
  letter-spacing: 0.5px;
}
.lang-toggle {
  display: flex;
  gap: 3px;
  background: var(--surface2);
  border-radius: 10px;
  padding: 3px;
}
.lang-btn {
  padding: 5px 11px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-b);
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn.active {
  background: var(--accent);
  color: #0a0f1e;
}
.hbtn {
  padding: 7px 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-b);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.hbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Мобильное меню: предмет + класс */
.nav-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: 4px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.nav-burger:hover,
.nav-burger:focus-visible {
  border-color: rgba(74, 222, 128, 0.4);
  color: var(--accent);
  outline: none;
}
.nav-burger svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
}
#navBackdrop {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
#navBackdrop.on {
  display: block;
  pointer-events: auto;
}

/* ====== TAB BAR (Tutor / FakeGuard) ====== */
.tab-bar {
  position: relative;
  z-index: 59;
  display: flex;
  background: rgba(10, 15, 30, 0.7);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.tab-bar-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.tab-bar-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-bar-btn.fg-tab.active {
  color: #ff0090;
  border-bottom-color: #ff0090;
}
.tab-bar-btn.hw-tab.active {
  color: var(--accent2);
  border-bottom-color: var(--accent2);
}
.tab-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(255, 0, 144, 0.15);
  color: #ff0090;
  font-family: var(--font-m);
}
.tab-badge-hw {
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent2);
  border: 1px solid rgba(34, 211, 238, 0.3);
}

/* ====== MAIN LAYOUT ====== */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px;
  gap: 16px;
  isolation: isolate;
}

/* ====== SIDEBAR ====== */
.sidebar {
  position: relative;
  z-index: 2;
  width: 210px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px 6px;
}
.subject-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}
.subject-btn:hover {
  border-color: rgba(74, 222, 128, 0.3);
  background: var(--surface2);
}
.subject-btn.active {
  border-color: var(--accent);
  background: rgba(74, 222, 128, 0.08);
  color: var(--accent);
}
.subject-icon {
  font-size: 16px;
}
.grade-section {
  margin-top: 12px;
}
.grade-dd {
  position: relative;
  width: 100%;
  z-index: 5;
}
.grade-dd-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
  text-align: left;
}
.grade-dd-btn:hover {
  border-color: rgba(74, 222, 128, 0.35);
  background: var(--surface2);
}
.grade-dd-btn:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.2);
}
.grade-dd-btn.open {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(74, 222, 128, 0.06);
}
.grade-dd-icon {
  font-size: 15px;
  line-height: 1;
  opacity: 0.9;
}
.grade-dd-value {
  flex: 1;
  min-width: 0;
  font-weight: 500;
}
.grade-dd-arrow {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.25s ease;
}
.grade-dd-btn.open .grade-dd-arrow {
  transform: rotate(180deg);
  color: var(--accent);
}
.grade-dd-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 11px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(74, 222, 128, 0.08);
}
.grade-dd.open .grade-dd-menu {
  display: flex;
  animation: gradeDdIn 0.2s ease;
}
@keyframes gradeDdIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.grade-dd-opt {
  display: block;
  width: 100%;
  padding: 9px 12px;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}
.grade-dd-opt:hover {
  background: var(--surface2);
  color: var(--accent);
}
.grade-dd-opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.grade-dd-opt.active {
  background: rgba(74, 222, 128, 0.12);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, 0.25);
}

/* ====== CHAT AREA ====== */
.chat-area {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.subject-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
}
.subject-banner-icon {
  font-size: 22px;
}
.subject-banner-info h2 {
  font-family: var(--font-d);
  font-size: 13px;
  font-weight: 600;
}
.subject-banner-info p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
  min-height: 0;
}
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 20px;
  text-align: center;
}
.welcome-icon {
  width: 68px;
  height: 68px;
  background: linear-gradient(
    135deg,
    rgba(74, 222, 128, 0.12),
    rgba(34, 211, 238, 0.12)
  );
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.welcome h2 {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}
.welcome h2 span {
  color: var(--accent);
}
.welcome p {
  color: var(--muted);
  font-size: 13px;
  max-width: 360px;
  line-height: 1.6;
}
.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.quick-btn {
  padding: 7px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.message {
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.message.user {
  align-items: flex-end;
}
.message.ai {
  align-items: flex-start;
}
.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.65;
}
.message.user .bubble {
  background: var(--user-bubble);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-bottom-right-radius: 4px;
}
.message.ai .bubble {
  background: var(--ai-bubble);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.bubble-md {
  overflow-wrap: break-word;
  word-break: break-word;
}
.bubble-md p {
  margin: 0 0 0.65em;
}
.bubble-md p:last-child {
  margin-bottom: 0;
}
.bubble-md h1,
.bubble-md h2,
.bubble-md h3,
.bubble-md h4 {
  font-family: var(--font-d);
  font-weight: 700;
  line-height: 1.25;
  margin: 0.85em 0 0.45em;
}
.bubble-md h1:first-child,
.bubble-md h2:first-child,
.bubble-md h3:first-child {
  margin-top: 0;
}
.bubble-md h1 {
  font-size: 1.15em;
}
.bubble-md h2 {
  font-size: 1.08em;
}
.bubble-md h3 {
  font-size: 1.02em;
}
.bubble-md ul,
.bubble-md ol {
  margin: 0.45em 0 0.65em;
  padding-left: 1.35em;
}
.bubble-md li {
  margin: 0.2em 0;
}
.bubble-md blockquote {
  border-left: 3px solid var(--accent);
  margin: 0.55em 0;
  padding: 0.2em 0 0.2em 12px;
  color: rgba(241, 245, 249, 0.88);
}
.bubble-md hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.bubble-md :not(pre) > code {
  background: rgba(74, 222, 128, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-m);
  font-size: 12px;
}
.bubble-md pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0.65em 0;
  font-family: var(--font-m);
  font-size: 12px;
  line-height: 1.55;
}
.bubble-md pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}
.bubble-md table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  margin: 0.65em 0;
}
.bubble-md th,
.bubble-md td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.bubble-md th {
  background: rgba(0, 0, 0, 0.22);
  font-weight: 600;
}
.bubble-md a {
  color: var(--accent2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bubble-md a:hover {
  color: var(--accent);
}
.bubble-md .katex {
  font-size: 1.06em;
  color: var(--text);
}
.bubble-md .katex-display {
  display: block;
  margin: 0.85em 0;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}
.bubble-label {
  font-size: 10px;
  color: var(--muted);
  padding: 0 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.typing-bubble {
  background: var(--ai-bubble);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 14px 18px;
  display: flex;
  gap: 5px;
  align-items: center;
}
.dot-t {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.dot-t:nth-child(2) {
  animation-delay: 0.2s;
}
.dot-t:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.input-section {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.input-wrapper {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 4px 4px 14px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  transition: border-color 0.2s;
}
.input-wrapper:focus-within {
  border-color: rgba(74, 222, 128, 0.4);
}
textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  resize: none;
  line-height: 1.5;
  padding: 9px 0;
  max-height: 120px;
}
textarea::placeholder {
  color: var(--muted);
}
.send-btn {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border: none;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  color: #0a0f1e;
}
.mic-btn {
  width: 40px;
  height: 40px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.3s;
  color: var(--muted);
}
.mic-btn:hover {
  border-color: rgba(239, 68, 68, 0.5);
  color: rgba(239, 68, 68, 0.8);
}
.mic-btn.recording {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.7);
  color: rgb(239, 68, 68);
  animation: micPulse 1.5s infinite;
}
@keyframes micPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}
.mic-wave {
  width: 3px;
  height: 14px;
  background: rgba(239, 68, 68, 0.8);
  border-radius: 2px;
  animation: wave 0.8s ease-in-out infinite;
}
@keyframes wave {
  0%,
  100% {
    height: 6px;
  }
  50% {
    height: 16px;
  }
}
.send-btn:hover {
  background: #86efac;
  transform: scale(1.05);
}
.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.send-btn svg {
  width: 16px;
  height: 16px;
}
.tools-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tool-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--muted);
  font-family: var(--font-b);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tool-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ====== FAKEGUARD PANEL ====== */
#fg-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
#fg-panel.active {
  display: flex;
}

/* ====== HOMEWORK CHECK ====== */
#hw-section {
  display: none;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
#hw-section.active {
  display: flex;
}
.hw-section-card {
  background: rgba(13, 20, 38, 0.85);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: 16px;
  padding: 22px 18px;
}
.hw-section-title {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(34, 211, 238, 0.7);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hw-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 5px;
}
.hw-inp {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--font-b);
  font-size: 14px;
  border-radius: 10px;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s;
  min-height: 80px;
}
.hw-inp:focus {
  border-color: var(--accent2);
}
.hw-inp::placeholder {
  color: var(--muted);
}
.hw-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
#hw-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}
.hw-submit {
  flex: 1;
  min-width: 140px;
  padding: 13px;
  background: var(--accent2);
  border: none;
  border-radius: 10px;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 13px;
  color: #0a0f1e;
  cursor: pointer;
  transition: all 0.2s;
}
.hw-submit:hover {
  opacity: 0.88;
}
.hw-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.hw-photo {
  padding: 13px 18px;
  background: transparent;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 10px;
  color: var(--accent2);
  font-family: var(--font-b);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.hw-photo:hover {
  background: rgba(34, 211, 238, 0.08);
}
.hw-photo-drop {
  border: 1px dashed rgba(34, 211, 238, 0.3);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.hw-photo-drop:hover {
  border-color: var(--accent2);
  background: rgba(34, 211, 238, 0.04);
}
.hw-result {
  display: none;
  flex-direction: column;
  gap: 12px;
}
.hw-result.show {
  display: flex;
}
.hw-verdict {
  padding: 16px 18px;
  border-radius: 12px;
  border: 2px solid var(--border);
}
.hw-verdict-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}
.hw-verdict-title {
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}
.hw-verdict-text {
  font-size: 14px;
  line-height: 1.65;
  color: rgba(220, 232, 255, 0.8);
}
.hw-attempts {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-m);
}
.hw-attempt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.hw-attempt-dot.used {
  background: var(--accent3);
}
.hw-attempt-dot.current {
  background: var(--accent2);
}
.hw-again {
  width: 100%;
  padding: 12px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 10px;
  color: var(--accent2);
  font-family: var(--font-b);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.hw-again:hover {
  background: rgba(34, 211, 238, 0.15);
}
.hw-reveal {
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 12px;
}
.hw-reveal-label {
  font-family: var(--font-d);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.hw-reveal-body {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(220, 232, 255, 0.88);
  white-space: pre-wrap;
}
.hw-star {
  padding: 16px 18px;
  background: rgba(74, 222, 128, 0.07);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 12px;
}
.hw-star-title {
  font-family: var(--font-d);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}
.hw-star-text {
  font-size: 14px;
  line-height: 1.65;
  color: rgba(220, 232, 255, 0.8);
}
.hw-loading {
  display: none;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 20px;
}
.hw-loading.show {
  display: flex;
}

.fg-card {
  background: rgba(13, 20, 38, 0.85);
  border: 1px solid rgba(255, 0, 144, 0.15);
  border-radius: 16px;
  padding: 20px 18px;
}
.fg-title {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255, 0, 144, 0.7);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.fg-tabs {
  display: flex;
  margin-bottom: 18px;
  gap: 0;
}
.fg-tab {
  flex: 1;
  padding: 10px 0;
  font-family: var(--font-b);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255, 0, 144, 0.2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.fg-tab.on {
  background: rgba(255, 0, 144, 0.1);
  border-color: #ff0090;
  color: #ff0090;
}
.fg-tab:first-child {
  border-radius: 8px 0 0 8px;
}
.fg-tab:last-child {
  border-radius: 0 8px 8px 0;
}

.fg-inp {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 12px 14px;
  font-family: var(--font-b);
  font-size: 14px;
  border-radius: 8px;
  outline: none;
  transition: all 0.2s;
  resize: vertical;
}
.fg-inp:focus {
  border-color: #ff0090;
  box-shadow: 0 0 14px rgba(255, 0, 144, 0.12);
}
.fg-inp::placeholder {
  color: var(--muted);
}
.fg-inp-lbl {
  font-family: var(--font-m);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(255, 0, 144, 0.6);
  text-transform: uppercase;
  margin-bottom: 7px;
}

/* drop zone */
#dz {
  border: 2px dashed rgba(255, 0, 144, 0.25);
  border-radius: 11px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
#dz.over {
  border-color: #ff0090;
  background: rgba(255, 0, 144, 0.04);
}
#prv-img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 0, 144, 0.25);
}
.rm-btn-fg {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 17, 85, 0.4);
  color: var(--red);
  background: rgba(255, 17, 85, 0.05);
  cursor: pointer;
}

.fg-analyze-btn {
  width: 100%;
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #ff0090, #ff1155);
  border: none;
  border-radius: 10px;
  font-family: var(--font-d);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 30px rgba(255, 0, 144, 0.2);
}
.fg-analyze-btn:hover {
  transform: scale(1.01);
  box-shadow: 0 0 40px rgba(255, 0, 144, 0.35);
}
.fg-analyze-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* loading */
#fg-lbox {
  margin-top: 14px;
  display: none;
}
.fg-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.fg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ff0090;
  animation: tdot 1.4s ease-in-out infinite;
}
.fg-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.fg-dot:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes tdot {
  0%,
  60%,
  100% {
    transform: scale(0.8);
    opacity: 0.4;
  }
  30% {
    transform: scale(1.2);
    opacity: 1;
  }
}
.fg-lstep {
  font-size: 13px;
  font-weight: 500;
  color: #ff0090;
}
#fg-pbar-w {
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  margin-top: 10px;
}
#fg-pbar {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #ff0090, #ff1155);
  width: 0%;
  transition: width 0.3s;
}
#fg-errbox {
  display: none;
  margin-top: 12px;
  background: rgba(255, 17, 85, 0.07);
  border: 1px solid rgba(255, 17, 85, 0.3);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  color: rgba(255, 100, 130, 0.9);
}

/* results */
#fg-res {
  display: none;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
#fg-res.show {
  display: flex;
}
#vcard {
  border-radius: 16px;
  padding: 22px 18px;
  text-align: center;
  border-width: 2px;
  border-style: solid;
}
.vemoji {
  font-size: 3rem;
  margin-bottom: 8px;
}
.vtxt {
  font-family: var(--font-d);
  font-weight: 800;
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.vsub {
  font-size: 13px;
  color: rgba(220, 232, 255, 0.6);
  line-height: 1.6;
  margin-bottom: 10px;
}
.vpill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 13px;
  border-radius: 100px;
  font-family: var(--font-m);
  font-size: 11px;
}
.fg-g2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.gauge-w {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 10px auto 0;
}
.kp {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.kp-item {
  display: flex;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  border-left: 3px solid;
}
.recs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 9px;
}
.rec {
  background: rgba(13, 20, 38, 0.6);
  border: 1px solid rgba(255, 0, 144, 0.12);
  border-radius: 10px;
  padding: 12px;
}
.rec-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.rec-ico {
  font-size: 18px;
}
.rec-title {
  font-weight: 600;
  font-size: 12px;
  color: #ff0090;
  margin-bottom: 2px;
}
.rec-desc {
  font-size: 12px;
  line-height: 1.55;
  color: rgba(220, 232, 255, 0.55);
}
.fg-exp-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.fg-ebtn {
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-b);
  transition: all 0.2s;
}

/* lang toggle in fg */
.fg-lang-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.fg-lbtn {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 0, 144, 0.2);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-m);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.fg-lbtn.on {
  background: rgba(255, 0, 144, 0.1);
  border-color: #ff0090;
  color: #ff0090;
}

@media (min-width: 701px) {
  .sidebar.sidebar-fg-muted {
    opacity: 0.42;
    pointer-events: none;
  }
}

@media (max-width: 700px) {
  :root {
    --mobile-drawer-top: 108px;
  }
  .nav-burger {
    display: flex;
  }
  main {
    flex-direction: column;
    padding: 12px;
    min-height: 0;
    position: relative;
  }
  #navBackdrop {
    top: var(--mobile-drawer-top);
  }
  .sidebar {
    position: fixed;
    top: var(--mobile-drawer-top);
    left: 0;
    width: min(300px, 88vw);
    height: calc(100dvh - var(--mobile-drawer-top));
    max-height: calc(100dvh - var(--mobile-drawer-top));
    margin: 0;
    padding: 14px 14px 20px;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 6px;
    background: var(--surface);
    border-right: 1px solid rgba(74, 222, 128, 0.2);
    box-shadow: none;
    z-index: 25;
    transform: translate3d(-105%, 0, 0);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.mobile-nav-open {
    transform: translate3d(0, 0, 0);
    box-shadow: 16px 0 48px rgba(0, 0, 0, 0.45);
  }
  .sidebar .subject-btn {
    flex: none;
    min-width: 0;
    width: 100%;
  }
  .sidebar .grade-section {
    width: 100%;
    margin-top: 8px;
  }
  .sidebar .grade-dd-menu {
    top: auto;
    bottom: calc(100% + 6px);
    animation: gradeDdInMob 0.2s ease;
  }
  @keyframes gradeDdInMob {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .chat-area {
    min-height: 0;
  }
  header {
    padding-left: 12px;
    padding-right: 12px;
  }
  .header-right .alem-badge {
    display: none;
  }
}
