:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --text: #22201e;
  --muted: #7f7f7f;
  --border: #ece9e3;
  --soft: #f7f6f3;
  --accent: #ff5b4d;
  --accent-dark: #ee4a3c;
  --accent-soft: #ffe7e2;
  --bot-msg: #f1ece4;
  --bot-border: #e7ddcf;
  --user-msg: #94724e;
  --user-border: #7f6446;
  --radius-card: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(33, 27, 20, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  width: min(100%, 390px);
  margin: 0 auto;
  padding: 10px 0 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 12px;
}

.avatar-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
}

.topbar__title {
  font-weight: 500;
}

.ui-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 12px;
}

.tab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--soft);
  color: #6c6c6c;
  border-radius: 10px;
  font-size: 12px;
  padding: 8px 10px;
}

.tab-btn--active {
  background: #fff;
  color: #202020;
  font-weight: 600;
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 14px;
  background: #e8e7e3;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.lesson-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
}

.lesson-subtitle {
  margin: 6px 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.meta-list {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.meta-item {
  border-left: 2px solid #efede8;
  padding-left: 10px;
  font-size: 13px;
  color: #636363;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.quick-action {
  border: 1px solid #eee6d8;
  border-radius: 10px;
  background: #fbf8f2;
  color: #635a4f;
  font-size: 12px;
  padding: 8px 10px;
  text-align: left;
}

.ui-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.ui-accordion {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.ui-accordion summary {
  list-style: none;
  cursor: pointer;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
}

.ui-accordion summary::-webkit-details-marker {
  display: none;
}

.ui-accordion__body {
  border-top: 1px solid #f0ede8;
  padding: 10px 12px 12px;
  color: #6b6b6b;
  font-size: 13px;
  line-height: 1.45;
}

.chat-card {
  padding: 0;
  overflow: hidden;
}

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #ece3d6;
  background: #f9f7f3;
}

.chat-head strong {
  font-size: 14px;
}

.chat-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #e9e5df;
  background: #fff;
  color: #6b6b6b;
  font-size: 11px;
}

.chat-app {
  display: grid;
  grid-template-rows: 1fr auto auto;
  height: 380px;
}

.chat-messages {
  background: #fff;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.msg {
  max-width: min(82%, 290px);
  width: fit-content;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg--bot {
  background: var(--bot-msg);
  border: 1px solid var(--bot-border);
  color: #312b23;
  align-self: flex-start;
}

.msg--user {
  background: var(--user-msg);
  border: 1px solid var(--user-border);
  color: #fff;
  align-self: flex-end;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid #ece3d6;
}

.chat-input {
  border: 1px solid #dfd5c8;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  outline: none;
}

.chat-input:focus {
  border-color: #bca082;
}

.chat-send {
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
}

.chat-send:disabled {
  opacity: 0.7;
}

.chat-error {
  display: none;
  border-top: 1px solid #f3c3bb;
  background: var(--accent-soft);
  color: #a73525;
  padding: 7px 10px;
  font-size: 12px;
}

.bottom-cta {
  position: sticky;
  bottom: 8px;
  background: rgba(244, 244, 242, 0.95);
  backdrop-filter: blur(4px);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
}

.price {
  font-weight: 700;
  font-size: 14px;
  color: #5a5a5a;
}

.ui-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  padding: 10px 12px;
  cursor: pointer;
}

.ui-btn--primary {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
  font-weight: 700;
}

.ui-btn--outline {
  grid-column: 1 / -1;
  background: #fff;
  border-color: #f1c8c1;
  color: var(--accent-dark);
}

.ui-btn--ghost {
  background: #fff;
  border-color: var(--border);
  color: #666;
}

.ui-btn--small {
  padding: 7px 10px;
  font-size: 12px;
}

.ui-btn--full {
  width: 100%;
  margin-top: 8px;
}

.auth-bg {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-shell {
  width: min(100%, 390px);
}

.auth-card {
  padding: 18px;
}

.auth-logo {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.auth-title {
  margin: 0 0 4px;
  font-size: 24px;
}

.auth-subtitle {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.ui-label {
  font-size: 12px;
  color: #5e5e5e;
}

.ui-input {
  width: 100%;
  border: 1px solid #dbd7d0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.ui-alert {
  border: 1px solid #f2c2b9;
  background: #ffe9e5;
  color: #a73525;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 12px;
  font-size: 12px;
}

@media (min-width: 700px) {
  .page,
  .auth-shell {
    width: min(100%, 560px);
  }

  .page {
    padding: 10px 10px 22px;
  }

  .chat-app {
    height: 420px;
  }

  .msg {
    max-width: min(80%, 420px);
  }
}
