:root {
  --bg: #07101d;
  --panel: rgba(255, 255, 255, 0.105);
  --panel-soft: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.18);
  --text: #f4fbff;
  --muted: #b6c4d5;
  --neon: #62d8ff;
  --mint: #9ef8d4;
  --violet: #b7a8ff;
  --glass-shadow: 0 30px 110px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --danger: #ff8aa0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(120, 190, 255, 0.24), transparent 26%),
    radial-gradient(circle at 88% 14%, rgba(183, 168, 255, 0.18), transparent 24%),
    radial-gradient(circle at 50% 88%, rgba(158, 248, 212, 0.1), transparent 30%),
    linear-gradient(135deg, #060b14 0%, #101a2a 48%, #15142c 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  min-height: 100vh;
  padding: 28px;
}

.center-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.glass {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(26px) saturate(1.35);
  position: relative;
  overflow: hidden;
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0.02) 32%, transparent 65%),
    radial-gradient(circle at 22% 0%, rgba(255,255,255,0.14), transparent 34%);
}

.auth-card {
  width: min(430px, 100%);
  border-radius: 26px;
  padding: 28px;
}

.eyebrow {
  margin: 0;
  color: var(--neon);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.auth-card h1,
.dashboard-header h1 {
  margin: 12px 0 8px;
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.field span {
  color: #c9d7e7;
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  outline: none;
  padding: 14px 16px;
}

input:focus {
  border-color: rgba(57, 213, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(57, 213, 255, 0.24);
}

.primary,
.ghost,
.danger {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 800;
}

.primary {
  background: var(--neon);
  color: #071321;
}

.primary:hover {
  background: var(--mint);
}

.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.danger {
  border-color: rgba(255, 138, 160, 0.28);
  background: rgba(255, 75, 110, 0.12);
  color: #ffd8df;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--neon);
  font-weight: 800;
}

.error {
  border-radius: 14px;
  background: rgba(255, 75, 110, 0.12);
  color: #ffd8df;
  padding: 12px 14px;
}

.dashboard {
  display: grid;
  gap: 22px;
  max-width: 1240px;
  margin: 0 auto;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 22px;
}

.sidebar,
.main-panel,
.chat-panel {
  border-radius: 26px;
  padding: 18px;
}

.language-list {
  display: grid;
  gap: 10px;
}

.language-item,
.language-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055));
  color: white;
  padding: 16px;
  position: relative;
  overflow: hidden;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.language-item::before,
.language-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 12%, var(--accent, rgba(98, 216, 255, 0.24)), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 64%);
  pointer-events: none;
}

.language-item > *,
.language-card > * {
  position: relative;
  z-index: 1;
}

.language-item[data-lang="english"],
.language-card[data-lang="english"] {
  --accent: rgba(98, 216, 255, 0.38);
}

.language-item[data-lang="uzbek"],
.language-card[data-lang="uzbek"] {
  --accent: rgba(158, 248, 212, 0.34);
}

.language-item[data-lang="russian"],
.language-card[data-lang="russian"] {
  --accent: rgba(183, 168, 255, 0.34);
}

.language-item[data-lang="japanese"],
.language-card[data-lang="japanese"] {
  --accent: rgba(255, 138, 160, 0.28);
}

.language-item[data-lang="korean"],
.language-card[data-lang="korean"] {
  --accent: rgba(137, 216, 255, 0.3);
}

.language-item[data-lang="german"],
.language-card[data-lang="german"] {
  --accent: rgba(255, 214, 137, 0.26);
}

.language-item[data-lang="turkish"],
.language-card[data-lang="turkish"] {
  --accent: rgba(112, 177, 255, 0.32);
}

.language-item[data-lang="arabic"],
.language-card[data-lang="arabic"] {
  --accent: rgba(158, 248, 212, 0.26);
}

.language-item:hover,
.language-card:hover {
  border-color: rgba(57, 213, 255, 0.55);
  box-shadow: 0 14px 40px rgba(11, 22, 38, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.language-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.language-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--neon);
  font-size: 12px;
  font-weight: 900;
}

.language-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.language-copy strong {
  line-height: 1.15;
}

.language-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.language-arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(98, 216, 255, 0.22);
  border-radius: 10px;
  background: rgba(98, 216, 255, 0.1);
}

.language-arrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--neon);
  border-bottom: 2px solid var(--neon);
  transform: rotate(-45deg);
}

.language-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 6px 9px;
  text-transform: uppercase;
}

.lesson-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 22px;
  max-width: 1240px;
  margin: 0 auto;
}

.lesson-stage {
  min-height: calc(100vh - 56px);
  border-radius: 28px;
  padding: 22px;
}

.lesson-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  padding: 10px 14px;
  font-weight: 800;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.listening {
  background: var(--mint);
}

.dot.thinking {
  background: var(--violet);
}

.dot.speaking {
  background: var(--neon);
}

.lesson-canvas {
  display: grid;
  grid-template-columns: 190px minmax(300px, 1fr) 190px;
  align-items: center;
  gap: 18px;
  min-height: 520px;
  padding: 16px 0 8px;
}

.side-actions {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.pill-action {
  width: min(180px, 100%);
  min-height: 58px;
  border: 1px solid rgba(98, 216, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #dff7ff;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 0 26px rgba(98,216,255,0.11);
}

.pill-action:hover {
  border-color: rgba(98, 216, 255, 0.7);
  background: rgba(98, 216, 255, 0.12);
}

.primary-action {
  background: rgba(98, 216, 255, 0.14);
}

.danger-action {
  border-color: rgba(255, 138, 160, 0.34);
  color: #ffdce3;
}

.robot-hero {
  display: grid;
  justify-items: center;
  gap: 28px;
}

.robot-shell {
  position: relative;
  width: min(380px, 84vw);
  height: 360px;
  filter: drop-shadow(0 0 34px rgba(98, 216, 255, 0.18));
}

.robot-head-line {
  position: absolute;
  left: 50%;
  top: 16px;
  width: 220px;
  height: 150px;
  transform: translateX(-50%);
  border: 3px solid rgba(98, 216, 255, 0.9);
  border-bottom-color: rgba(98, 216, 255, 0.65);
  border-radius: 72px 72px 38px 38px;
  background: rgba(4, 10, 20, 0.3);
  box-shadow: 0 0 38px rgba(98, 216, 255, 0.2), inset 0 0 34px rgba(98,216,255,0.04);
}

.robot-brow {
  position: absolute;
  left: 48px;
  top: 44px;
  width: 124px;
  height: 22px;
  border-top: 3px solid rgba(98, 216, 255, 0.68);
  border-radius: 50%;
}

.robot-visor {
  position: absolute;
  left: 50%;
  top: 70px;
  display: flex;
  gap: 36px;
  transform: translateX(-50%);
}

.robot-eye {
  width: 44px;
  height: 14px;
  border-radius: 5px;
  background: var(--neon);
  box-shadow: 0 0 18px rgba(98, 216, 255, 0.9);
  animation: blink 4s infinite;
}

.robot-hero.speaking .robot-eye {
  animation: eyeTalk 0.7s ease-in-out infinite;
}

.robot-mouth {
  position: absolute;
  left: 50%;
  top: 106px;
  width: 132px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(98, 216, 255, 0.74);
  box-shadow: 0 0 12px rgba(98,216,255,0.45);
}

.robot-hero.speaking .robot-mouth {
  height: 16px;
  width: 78px;
  top: 100px;
  animation: mouthTalk 0.28s ease-in-out infinite;
}

.robot-neck {
  position: absolute;
  left: 50%;
  top: 166px;
  width: 72px;
  height: 72px;
  transform: translateX(-50%);
  border: 3px solid rgba(98, 216, 255, 0.78);
  background: rgba(7, 19, 33, 0.62);
}

.robot-body-line {
  position: absolute;
  left: 50%;
  top: 230px;
  width: 300px;
  height: 128px;
  transform: translateX(-50%);
  border-top: 4px solid rgba(98, 216, 255, 0.88);
}

.body-line {
  position: absolute;
  top: 8px;
  width: 112px;
  height: 94px;
  border-top: 3px solid rgba(98, 216, 255, 0.72);
}

.body-line-left {
  left: 0;
  transform: skewX(-18deg);
  border-left: 3px solid rgba(98, 216, 255, 0.54);
}

.body-line-right {
  right: 0;
  transform: skewX(18deg);
  border-right: 3px solid rgba(98, 216, 255, 0.54);
}

.robot-core {
  position: absolute;
  left: 50%;
  top: -2px;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  transform: translateX(-50%);
  border: 4px solid rgba(98, 216, 255, 0.95);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(98,216,255,0.18), rgba(5,13,26,0.78));
  color: white;
  font-weight: 900;
  letter-spacing: 0.28em;
  box-shadow: 0 0 34px rgba(98, 216, 255, 0.38);
}

.robot-hero.listening .robot-core,
.robot-hero.listening .robot-head-line {
  animation: glowPulse 1.6s ease-in-out infinite;
}

.body-mid,
.body-low {
  position: absolute;
  left: 50%;
  width: 120px;
  transform: translateX(-50%);
  border-top: 3px solid rgba(98, 216, 255, 0.58);
}

.body-mid {
  top: 74px;
}

.body-low {
  top: 112px;
  width: 160px;
}

.stage-status {
  display: grid;
  gap: 10px;
  text-align: center;
}

.stage-status strong {
  font-size: 24px;
  letter-spacing: 0.36em;
}

.stage-status span {
  color: var(--muted);
  letter-spacing: 0.08em;
}

.board {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.085);
  padding: 16px;
}

.board-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.board-grid h2 {
  margin-bottom: 0;
}

.board-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--neon);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.board-grid p {
  margin-bottom: 0;
  color: #edf8ff;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 56px);
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 8px 0;
}

.msg {
  max-width: 88%;
  border-radius: 18px;
  padding: 12px 14px;
  line-height: 1.45;
}

.msg.user {
  align-self: flex-end;
  background: var(--neon);
  color: #071321;
}

.msg.assistant,
.msg.system {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.1);
}

.chat-form {
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

@keyframes blink {
  0%,
  92%,
  100% {
    transform: scaleY(1);
  }
  95% {
    transform: scaleY(0.12);
  }
}

@keyframes mouthTalk {
  0%,
  100% {
    height: 10px;
  }
  50% {
    height: 25px;
  }
}

@keyframes eyeTalk {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(3px);
  }
}

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

@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 0 34px rgba(57, 213, 255, 0.28);
  }
  50% {
    box-shadow: 0 0 78px rgba(57, 213, 255, 0.56);
  }
}

@media (max-width: 980px) {
  .dashboard-grid,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .language-card-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: repeat(2, 1fr);
  }

  .lesson-canvas {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .side-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .side-left {
    order: 2;
  }

  .robot-hero {
    order: 1;
  }

  .side-right {
    order: 3;
  }

  .pill-action {
    width: 100%;
  }

  .board-grid {
    grid-template-columns: 1fr;
  }

  .chat-panel,
  .lesson-stage {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 50% 0%, rgba(98, 216, 255, 0.22), transparent 34%),
      linear-gradient(180deg, #070d18 0%, #111a2b 58%, #15142c 100%);
  }

  .page {
    padding: 10px;
    min-height: auto;
  }

  .glass {
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(1.25);
  }

  .dashboard,
  .lesson-grid {
    gap: 10px;
  }

  .dashboard {
    min-height: auto;
  }

  .dashboard-header {
    padding: 0 2px;
  }

  .dashboard-header h1 {
    margin: 0;
    font-size: 27px;
    letter-spacing: 0.01em;
  }

  .dashboard-header .ghost {
    min-height: 40px;
    border-radius: 14px;
    padding: 9px 14px;
    font-size: 13px;
  }

  .dashboard-grid {
    gap: 10px;
  }

  .sidebar {
    border-radius: 24px;
    padding: 12px;
    background:
      radial-gradient(circle at 14% 0%, rgba(98, 216, 255, 0.16), transparent 34%),
      linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.055));
  }

  .sidebar .eyebrow {
    margin-bottom: 12px;
    padding: 0 2px;
  }

  .main-panel {
    display: none;
  }

  .language-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .language-item {
    grid-template-columns: 1fr;
    align-content: space-between;
    gap: 12px;
    min-height: 128px;
    border-radius: 20px;
    padding: 12px;
    background:
      radial-gradient(circle at 90% 8%, var(--accent, rgba(98, 216, 255, 0.22)), transparent 36%),
      linear-gradient(150deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.055));
  }

  .language-index {
    width: 34px;
    height: 30px;
    border-radius: 10px;
    font-size: 11px;
  }

  .language-copy {
    padding-right: 24px;
  }

  .language-copy strong {
    font-size: 16px;
  }

  .language-copy small {
    display: block;
    margin-top: 4px;
    overflow: visible;
    color: #d2ddec;
    font-size: 12px;
    white-space: normal;
  }

  .language-item .badge {
    display: none;
  }

  .language-arrow {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 30px;
    height: 30px;
    border-radius: 11px;
    background: rgba(98, 216, 255, 0.12);
  }

  .lesson-grid {
    display: flex;
    flex-direction: column;
  }

  .lesson-stage,
  .chat-panel {
    border-radius: 20px;
    padding: 12px;
  }

  .lesson-top {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .lesson-top h1 {
    margin: 4px 0 0;
    font-size: 22px;
    line-height: 1.08;
  }

  .status {
    flex-shrink: 0;
    gap: 7px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .lesson-canvas {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 8px 0 10px;
  }

  .robot-hero {
    gap: 10px;
  }

  .side-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .side-left {
    order: 2;
  }

  .side-right {
    order: 3;
  }

  .pill-action {
    min-height: 46px;
    border-radius: 14px;
    font-size: 12px;
    letter-spacing: 0.08em;
    padding: 0 10px;
  }

  .board {
    border-radius: 16px;
    padding: 12px;
  }

  .board-grid {
    gap: 10px;
  }

  .board-grid h2 {
    font-size: 17px;
    line-height: 1.2;
  }

  .board-grid p {
    font-size: 13px;
    line-height: 1.45;
  }

  .chat-panel {
    min-height: 420px;
    max-height: 68vh;
  }

  .chat-panel h2 {
    margin-bottom: 8px;
    font-size: 22px;
  }

  .messages {
    min-height: 230px;
    padding: 4px 0 10px;
  }

  .msg {
    max-width: 92%;
    border-radius: 15px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.42;
  }

  .chat-form {
    gap: 8px;
    padding-top: 10px;
  }

  .chat-form input {
    min-height: 46px;
    border-radius: 14px;
    padding: 10px 12px;
  }

  .chat-form button {
    min-width: 70px;
    min-height: 46px;
    border-radius: 14px;
    padding: 0 12px;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 8px;
  }

  .dashboard-header,
  .lesson-top {
    align-items: center;
    flex-direction: row;
  }

  .language-list {
    gap: 8px;
  }

  .language-item {
    min-height: 116px;
    padding: 11px;
  }

  .language-copy strong {
    font-size: 15px;
  }

  .language-copy small {
    font-size: 11px;
  }

  .robot-shell {
    width: min(280px, 88vw);
    height: 250px;
  }

  .robot-head-line {
    top: 4px;
    width: 164px;
    height: 112px;
    border-width: 2px;
    border-radius: 54px 54px 28px 28px;
  }

  .robot-brow {
    left: 36px;
    top: 32px;
    width: 92px;
    height: 16px;
    border-top-width: 2px;
  }

  .robot-visor {
    top: 52px;
    gap: 24px;
  }

  .robot-eye {
    width: 32px;
    height: 10px;
  }

  .robot-mouth {
    top: 82px;
    width: 96px;
  }

  .robot-hero.speaking .robot-mouth {
    top: 76px;
    width: 58px;
    height: 13px;
  }

  .robot-neck {
    top: 116px;
    width: 52px;
    height: 58px;
    border-width: 2px;
  }

  .robot-body-line {
    top: 174px;
    width: 226px;
    height: 82px;
    border-top-width: 3px;
  }

  .body-line {
    width: 80px;
    height: 64px;
    border-top-width: 2px;
  }

  .body-line-left {
    border-left-width: 2px;
  }

  .body-line-right {
    border-right-width: 2px;
  }

  .robot-core {
    top: -7px;
    width: 82px;
    height: 82px;
    border-width: 3px;
    font-size: 10px;
    letter-spacing: 0.2em;
  }

  .body-mid {
    top: 52px;
    width: 90px;
  }

  .body-low {
    top: 78px;
    width: 124px;
  }

  .stage-status {
    gap: 5px;
  }

  .stage-status strong {
    font-size: 16px;
    letter-spacing: 0.22em;
  }

  .stage-status span {
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.16em;
  }
}
