:root {
  --primary: #2f8c9e;
  --danger: #d21c31;
  --accent-orange: #ed7844;
  --accent-yellow: #ffb730;
  --text-main: #001f24;
  --text-muted: #8ea1a5;
  --bg-light: #fcf4ed;
  --bg-darker: #f0eae4;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg-light);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.hidden {
  display: none !important;
}

.animate-fade-in {
  animation: fade-in 0.35s ease-out;
}

.status {
  position: fixed;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  z-index: 120;
}

.status.disconnected {
  background: #eee;
  color: #666;
}

.status.connected {
  background: #e6f4ea;
  color: #1e8e3e;
}

.status.error {
  background: #fce8e6;
  color: #d93025;
}

#appRoot {
  min-height: 100vh;
}

.global-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: 64px;
  background: var(--bg-light);
  border-bottom: 1px solid #f1f1f1;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.global-header-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-columns: 128px 1fr 128px;
  align-items: center;
  padding: 0 14px;
  gap: 6px;
}

.header-slot {
  display: flex;
  align-items: center;
}

.left-slot {
  justify-content: flex-start;
  gap: 8px;
}

.center-slot {
  justify-content: center;
}

.right-slot {
  justify-content: flex-end;
  gap: 8px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  color: var(--danger);
}

.profile-icon-wrap {
  width: 30px;
  height: 30px;
  color: var(--text-muted);
}

.profile-icon-wrap svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 58px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #f1f1f1;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}

.flame {
  font-size: 13px;
}

.progress-track {
  width: 100%;
  max-width: 360px;
  height: 8px;
  background: var(--bg-darker);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: var(--danger);
  transition: width 0.8s ease;
}

.progress-divider {
  position: absolute;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(255, 255, 255, 0.45);
}

.divider-1 {
  left: 33.33%;
}

.divider-2 {
  left: 66.66%;
}

.timer-pill {
  width: 58px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #f1f1f1;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #001f24cc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.auth-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

.auth-center {
  width: 100%;
  max-width: 380px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo-box {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
  transform: rotate(5deg);
  margin-bottom: 24px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  color: #fff;
}

.brand-title {
  margin: 0 0 4px;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 0 0 30px;
  color: var(--danger);
  font-size: 24px;
  font-style: italic;
  font-weight: 700;
  text-align: center;
}

.auth-hint {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}

.auth-fields {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-fields input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}

.auth-fields input:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(210, 28, 49, 0.15);
}

.btn {
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn:hover {
  opacity: 0.95;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.btn-primary {
  background: var(--primary);
}

.btn-danger {
  background: var(--danger);
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 64px;
}

.screen-content {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px 24px;
  flex: 1;
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 26px;
}

.menu-cards {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.menu-card {
  border: 0;
  border-radius: 16px;
  background: #fff;
  min-height: 72px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  color: var(--text-main);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
}

.menu-card.primary:hover {
  outline: 2px solid rgba(210, 28, 49, 0.2);
}

.menu-card.locked {
  opacity: 0.6;
  cursor: default;
}

.arrow {
  font-size: 30px;
  line-height: 1;
  color: #d1d5db;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.level-card {
  border: 0;
  border-radius: 16px;
  background: #fff;
  min-height: 130px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.level-card:hover {
  outline: 2px solid rgba(210, 28, 49, 0.2);
}

.level-main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.level-icon {
  font-size: 26px;
  line-height: 1;
}

.level-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.level-details {
  font-size: 13px;
  color: #001f24b3;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-card {
  border: 0;
  border-radius: 16px;
  background: #fff;
  min-height: 86px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  text-align: left;
}

.module-card:hover {
  outline: 2px solid rgba(210, 28, 49, 0.2);
}

.module-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.module-badge {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #c7ccd0;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.module-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.lesson-screen {
  justify-content: flex-start;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.go-away-banner {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: #2f8c9e;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  animation: slide-down 0.6s ease-out;
}

.daily-limit-banner {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 111;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: #ffb730;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  animation: slide-down 0.6s ease-out;
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.daily-limit-text {
  flex: 0 1 auto;
}

.daily-limit-countdown {
  font-variant-numeric: tabular-nums;
}

.go-away-text {
  flex: 0 1 auto;
}

.lesson-content {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 0 16px 20px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.lesson-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 10px;
  margin-bottom: 18px;
}

.lesson-chip {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.lesson-title-wrap h2 {
  margin: 0;
  text-align: center;
  font-size: 22px;
}

.amplitude-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 6px 0 14px;
}

.amplitude-bars {
  width: 100%;
  max-width: 420px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.amplitude-bars .bar {
  width: 6px;
  height: 12px;
  border-radius: 999px;
  background: #d7dadd;
  transform-origin: center;
  transition: height 0.14s cubic-bezier(0.22, 0.61, 0.36, 1), background-color 0.18s ease, opacity 0.18s ease;
}

.amplitude-bars.idle .bar {
  background: var(--danger);
}

.amplitude-bars.ai .bar {
  background: var(--danger);
}

.amplitude-bars.user .bar {
  background: var(--accent-yellow);
}

.lesson-transcript-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.toggle-btn {
  width: 56px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--danger);
  position: relative;
  cursor: pointer;
}

.toggle-knob {
  position: absolute;
  top: 4px;
  left: 30px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s ease;
}

.toggle-knob.off {
  left: 4px;
}

.transcript-panel {
  background: #fff;
  border: 1px solid #f1f1f1;
  border-radius: 22px;
  margin-bottom: 8px;
  padding: 8px;
  height: 320px !important;
  overflow: hidden;
  position: relative;
}

#lessonMainBtn {
  margin-top: auto;
  margin-bottom: 2px;
}

.chat-log {
  height: 100%;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transcript-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-yellow);
  pointer-events: none;
}

.transcript-panel.transcript-muted .chat-log {
  visibility: hidden;
}

.transcript-panel.transcript-muted .transcript-placeholder {
  display: flex;
}

.message {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 16px;
  word-break: break-word;
}

.message.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
}

.message.gemini {
  align-self: flex-start;
  background: var(--bg-darker);
  color: var(--text-main);
}

.session-end-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 14px;
}

.session-end-section h2 {
  margin: 0;
  font-size: 28px;
}

.app-footer {
  margin-top: auto;
  padding: 10px 12px 14px;
  text-align: center;
  opacity: 0.7;
}

.stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.star {
  width: 10px;
  height: 10px;
}

.star-yellow {
  fill: var(--accent-yellow);
}

.star-orange {
  fill: var(--accent-orange);
}

.star-red {
  fill: var(--danger);
}

.copyright {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 1024px) {
  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 768px) {
  .global-header-inner {
    grid-template-columns: 116px 1fr 116px;
    padding: 0 8px;
  }

  .brand-title {
    font-size: 34px;
  }

  .brand-subtitle {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .logo-box {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
  }

  .btn {
    font-size: 18px;
  }

  .menu-card {
    min-height: 66px;
    font-size: 18px;
  }

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

  .module-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .module-card {
    min-height: 74px;
    padding: 12px 14px;
  }

  .module-badge {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .module-name {
    font-size: 16px;
  }

  .screen-content {
    padding: 10px 14px 18px;
  }

  .lesson-content {
    min-height: 0;
  }

  .transcript-panel {
    height: 280px !important;
  }
}

@media (max-width: 380px) {
  .module-card {
    padding: 10px 12px;
  }

  .module-main {
    gap: 8px;
  }

  .module-name {
    font-size: 15px;
  }
}
