:root {
  --bg: #f4efe6;
  --bg-strong: #e5d4b7;
  --panel: #fffaf2;
  --line: #d3c3a6;
  --text: #2f2618;
  --muted: #72644c;
  --accent: #bc5b2c;
  --accent-strong: #93421d;
  --user-bubble: #f4e4d1;
  --assistant-bubble: #fdf7ee;
  --shadow: 0 18px 50px rgba(74, 48, 17, 0.12);
  --radius: 18px;
  --yilla-avatar-url: none;
  --font-body: "Avenir Next", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-display: "Georgia", "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(188, 91, 44, 0.18), transparent 30%),
    linear-gradient(180deg, #f7f1e8 0%, #f0e4cf 100%);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  min-height: 100vh;
}

@supports (min-height: 100svh) {
  body {
    min-height: 100svh;
  }
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 32px;
}

.card-panel {
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(114, 100, 76, 0.18);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.local-shell {
  display: grid;
  gap: 18px;
}

.teacher-showcase {
  background:
    radial-gradient(circle at top right, rgba(188, 91, 44, 0.16), transparent 38%),
    rgba(255, 250, 242, 0.92);
}

.teacher-badge {
  display: flex;
  align-items: center;
  gap: 16px;
}

.teacher-badge-soft {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid rgba(188, 91, 44, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 245, 234, 0.96), rgba(255, 250, 242, 0.82));
  box-shadow: 0 14px 32px rgba(147, 66, 29, 0.08);
}

.teacher-badge-hero {
  align-items: stretch;
}

.teacher-badge-inline {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 20px;
  border: 1px solid rgba(188, 91, 44, 0.16);
  background: rgba(255, 247, 235, 0.8);
}

.teacher-avatar {
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  border-radius: 50%;
  padding: 5px;
  background:
    linear-gradient(145deg, rgba(255, 246, 236, 0.96), rgba(233, 210, 182, 0.9));
  box-shadow:
    0 14px 28px rgba(148, 69, 31, 0.14),
    inset 0 0 0 1px rgba(188, 91, 44, 0.18);
}

.teacher-avatar-large {
  width: 104px;
  height: 104px;
  flex-basis: 104px;
}

.teacher-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #fff8f1;
}

.teacher-copy {
  display: grid;
  gap: 4px;
}

.teacher-copy strong,
.teacher-copy h2 {
  margin: 0;
  color: #7d2718;
  font-family: var(--font-display);
}

.teacher-copy p {
  margin: 0;
  color: #6f5a43;
  line-height: 1.55;
  font-size: 14px;
}

.teacher-kicker {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(188, 91, 44, 0.12);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.local-teacher-card {
  margin: 16px 0 4px;
}

.local-setup,
.local-chat-header,
.local-context,
.local-messages,
.local-composer {
  padding: 24px;
}

.local-eyebrow {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(188, 91, 44, 0.12);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.local-title,
.local-chat-title {
  margin: 16px 0 10px;
  font-family: var(--font-display);
}

.local-title {
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1;
}

.local-subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.8;
}

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

.article-input {
  min-height: 220px;
}

.local-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.local-chat {
  display: grid;
  gap: 18px;
}

.local-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.local-context h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
}

.local-context-text {
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.8;
  color: var(--muted);
}

.local-messages {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  display: grid;
  gap: 16px;
  align-content: start;
}

.local-composer {
  display: grid;
  gap: 12px;
}

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

.home-hero {
  min-height: calc(100vh - 80px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: center;
}

.home-copy {
  padding: 28px 4px;
}

.home-eyebrow,
.feature-kicker {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(188, 91, 44, 0.12);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-copy h1 {
  margin: 18px 0 18px;
  font-family: var(--font-display);
  font-size: clamp(46px, 7vw, 78px);
  line-height: 0.96;
}

.home-lead {
  font-size: 20px;
  line-height: 1.7;
  color: #4a3d2a;
}

.home-copy p {
  color: var(--muted);
  line-height: 1.8;
}

.home-actions {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.home-link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.home-panel,
.home-grid {
  display: grid;
  gap: 18px;
}

.feature-card {
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(114, 100, 76, 0.18);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.feature-card h2 {
  margin: 16px 0 12px;
  font-family: var(--font-display);
  font-size: 28px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.home-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 12px 0 28px;
}

.auth-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  border: 1px solid rgba(114, 100, 76, 0.18);
  background: rgba(255, 250, 242, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  border-radius: 28px;
  overflow: hidden;
}

.auth-brand {
  padding: 48px 42px;
  background:
    linear-gradient(140deg, rgba(188, 91, 44, 0.18), rgba(255, 250, 242, 0.3)),
    linear-gradient(180deg, rgba(229, 212, 183, 0.62), rgba(255, 250, 242, 0.9));
}

.auth-brand h1 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1.05;
}

.auth-brand p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.auth-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.auth-badge {
  border: 1px solid rgba(147, 66, 29, 0.18);
  background: rgba(255, 250, 242, 0.7);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent-strong);
}

.auth-form-wrap {
  padding: 42px 34px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
}

.tabs {
  display: inline-flex;
  background: #efe4d4;
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
}

.tab-btn {
  border: 0;
  background: transparent;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.tab-btn.active {
  background: #fff7eb;
  color: var(--text);
  box-shadow: 0 6px 18px rgba(74, 48, 17, 0.1);
}

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

.auth-form.hidden,
.hidden {
  display: none !important;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 251, 245, 0.96);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(188, 91, 44, 0.12);
}

button {
  border: 0;
  cursor: pointer;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
}

.primary-btn {
  color: #fff8f1;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

.secondary-btn {
  color: var(--text);
  background: #eadcc6;
}

.ghost-btn {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}

.danger-btn {
  color: #fff8f1;
  background: #8f3e2a;
}

.auth-note,
.status-line,
.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.error-box {
  background: rgba(143, 62, 42, 0.08);
  color: #7c2f1d;
  border: 1px solid rgba(143, 62, 42, 0.18);
  border-radius: 14px;
  padding: 12px 14px;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  min-height: calc(100vh - 56px);
}

.sidebar,
.main-panel {
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(114, 100, 76, 0.18);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar {
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 18px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 30px;
  margin: 0 0 6px;
}

.brand-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.conversation-list {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
}

.conversation-item {
  width: 100%;
  text-align: left;
  padding: 14px;
  background: rgba(255, 247, 235, 0.9);
  border: 1px solid transparent;
  border-radius: 16px;
}

.conversation-item.active {
  border-color: rgba(188, 91, 44, 0.4);
  background: rgba(244, 228, 209, 0.95);
}

.conversation-item-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.conversation-item-time {
  font-size: 12px;
  color: var(--muted);
}

.sidebar-footer {
  display: grid;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: #efe2cc;
  color: var(--text);
  width: fit-content;
}

.main-panel {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
}

.panel-header {
  padding: 24px 26px 18px;
  border-bottom: 1px solid rgba(211, 195, 166, 0.55);
}

.panel-title {
  margin: 0;
  font-size: 24px;
  font-family: var(--font-display);
}

.panel-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.original-box {
  padding: 18px 26px;
  border-bottom: 1px solid rgba(211, 195, 166, 0.55);
  display: grid;
  gap: 12px;
}

.original-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.messages {
  padding: 24px 26px;
  overflow: auto;
  display: grid;
  gap: 16px;
  align-content: start;
}

.message {
  display: grid;
  gap: 8px;
  max-width: min(760px, 100%);
}

.message.user {
  margin-left: auto;
}

.message-role {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.message.assistant .message-role {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 700;
  color: #7d2718;
}

.message.assistant .message-role::before {
  content: "";
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-image: var(--yilla-avatar-url);
  background-size: cover;
  background-position: center;
  background-color: #fff8f1;
  border: 2px solid rgba(188, 91, 44, 0.16);
  box-shadow: 0 8px 18px rgba(148, 69, 31, 0.12);
}

.message-bubble {
  border-radius: var(--radius);
  padding: 14px 16px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.message.assistant .message-bubble {
  background: var(--assistant-bubble);
  border: 1px solid rgba(211, 195, 166, 0.65);
}

.message.user .message-bubble {
  background: var(--user-bubble);
  border: 1px solid rgba(188, 91, 44, 0.18);
}

.composer {
  padding: 18px 26px 24px;
  border-top: 1px solid rgba(211, 195, 166, 0.55);
  display: grid;
  gap: 12px;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.small {
  font-size: 12px;
}

@media (max-width: 920px) {
  .setup-grid,
  .local-chat-header,
  .home-hero,
  .auth-card {
    grid-template-columns: 1fr;
  }

  .home-grid,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .local-chat-header {
    display: grid;
  }

  .teacher-badge,
  .teacher-badge-hero {
    align-items: flex-start;
  }

  .teacher-avatar-large {
    width: 88px;
    height: 88px;
    flex-basis: 88px;
  }

  .sidebar {
    grid-template-rows: auto auto auto auto;
  }
}

@media (max-width: 640px) {
  html,
  body,
  input,
  textarea,
  button {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  .teacher-badge,
  .teacher-badge-hero,
  .teacher-badge-soft {
    display: grid;
  }

  .teacher-avatar,
  .teacher-avatar-large {
    margin: 0 auto;
  }

  .teacher-copy {
    justify-items: center;
    text-align: center;
  }
}

/* Yilla local tutoring experience */
.yilla-local-page {
  --bg: #fff9ef;
  --panel: #fffdf8;
  --line: #ead4bf;
  --text: #372116;
  --muted: #725f52;
  --accent: #9f2027;
  --accent-strong: #73141a;
  --user-bubble: #8f1720;
  --assistant-bubble: #fff8eb;
  --shadow: 0 22px 54px rgba(94, 39, 22, 0.13);
  --radius: 20px;
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at 7% 8%, rgba(239, 167, 51, 0.18), transparent 19%),
    radial-gradient(circle at 92% 20%, rgba(226, 110, 85, 0.19), transparent 25%),
    linear-gradient(180deg, #fffaf2 0%, #f8ead6 52%, #fff9ef 100%);
}

@supports (min-height: 100svh) {
  .yilla-local-page {
    min-height: 100svh;
  }
}

.yilla-local-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.25;
  background-image: radial-gradient(rgba(143, 23, 32, 0.18) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
  pointer-events: none;
}

.yilla-local-page .shell {
  max-width: 1320px;
}

.yilla-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 20px;
  padding-bottom: 16px;
}

.yilla-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yilla-brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #fff8ee;
  border-radius: 16px;
  background: linear-gradient(145deg, #8f1720, #e26e55);
  box-shadow: 0 8px 20px rgba(143, 23, 32, 0.22);
  font-size: 21px;
}

.yilla-brand strong,
.yilla-brand span {
  display: block;
}

.yilla-brand strong {
  font-family: var(--font-display);
  font-size: 21px;
}

.yilla-brand div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.yilla-top-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: #73141a;
  border: 1px solid rgba(143, 23, 32, 0.13);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.75);
  font-size: 13px;
  font-weight: 700;
}

.yilla-main {
  padding-top: 8px;
}

.yilla-setup-panel {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(560px, 1.12fr) minmax(500px, 0.88fr);
  min-height: calc(100vh - 125px);
  padding: 0;
  border: 1px solid rgba(143, 23, 32, 0.13);
  border-radius: 36px;
  background: rgba(255, 252, 246, 0.91);
  box-shadow: 0 30px 70px rgba(94, 39, 22, 0.16);
  backdrop-filter: blur(14px);
}

.yilla-poster-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 0;
  flex-direction: column;
  background: linear-gradient(145deg, #ffe1c8, #fff4df);
}

.yilla-poster-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset -28px 0 45px rgba(89, 38, 20, 0.06);
}

.yilla-poster-image {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.yilla-poster-sticker {
  position: absolute;
  top: 26px;
  right: 22px;
  z-index: 1;
  padding: 12px 16px;
  color: #73141a;
  border: 2px solid rgba(239, 167, 51, 0.34);
  border-radius: 18px;
  background: #fff7d8;
  box-shadow: 0 12px 30px rgba(94, 39, 22, 0.13);
  font-weight: 900;
  transform: rotate(5deg);
}

.yilla-poster-caption {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  margin: auto 24px 24px;
  padding: 18px 20px;
  color: #73141a;
  border: 1px solid rgba(143, 23, 32, 0.11);
  border-radius: 21px;
  background: rgba(255, 252, 246, 0.78);
  box-shadow: 0 12px 28px rgba(94, 39, 22, 0.08);
  text-align: center;
  backdrop-filter: blur(10px);
}

.yilla-poster-caption strong {
  font-family: var(--font-display);
  font-size: 22px;
}

.yilla-poster-caption span {
  color: var(--muted);
  font-size: 12px;
}

.yilla-entry-panel {
  align-self: center;
  padding: clamp(34px, 5vw, 66px);
}

.yilla-local-page .local-eyebrow {
  align-items: center;
  gap: 8px;
  color: #73141a;
  background: rgba(226, 110, 85, 0.13);
}

.yilla-local-page .local-title {
  margin: 20px 0 18px;
  color: #372116;
  font-size: clamp(45px, 5.8vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.yilla-local-page .local-title em {
  position: relative;
  color: #8f1720;
  font-style: normal;
}

.yilla-local-page .local-title em::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 9px;
  border-top: 4px solid #efa733;
  border-radius: 50%;
  transform: rotate(-1deg);
}

.yilla-local-page .local-subtitle {
  max-width: 700px;
  margin-bottom: 20px;
  color: #594338;
  font-size: 17px;
  line-height: 1.75;
}

.yilla-mini-bio {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 15px;
  align-items: center;
  margin: 18px 0 15px;
  padding: 13px 15px;
  border: 1px solid rgba(143, 23, 32, 0.1);
  border-radius: 22px;
  background: linear-gradient(135deg, #fff7e8, #ffead9);
}

.yilla-mini-avatar {
  overflow: hidden;
  width: 74px;
  height: 74px;
  border: 4px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  background: #fff8ef;
  box-shadow: 0 10px 22px rgba(94, 39, 22, 0.11);
}

.yilla-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yilla-mini-bio strong {
  color: #73141a;
  font-family: var(--font-display);
  font-size: 20px;
}

.yilla-mini-bio p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.yilla-principles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.yilla-principles span {
  padding: 7px 10px;
  color: #685146;
  border: 1px solid rgba(143, 23, 32, 0.09);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.84);
  font-size: 12px;
  font-weight: 700;
}

.yilla-form-card {
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid rgba(143, 23, 32, 0.12);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.93);
  box-shadow: 0 18px 42px rgba(94, 39, 22, 0.1);
}

.yilla-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}

.yilla-form-heading span {
  color: #9f2027;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.yilla-form-heading h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 25px;
}

.yilla-form-heading .yilla-form-heart {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  border-radius: 15px;
  background: linear-gradient(145deg, #8f1720, #e26e55);
  box-shadow: 0 9px 20px rgba(143, 23, 32, 0.19);
  font-size: 18px;
}

.yilla-local-page label {
  color: #664d41;
  font-size: 13px;
  font-weight: 800;
}

.yilla-local-page input,
.yilla-local-page textarea {
  border-color: rgba(143, 23, 32, 0.15);
  background: #fffdf8;
}

.yilla-local-page input:focus,
.yilla-local-page textarea:focus {
  border-color: #e26e55;
  box-shadow: 0 0 0 4px rgba(226, 110, 85, 0.1);
}

.yilla-form-card .article-input {
  min-height: 168px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.lesson-library {
  margin: 26px 0 30px;
  padding: clamp(18px, 2.5vw, 26px);
  border: 1px solid rgba(143, 23, 32, 0.17);
  border-radius: 24px;
  background: #fff8ef;
}

.lesson-library-heading,
.lesson-preview-topline,
.lesson-preview-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.lesson-library-kicker,
.lesson-preview-kicker {
  color: #9f2027;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}

.lesson-library h4,
.lesson-new-article-heading h4 {
  margin: 5px 0 0;
  color: #4f2921;
  font-family: var(--font-display);
  font-size: 25px;
}

.lesson-library p,
.lesson-new-article-heading p {
  margin: 9px 0 16px;
  color: #80695d;
  line-height: 1.6;
}

.lesson-library-count {
  flex: none;
  color: #9f2027;
  font-size: 13px;
  font-weight: 800;
}

.lesson-library-search-label input {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 12px;
}

.lesson-library-list {
  display: grid;
  gap: 9px;
  max-height: 440px;
  margin-top: 13px;
  overflow: auto;
}

.lesson-library-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 15px;
  border: 1px solid #efd9ce;
  border-radius: 15px;
  background: #fffdfa;
  color: #4e332a;
  text-align: left;
  cursor: pointer;
}

.lesson-library-item:hover,
.lesson-library-item:focus-visible {
  border-color: #b63333;
  background: #fff0e8;
}

.lesson-library-item strong {
  font-size: 15px;
}

.lesson-library-item small {
  color: #9f2027;
  font-weight: 900;
}

.lesson-library-item span {
  overflow: hidden;
  color: #80695d;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-library-status {
  min-height: 1em;
}

.lesson-new-article-heading {
  margin: 16px 0;
  padding-top: 20px;
  border-top: 1px solid #ecd8cc;
}

.lesson-preview-page {
  padding: clamp(20px, 4vw, 52px) 0;
}

.lesson-preview-card {
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 48px);
  border: 1px solid #efd9ce;
  border-radius: 30px;
  background: #fffdfa;
  box-shadow: 0 18px 45px rgba(94, 39, 22, .11);
}

.lesson-preview-topline > span {
  color: #9f2027;
  font-weight: 900;
}

.lesson-preview-kicker {
  margin: 27px 0 7px;
}

.lesson-preview-card h1 {
  margin: 0;
  color: #4f2921;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 48px);
}

.lesson-preview-intro {
  color: #80695d;
  line-height: 1.7;
}

.lesson-preview-text {
  margin: 24px 0;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid #efddd0;
  border-radius: 18px;
  background: #fff8ef;
  color: #392b25;
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.lesson-preview-character {
  display: grid;
  gap: 8px;
  max-width: 360px;
  margin-bottom: 22px;
  color: #664d41;
  font-weight: 800;
}

.lesson-preview-character select {
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #efddd0;
  border-radius: 12px;
  background: #fffdfa;
  color: #392b25;
  font: inherit;
}

.lesson-preview-actions span {
  color: #9f2027;
  font-size: 14px;
}

@media (max-width: 640px) {
  .lesson-preview-topline,
  .lesson-preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-preview-actions .primary-btn {
    width: 100%;
  }
}

.yilla-local-page .primary-btn {
  min-height: 46px;
  padding-inline: 19px;
  color: #fffaf2;
  border-radius: 16px;
  background: linear-gradient(145deg, #8f1720, #b63333);
  box-shadow: 0 11px 24px rgba(143, 23, 32, 0.2);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.yilla-local-page .primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 28px rgba(143, 23, 32, 0.24);
}

.yilla-local-page .primary-btn:disabled {
  cursor: wait;
  opacity: 0.64;
  transform: none;
}

.yilla-local-page .ghost-btn {
  color: #73141a;
  border-color: rgba(143, 23, 32, 0.17);
  border-radius: 15px;
  background: rgba(255, 253, 248, 0.74);
}

.yilla-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 30px;
  color: var(--muted);
  font-size: 12px;
}

.yilla-local-page .local-chat {
  grid-template-areas:
    "header header"
    "sidebar conversation";
  grid-template-columns: minmax(270px, 0.34fr) minmax(0, 1fr);
  align-items: start;
}

.yilla-local-page .yilla-chat-header {
  grid-area: header;
  align-items: center;
  overflow: hidden;
  padding: 20px 24px;
  border-color: rgba(143, 23, 32, 0.12);
  border-radius: 28px;
  background:
    radial-gradient(circle at 90% 0%, rgba(239, 167, 51, 0.2), transparent 24%),
    rgba(255, 252, 246, 0.92);
}

.yilla-chat-identity {
  display: flex;
  align-items: center;
  gap: 17px;
}

.yilla-chat-identity h1 {
  margin: 5px 0 3px;
  font-family: var(--font-display);
  font-size: 27px;
}

.yilla-chat-identity h1 span {
  color: #8f1720;
}

.yilla-chat-identity p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.yilla-student-actions {
  display: grid;
  grid-template-columns: 54px auto;
  gap: 7px 12px;
  align-items: center;
  justify-items: end;
}

.student-character-picker,
.language-mode-picker {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid rgba(143, 23, 32, 0.16);
  border-radius: 22px;
  background: rgba(255, 249, 242, 0.82);
}

.student-character-picker legend,
.language-mode-picker legend {
  padding: 0 8px;
  color: #73141a;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
}

.student-character-picker > p,
.language-mode-picker > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.language-mode-option {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 11px;
  align-items: center;
  min-height: 84px;
  padding: 13px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: #fff;
  color: #5d332f;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(95, 42, 31, 0.07);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.language-mode-option:hover {
  transform: translateY(-2px);
  border-color: rgba(180, 35, 45, 0.3);
}

.language-mode-option.is-selected {
  border-color: #b4232d;
  background: #fff4ed;
  box-shadow: 0 0 0 3px rgba(180, 35, 45, 0.1), 0 9px 22px rgba(95, 42, 31, 0.12);
}

.language-mode-option > span:last-child {
  display: grid;
  gap: 4px;
}

.language-mode-option strong { color: #73141a; }
.language-mode-option small { color: var(--muted); line-height: 1.35; }

.language-mode-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #f8dfd2;
  color: #8f1720;
  font-weight: 900;
}

@media (max-width: 640px) {
  .language-mode-grid { grid-template-columns: 1fr; }
}

.student-character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 11px;
  max-height: 390px;
  overflow-y: auto;
  padding: 3px 5px 3px 3px;
}

.mobile-character-summary,
.mobile-picker-heading,
.mobile-learning-tools,
.mobile-drawer-heading,
.mobile-overlay {
  display: none;
}

.mobile-icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(143, 23, 32, 0.18);
  border-radius: 14px;
  color: #73141a;
  background: #fffaf3;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.student-character-option {
  display: grid;
  gap: 7px;
  justify-items: center;
  padding: 9px 7px 8px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: #fff;
  color: #5d332f;
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(95, 42, 31, 0.07);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  overflow: hidden;
}

.student-character-option:hover {
  transform: translateY(-2px);
  border-color: rgba(180, 35, 45, 0.3);
}

.student-character-option.is-selected {
  border-color: #b4232d;
  background: #fff4ed;
  box-shadow: 0 0 0 3px rgba(180, 35, 45, 0.1), 0 9px 22px rgba(95, 42, 31, 0.12);
}

.student-character-option img {
  width: 78px;
  height: 82px;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 15px;
  background: linear-gradient(145deg, #fff7ef, #f7dfd2);
  transform: scale(1.08);
  transition: transform 220ms ease, opacity 160ms ease;
}

.student-character-option:hover img,
.student-character-option.is-selected img {
  transform: scale(1.17);
}

.student-character-option.is-selected img {
  animation: student-character-preview 1.8s ease-in-out infinite;
}

.student-character-option strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes student-character-preview {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -3px; }
}

.student-profile-avatar {
  grid-row: 1 / 3;
  grid-column: 1;
}

.student-profile-copy {
  grid-row: 1;
  grid-column: 2;
  display: grid;
  gap: 2px;
  justify-items: end;
}

.student-profile-copy span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.student-profile-copy strong {
  color: #73141a;
  font-size: 14px;
}

.yilla-student-actions .ghost-btn {
  grid-row: 2;
  grid-column: 2;
  margin-top: 0;
}

.yilla-local-page .yilla-chat-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 18px;
  overflow: hidden;
  padding: 20px;
  border-color: rgba(143, 23, 32, 0.12);
  border-radius: 28px;
}

.yilla-session-history {
  margin: -4px -4px 18px;
  padding: 14px;
  border: 1px solid rgba(143, 23, 32, 0.1);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.86);
}

.yilla-session-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.yilla-session-history-heading span {
  color: #a65b4f;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.yilla-session-history-heading h2 {
  margin: 2px 0 0;
  color: #5b2c25;
  font-size: 18px;
}

.yilla-session-history-heading .ghost-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 11px;
}

.yilla-session-list {
  display: grid;
  gap: 7px;
  max-height: 190px;
  overflow: auto;
}

.yilla-session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: stretch;
  border: 1px solid rgba(143, 23, 32, 0.1);
  border-radius: 13px;
  overflow: hidden;
  background: #fffaf2;
}

.yilla-session-row:hover,
.yilla-session-row.is-active {
  border-color: rgba(167, 29, 39, 0.36);
  background: #fff0e2;
}

.yilla-session-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #5b2c25;
  text-align: left;
  cursor: pointer;
}

.yilla-session-delete {
  min-width: 32px;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(143, 23, 32, 0.1);
  background: transparent;
  color: #a16f67;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.yilla-session-delete:hover,
.yilla-session-delete:focus-visible {
  background: #f8d9d2;
  color: #8f1720;
}

@media (max-width: 640px) {
  .yilla-session-row {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .yilla-session-delete {
    min-width: 44px;
    min-height: 44px;
  }
}

.yilla-session-item strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yilla-session-item span,
.yilla-session-empty {
  margin: 0;
  color: #9a746b;
  font-size: 10px;
}

.yilla-sidebar-note {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
  margin: -4px -4px 19px;
  padding: 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff1df, #ffdfcb);
}

.yilla-sidebar-note img {
  width: 76px;
  height: 76px;
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 19px;
  object-fit: cover;
}

.yilla-sidebar-note strong,
.yilla-sidebar-note span {
  display: block;
}

.lesson-navigator {
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid rgba(143, 23, 32, 0.12);
  border-radius: 20px;
  background: linear-gradient(145deg, #fffaf1, #fff1e4);
}

.lesson-navigator-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #8f1720;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lesson-progress-track {
  height: 7px;
  margin: 9px 0 13px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(143, 23, 32, 0.1);
}

.lesson-progress-track span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a31d28, #eca13c);
  transition: width 260ms ease;
}

.lesson-navigator h2 {
  margin: 0;
  color: #5f251e;
  font-family: var(--font-display);
  font-size: 18px;
}

.lesson-navigator h2 span,
.lesson-navigator h2 small,
.lesson-current-task span,
.lesson-current-task small,
.lesson-beat-support strong,
.lesson-beat-support small {
  display: block;
}

.lesson-navigator h2 small {
  margin-top: 2px;
  color: #9a7066;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
}

.lesson-navigator > p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.lesson-current-task span {
  color: #593b32;
  font-weight: 700;
}

.lesson-current-task small {
  margin-top: 3px;
  color: #8a7168;
  font-size: 10px;
  line-height: 1.45;
}

.lesson-step-history {
  display: grid;
  gap: 7px;
  margin-top: 13px;
}

.lesson-step-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  padding: 8px 9px;
  border-radius: 12px;
  color: #866f67;
  background: rgba(255, 255, 255, 0.45);
}

.lesson-step-row.is-current {
  color: #6f151d;
  background: #fffdf8;
  box-shadow: inset 0 0 0 1px rgba(143, 23, 32, 0.12);
}

.lesson-step-dot {
  color: #c37c32;
  font-size: 10px;
  line-height: 1.5;
}

.lesson-step-row > span:last-child,
.lesson-step-row strong,
.lesson-step-row small {
  display: block;
}

.lesson-step-row strong {
  font-size: 10px;
  line-height: 1.4;
}

.lesson-step-row small {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.35;
}

.lesson-beat-support {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 11px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.lesson-beat-support.hidden,
.lesson-outline.hidden {
  display: none;
}

.lesson-beat-support strong {
  color: #73141a;
  font-size: 12px;
}

.lesson-beat-support small {
  color: #8f746a;
  font-size: 10px;
}

.lesson-beat-support span {
  color: #785b51;
  font-size: 10px;
  line-height: 1.5;
}

.lesson-outline {
  display: grid;
  gap: 11px;
  margin-top: 13px;
}

.lesson-outline-group {
  display: grid;
  gap: 5px;
}

.lesson-outline-group strong {
  color: #73141a;
  font-size: 11px;
}

.lesson-outline-group span {
  padding-left: 2px;
  color: #715b53;
  font-size: 10px;
  line-height: 1.35;
}

.lesson-outline-group span b,
.lesson-outline-group span small {
  display: block;
  font-weight: 600;
}

.lesson-outline-group span small {
  margin: 2px 0 0 13px;
  color: #9a7f75;
  font-size: 9px;
  font-weight: 500;
}

.lesson-outline-group span.is-complete {
  color: #8c6b51;
  text-decoration: line-through;
  text-decoration-color: rgba(143, 23, 32, 0.35);
}

.yilla-sidebar-note strong {
  color: #73141a;
  font-family: var(--font-display);
  font-size: 17px;
}

.yilla-sidebar-note span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.yilla-context-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.yilla-context-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
}

.yilla-local-page .local-context-text {
  max-height: calc(100vh - 390px);
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(143, 23, 32, 0.1);
  border-radius: 17px;
  background: #fffdf8;
  font-size: 12px;
  line-height: 1.65;
}

.yilla-conversation {
  grid-area: conversation;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.yilla-local-page .local-messages,
.yilla-local-page .local-composer {
  border-color: rgba(143, 23, 32, 0.12);
  border-radius: 28px;
  background: rgba(255, 252, 246, 0.93);
}

.yilla-local-page .local-messages {
  min-height: 420px;
  height: min(56vh, 590px);
  max-height: 590px;
  padding: 24px;
  background:
    radial-gradient(circle at 98% 3%, rgba(239, 167, 51, 0.11), transparent 24%),
    rgba(255, 252, 246, 0.93);
}

.yilla-local-page .message {
  max-width: min(760px, 88%);
}

.yilla-local-page .message.assistant .message-role {
  color: #73141a;
}

.yilla-local-page .message.assistant .message-role::before {
  content: none;
}

.yilla-chat-avatar-shell {
  position: relative;
  display: inline-grid;
  width: 54px;
  height: 54px;
  place-items: center;
  isolation: isolate;
  transform-origin: center bottom;
  animation: yilla-chat-avatar-arrive 620ms cubic-bezier(0.16, 0.9, 0.25, 1.22) both;
}

.yilla-chat-avatar-shell img {
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.97);
  border-radius: 18px;
  background: #fff7ed;
  box-shadow: 0 8px 19px rgba(122, 32, 38, 0.2);
  object-fit: cover;
  object-position: center 26%;
  animation: yilla-chat-avatar-nod 2.65s ease-in-out infinite;
}

.yilla-chat-avatar-orbit {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(237, 166, 55, 0.26));
  animation: yilla-chat-orbit-spin 6.2s linear infinite;
}

.yilla-chat-avatar-orbit circle {
  fill: none;
  stroke: #e9a239;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 14 10;
}

.yilla-chat-avatar-orbit path {
  fill: #ffc85b;
  transform-origin: center;
  animation: yilla-chat-star-pulse 1.15s ease-in-out infinite;
}

.yilla-chat-avatar-orbit path:nth-of-type(2) {
  fill: #bd3038;
  animation-delay: -0.55s;
}

.yilla-chat-avatar-shell > i {
  position: absolute;
  z-index: 3;
  right: -3px;
  bottom: 1px;
  color: #b82431;
  font-size: 11px;
  font-style: normal;
  text-shadow: 0 2px 4px rgba(122, 32, 38, 0.2);
  animation: yilla-chat-heart-pop 1.55s ease-in-out infinite;
}

@keyframes yilla-chat-avatar-arrive {
  0% { opacity: 0; transform: translate(-16px, 12px) rotate(-14deg) scale(0.38); }
  65% { opacity: 1; transform: translate(3px, -4px) rotate(5deg) scale(1.13); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}

@keyframes yilla-chat-avatar-nod {
  0%, 100% { transform: translateY(1px) rotate(-1.5deg) scale(1); }
  38% { transform: translateY(-4px) rotate(2.2deg) scale(1.055); }
  62% { transform: translateY(-1px) rotate(-2deg) scale(1.025); }
}

@keyframes yilla-chat-orbit-spin {
  to { transform: rotate(360deg); }
}

@keyframes yilla-chat-star-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.68) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.2) rotate(22deg); }
}

@keyframes yilla-chat-heart-pop {
  0%, 100% { opacity: 0.35; transform: translate(1px, 2px) rotate(9deg) scale(0.65); }
  48% { opacity: 1; transform: translate(-3px, -4px) rotate(-8deg) scale(1.26); }
}

.yilla-local-page .message.assistant .message-bubble {
  border-color: rgba(143, 23, 32, 0.11);
  border-radius: 8px 20px 20px 20px;
  background: #fff8eb;
  box-shadow: 0 8px 22px rgba(94, 39, 22, 0.06);
}

.lesson-content-card {
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid rgba(143, 23, 32, 0.13);
  border-radius: 16px;
  background: #fffdf8;
  white-space: normal;
}

.lesson-content-card-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  padding: 11px 13px;
  color: #74151c;
  background: linear-gradient(135deg, #fff0df, #ffe8d8);
}

.lesson-content-card-title strong {
  font-size: 13px;
}

.lesson-clue-table .lesson-content-card-title strong,
.lesson-vocab-card .lesson-content-card-title strong {
  font-size: 14px;
}

.lesson-content-card-title span {
  color: #9a6255;
  font-size: 10px;
  font-weight: 700;
}

/* Stage 2's whole-table task must remain visibly structured on every screen.
   The outer border deliberately belongs to the table, not only to its card. */
.clue-table {
  width: 100%;
  border: 1px solid rgba(143, 23, 32, 0.16);
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: #fffdf8;
}

.clue-table th,
.clue-table td {
  padding: 10px 12px;
  border-right: 1px solid rgba(143, 23, 32, 0.12);
  border-bottom: 1px solid rgba(143, 23, 32, 0.12);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.5;
}

.clue-table th:last-child,
.clue-table td:last-child {
  border-right: 0;
}

.clue-table tbody tr:last-child th,
.clue-table tbody tr:last-child td {
  border-bottom: 0;
}

.clue-table thead th {
  color: #74151c;
  background: #fff1e2;
  font-weight: 800;
}

.clue-table tbody th {
  width: 34%;
  color: #6e2c25;
  background: #fff9f0;
  font-weight: 800;
}

.lesson-table-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.34fr) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 13px;
  border-top: 1px solid rgba(143, 23, 32, 0.08);
  font-size: 14px;
  line-height: 1.5;
}

.lesson-table-row strong,
.lesson-table-row b {
  color: #6e2c25;
}

.lesson-table-row em {
  color: #aa8e84;
  font-style: normal;
}

.lesson-table-head {
  color: #7a5147;
  background: #fff9f0;
}

/* Articles A, B, and C share a readable 14px table type scale. Keep every
   heading, answer, placeholder, and inline table label at the same size. */
.clue-table,
.clue-table th,
.clue-table td,
.clue-table th *,
.clue-table td *,
.lesson-clue-table .lesson-table-row,
.lesson-clue-table .lesson-table-row * {
  font-size: 14px;
}

.lesson-vocab-card p {
  margin: 0;
  padding: 13px;
  color: #60463e;
  font-size: 14px;
  line-height: 1.75;
}

.lesson-story-card blockquote {
  margin: 12px 13px 4px;
  padding: 10px 12px;
  border-left: 3px solid #c77932;
  border-radius: 0 10px 10px 0;
  color: #642f27;
  background: #fff7e9;
  font-family: var(--font-display);
  font-size: 12px;
  font-style: italic;
  line-height: 1.55;
}

.lesson-story-card ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 16px 14px 34px;
}

.lesson-story-card li {
  padding-left: 3px;
  color: #6d4d43;
  font-size: 11px;
  line-height: 1.45;
}

.lesson-story-card li b,
.lesson-story-card li span {
  display: block;
}

.lesson-story-card li b {
  color: #633129;
}

.lesson-story-card li span {
  margin-top: 2px;
  color: #92756b;
  font-size: 10px;
}

.lesson-outline-card {
  border-color: rgba(184, 116, 43, 0.24);
  background: linear-gradient(160deg, #fffdf8, #fff8e9);
}

.scaffold-card {
  border-color: rgba(143, 23, 32, 0.18);
  background: #fffdf8;
}

.scaffold-card .lesson-content-card-title {
  display: grid;
  justify-content: stretch;
}

.scaffold-card .lesson-content-card-title span {
  margin-top: 2px;
}

.scaffold-level-note {
  padding: 8px 13px;
  color: #7a351f;
  background: #fff7dc;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.scaffold-words,
.scaffold-example,
.scaffold-your-turn {
  padding: 12px 13px;
  border-top: 1px solid rgba(143, 23, 32, 0.08);
  white-space: normal;
}

.scaffold-words > div,
.scaffold-example > div,
.scaffold-your-turn {
  display: grid;
  gap: 2px;
}

.scaffold-words > div strong,
.scaffold-example > div strong,
.scaffold-your-turn > strong {
  color: #672b24;
  font-size: 11px;
}

.scaffold-words > div span,
.scaffold-example > div span,
.scaffold-your-turn > span {
  color: #9a7a70;
  font-size: 9px;
}

.scaffold-words ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
}

.scaffold-words li {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  padding: 5px 8px;
  border-radius: 999px;
  color: #6b4a41;
  background: #fff2e5;
  font-size: 9px;
}

.scaffold-words li b {
  color: #771720;
}

.scaffold-example {
  position: relative;
  background: rgba(255, 255, 255, 0.52);
}

.scaffold-example.is-recommended {
  background: linear-gradient(135deg, #fff5dd, #ffeadc);
  box-shadow: inset 3px 0 0 #b42b31;
}

.scaffold-example em {
  justify-self: start;
  margin-top: 5px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fffaf2;
  background: #a8222a;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
}

.scaffold-example p,
.scaffold-your-turn p,
.scaffold-style-note p {
  margin: 8px 0 0;
  color: #544039;
  font-size: 10px;
  line-height: 1.6;
}

.scaffold-style-note {
  padding: 11px 13px;
  border-top: 1px solid rgba(143, 23, 32, 0.08);
  color: #634b43;
  background: #fff8ee;
  white-space: normal;
}

.scaffold-style-note strong {
  color: #7d2528;
  font-size: 10px;
}

.scaffold-style-note p {
  margin-top: 5px;
  font-size: 9px;
}

.scaffold-example p {
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.74);
  font-family: Georgia, "Times New Roman", serif;
}

/* Steps 1–3 are the active learning material: keep them large and easy to
   read. Steps 4–5 are intentionally a single, quiet next-action sentence. */
.scaffold-card .scaffold-core-step > div strong {
  font-size: 14px;
}

.scaffold-card .scaffold-core-step li,
.scaffold-card .scaffold-core-step li b,
.scaffold-card .scaffold-core-step li small,
.scaffold-card .scaffold-core-step p {
  font-size: 14px;
  line-height: 1.45;
}

.scaffold-card .scaffold-core-step li {
  padding: 9px 12px;
}

.scaffold-card .scaffold-core-step p {
  margin-top: 12px;
  padding: 12px 14px;
}

.scaffold-next-hint {
  margin: 14px 13px 16px;
  color: #6b4a41;
  font-size: 14px;
  line-height: 1.55;
}

.scaffold-card .lesson-content-card-title strong,
.scaffold-card .scaffold-level-note,
.scaffold-card .scaffold-style-note strong,
.scaffold-card .scaffold-style-note p {
  font-size: 14px;
}

.scaffold-your-turn {
  background: linear-gradient(135deg, #fff4e6, #fff9ef);
}

.yilla-local-page .message.user .message-role {
  text-align: right;
}

.yilla-local-page .message.user .message-bubble {
  color: #fffaf2;
  border-color: transparent;
  border-radius: 20px 8px 20px 20px;
  background: linear-gradient(145deg, #8f1720, #ae3035);
  box-shadow: 0 10px 24px rgba(143, 23, 32, 0.16);
}

.yilla-local-page .local-composer {
  padding: 18px 20px;
}

.yilla-local-page .local-composer textarea {
  min-height: 92px;
}

.yilla-local-page .voice-language-picker {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(143, 23, 32, 0.18);
  border-radius: 13px;
  background: #fffaf3;
}

.yilla-local-page .voice-language-picker.hidden {
  display: none;
}

.yilla-local-page .voice-language-picker button {
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #7b2529;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.yilla-local-page .voice-language-picker button[aria-pressed="true"] {
  background: #ad2e31;
  color: #fffaf2;
}

.yilla-local-page .voice-input-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  color: #7b2529;
  border: 1px solid rgba(143, 23, 32, 0.18);
  border-radius: 15px;
  background: #fffaf3;
  box-shadow: 0 6px 15px rgba(94, 39, 22, 0.06);
  font-size: 12px;
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.yilla-local-page .voice-input-btn.hidden {
  display: none;
}

.yilla-local-page .voice-input-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff1e3;
  box-shadow: 0 9px 18px rgba(94, 39, 22, 0.1);
}

.yilla-local-page .voice-input-btn.is-listening {
  color: #fffaf2;
  border-color: transparent;
  background: linear-gradient(145deg, #b92f38, #e06b55);
  animation: yilla-voice-pulse 1.2s ease-in-out infinite;
}

.yilla-local-page .voice-input-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

@keyframes yilla-voice-pulse {
  50% { box-shadow: 0 0 0 7px rgba(224, 107, 85, 0.15); }
}

@media (max-width: 1060px) {
  .yilla-setup-panel {
    grid-template-columns: 1fr;
  }

  .yilla-poster-panel {
    min-height: 0;
    max-height: none;
  }

  .yilla-entry-panel {
    padding: 42px;
  }
}

@media (max-width: 820px) {
  .yilla-local-page .local-chat {
    grid-template-areas:
      "header"
      "sidebar"
      "conversation";
    grid-template-columns: 1fr;
  }

  .yilla-local-page .yilla-chat-sidebar {
    position: static;
  }

  .yilla-local-page .local-context-text {
    max-height: 220px;
  }
}

@media (max-width: 640px) {
  .yilla-top-note {
    display: none;
  }

  .yilla-setup-panel {
    border-radius: 26px;
  }

  .yilla-poster-panel {
    min-height: 0;
    max-height: none;
  }

  .yilla-entry-panel {
    padding: 28px 20px 24px;
  }

  .yilla-local-page .local-title {
    font-size: clamp(43px, 14vw, 58px);
  }

  .yilla-mini-bio {
    grid-template-columns: 62px 1fr;
  }

  .yilla-mini-avatar {
    width: 62px;
    height: 62px;
  }

  .yilla-local-page .setup-grid {
    grid-template-columns: 1fr;
  }

  .yilla-local-page .local-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .yilla-local-page .local-actions .primary-btn {
    width: 100%;
  }

  .yilla-chat-identity {
    align-items: flex-start;
  }

  .yilla-local-page .yilla-chat-header {
    gap: 18px;
  }

  .yilla-student-actions {
    justify-items: start;
  }

  .yilla-footer {
    flex-direction: column;
  }

  .lesson-table-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yilla-local-page *,
  .yilla-local-page *::before,
  .yilla-local-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Friendly landing experience for the working local tutor. */
.yilla-local-page .yilla-setup-panel {
  display: block;
  overflow: visible;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.yilla-runtime-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(520px, 1.18fr);
  gap: clamp(30px, 4vw, 54px);
  align-items: center;
  padding: 38px 0 78px;
}

/* Subtle SVG motion: visual energy without affecting lesson/API performance. */
.yilla-runtime-hero {
  isolation: isolate;
  overflow: hidden;
}

.yilla-runtime-hero > :not(.yilla-motion-scene) {
  position: relative;
  z-index: 1;
}

.yilla-motion-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .92;
}

.yilla-motion-path {
  fill: none;
  stroke: url(#yilla-flow-gradient);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 10 18;
  animation: yilla-flow-line 18s linear infinite;
}

.yilla-motion-path-two {
  stroke-width: 2;
  opacity: .6;
  animation-duration: 25s;
  animation-direction: reverse;
}

.yilla-motion-dot {
  fill: #c7393f;
  opacity: .34;
  transform-box: fill-box;
  transform-origin: center;
  animation: yilla-soft-pulse 3.4s ease-in-out infinite;
}

.yilla-motion-dot-two { animation-delay: -1.7s; }

.yilla-motion-pencil {
  fill: rgba(255, 255, 255, .75);
  stroke: rgba(166, 35, 46, .42);
  stroke-width: 2;
  stroke-linecap: round;
  transform: translate(86px, 146px) rotate(-12deg);
  animation: yilla-pencil-float 6s ease-in-out infinite;
}

.auth-shell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.auth-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.auth-card > :not(.yilla-auth-motion):not(.yilla-auth-spark) {
  position: relative;
  z-index: 2;
}

.yilla-auth-motion {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: .95;
}

.yilla-auth-line {
  fill: none;
  stroke: rgba(180, 35, 45, .24);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 12 20;
  animation: yilla-flow-line 22s linear infinite;
}

.yilla-auth-line-two {
  stroke: rgba(232, 143, 71, .25);
  animation-duration: 29s;
  animation-direction: reverse;
}

.yilla-auth-orb {
  fill: rgba(180, 35, 45, .38);
  transform-box: fill-box;
  transform-origin: center;
  animation: yilla-soft-pulse 3.8s ease-in-out infinite;
}

.yilla-auth-orb-two { animation-delay: -1.9s; }
.yilla-auth-orb-three { animation-delay: -.8s; }

.yilla-auth-spark {
  position: absolute;
  z-index: 3;
  color: rgba(169, 35, 45, .62);
  pointer-events: none;
  text-shadow: 0 5px 18px rgba(185, 65, 59, .2);
  animation: yilla-spark-drift 4.8s ease-in-out infinite;
}

.yilla-auth-spark-one { top: 7%; right: 7%; font-size: 2rem; }
.yilla-auth-spark-two { top: 45%; left: 48%; font-size: 1.55rem; animation-delay: -1.6s; }
.yilla-auth-spark-three { bottom: 7%; right: 42%; font-size: 1.35rem; animation-delay: -3.1s; }

.auth-brand .teacher-avatar {
  position: relative;
  filter: drop-shadow(0 10px 18px rgba(154, 48, 52, .14));
  animation: yilla-avatar-breathe 4.2s ease-in-out infinite;
}

.auth-form .primary-btn {
  position: relative;
  overflow: hidden;
}

.auth-form .primary-btn::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -35%;
  width: 24%;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.52), transparent);
  animation: yilla-button-glint 4.6s ease-in-out infinite;
}

@keyframes yilla-flow-line {
  to { stroke-dashoffset: -224; }
}

@keyframes yilla-soft-pulse {
  0%, 100% { transform: scale(.78); opacity: .18; }
  50% { transform: scale(1.32); opacity: .48; }
}

@keyframes yilla-pencil-float {
  0%, 100% { transform: translate(86px, 146px) rotate(-12deg); }
  50% { transform: translate(98px, 132px) rotate(-5deg); }
}

@keyframes yilla-spark-drift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-5deg); opacity: .42; }
  50% { transform: translate3d(0, -13px, 0) rotate(9deg); opacity: .9; }
}

@keyframes yilla-avatar-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.025); }
}

@keyframes yilla-button-glint {
  0%, 58% { left: -35%; opacity: 0; }
  68% { opacity: 1; }
  88%, 100% { left: 118%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .yilla-motion-path,
  .yilla-motion-dot,
  .yilla-motion-pencil,
  .yilla-auth-line,
  .yilla-auth-orb,
  .yilla-auth-spark,
  .auth-brand .teacher-avatar,
  .auth-form .primary-btn::after {
    animation: none !important;
  }
}

.yilla-runtime-copy {
  position: relative;
  z-index: 1;
}

.yilla-local-page .yilla-runtime-copy .local-title {
  max-width: 760px;
  margin: 20px 0 18px;
  font-size: clamp(48px, 6.6vw, 86px);
}

.yilla-runtime-lead {
  max-width: 660px;
  margin: 0;
  color: #594338;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.72;
}

.yilla-runtime-note {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.85;
}

.yilla-runtime-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.yilla-runtime-button {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 13px 21px;
  border-radius: 17px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.yilla-runtime-button:hover {
  transform: translateY(-2px);
}

.yilla-runtime-button-primary {
  color: #fffaf2;
  background: linear-gradient(145deg, #8f1720, #b63333);
  box-shadow: 0 13px 28px rgba(143, 23, 32, 0.22);
}

.yilla-runtime-button-secondary {
  color: #671017;
  border: 1px solid rgba(143, 23, 32, 0.16);
  background: rgba(255, 252, 246, 0.84);
  box-shadow: 0 12px 30px rgba(94, 39, 22, 0.09);
}

.yilla-runtime-copy .yilla-principles {
  margin-top: 26px;
  margin-bottom: 0;
}

.yilla-runtime-copy .yilla-principles span {
  padding: 8px 12px;
  background: rgba(255, 252, 246, 0.72);
  font-size: 13px;
}

.yilla-runtime-poster {
  position: relative;
  justify-self: center;
  width: min(100%, 680px);
}

.yilla-runtime-poster figure {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(143, 23, 32, 0.13);
  border-radius: 38px;
  background: rgba(255, 252, 246, 0.88);
  box-shadow: 0 34px 70px rgba(94, 39, 22, 0.18);
  transform: rotate(1.25deg);
  transform-origin: 50% 58%;
  animation: yilla-poster-hover 7.5s ease-in-out infinite;
}

.yilla-runtime-poster figure img {
  display: block;
  width: 100%;
  border-radius: 29px;
  animation: yilla-poster-breathe 7.5s ease-in-out infinite;
}

.yilla-poster-cast {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.yilla-runtime-poster .yilla-poster-cast img {
  position: absolute;
  width: 13.5%;
  aspect-ratio: 1;
  object-fit: contain;
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 28%;
  background: rgba(255, 249, 240, .88);
  box-shadow: 0 12px 30px rgba(119, 36, 37, .24);
  animation: yilla-cast-pop-a 2.4s cubic-bezier(.34,1.56,.64,1) infinite;
}

.yilla-runtime-poster .yilla-poster-cast img:nth-child(1) { left: 39%; top: 42%; animation-delay: -.2s; }
.yilla-runtime-poster .yilla-poster-cast img:nth-child(2) { left: 52.5%; top: 42%; animation-name: yilla-cast-pop-b; animation-delay: -.9s; }
.yilla-runtime-poster .yilla-poster-cast img:nth-child(3) { left: 66%; top: 42%; animation-delay: -1.5s; }
.yilla-runtime-poster .yilla-poster-cast img:nth-child(4) { left: 39%; top: 61%; animation-name: yilla-cast-pop-b; animation-delay: -1.9s; }
.yilla-runtime-poster .yilla-poster-cast img:nth-child(5) { left: 52.5%; top: 61%; animation-delay: -2.2s; }
.yilla-runtime-poster .yilla-poster-cast img:nth-child(6) { left: 66%; top: 61%; animation-name: yilla-cast-pop-b; animation-delay: -2.7s; }

.yilla-runtime-poster .yilla-poster-sticker {
  top: -19px;
  right: -28px;
}

.yilla-runtime-sparkle {
  position: absolute;
  color: #efa733;
  font-size: 34px;
  animation: yilla-runtime-float 3.8s ease-in-out infinite;
}

.yilla-runtime-sparkle-one {
  top: 10%;
  left: -38px;
}

.yilla-runtime-sparkle-two {
  right: -22px;
  bottom: 17%;
  animation-delay: -1.4s;
}

@keyframes yilla-runtime-float {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }

  50% {
    transform: translateY(-10px) rotate(4deg);
  }
}

.yilla-runtime-joy {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: -28px 0 76px;
  padding: 16px;
  border: 1px solid rgba(143, 23, 32, 0.14);
  border-radius: 24px;
  background: rgba(255, 252, 246, 0.78);
  box-shadow: 0 12px 30px rgba(94, 39, 22, 0.09);
  backdrop-filter: blur(14px);
}

.yilla-runtime-joy-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  border-right: 1px solid rgba(143, 23, 32, 0.14);
}

.yilla-runtime-joy-item:last-child {
  border-right: 0;
}

.yilla-runtime-joy-icon {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 15px;
  background: #fff1d6;
  font-size: 21px;
}

.yilla-runtime-joy-item strong,
.yilla-runtime-joy-item div > span {
  display: block;
}

.yilla-runtime-joy-item div > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.yilla-runtime-meet {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(290px, 0.72fr) minmax(0, 1.28fr);
  align-items: stretch;
  margin-bottom: 84px;
  border: 1px solid rgba(143, 23, 32, 0.12);
  border-radius: 34px;
  background: rgba(255, 252, 246, 0.92);
  box-shadow: 0 22px 54px rgba(94, 39, 22, 0.13);
}

.yilla-runtime-meet-portrait {
  position: relative;
  min-height: 390px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.72), transparent 24%),
    linear-gradient(145deg, #ffe2ca, #fff4df);
}

.yilla-runtime-meet-portrait::before {
  content: "Hello! ♡";
  position: absolute;
  top: 28px;
  left: 28px;
  color: #8f1720;
  font-family: "Brush Script MT", "Snell Roundhand", cursive;
  font-size: 31px;
  transform: rotate(-5deg);
}

.yilla-runtime-meet-portrait img {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(90%, 390px);
  margin: auto;
  filter: drop-shadow(0 18px 30px rgba(94, 39, 22, 0.14));
  transform-origin: 50% 100%;
  animation: yilla-wave-sway 3.9s ease-in-out infinite;
}

.yilla-runtime-meet-portrait::after {
  content: "✦";
  position: absolute;
  top: 24%;
  right: 12%;
  color: #eca037;
  font-size: 28px;
  text-shadow: 0 7px 20px rgba(236, 160, 55, .25);
  animation: yilla-image-spark 2.8s ease-in-out infinite;
}

.yilla-runtime-meet-copy {
  display: grid;
  align-content: center;
  padding: clamp(30px, 6vw, 66px);
}

.yilla-runtime-meet-copy h2,
.yilla-runtime-section-heading h2 {
  font-family: var(--font-display);
  line-height: 1.08;
}

.yilla-runtime-meet-copy h2 {
  margin: 10px 0 15px;
  font-size: clamp(38px, 5vw, 62px);
}

.yilla-runtime-meet-copy > p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.yilla-runtime-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.yilla-runtime-facts > div {
  padding: 15px;
  border: 1px solid rgba(143, 23, 32, 0.1);
  border-radius: 18px;
  background: #fff9ed;
}

.yilla-runtime-facts span,
.yilla-runtime-facts strong,
.yilla-runtime-facts small {
  display: block;
}

.yilla-runtime-facts span {
  margin-bottom: 7px;
  font-size: 23px;
}

.yilla-runtime-facts strong {
  color: #671017;
  font-size: 13px;
}

.yilla-runtime-facts small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.yilla-runtime-signature {
  margin-top: 24px;
  color: #8f1720;
  font-family: "Brush Script MT", "Snell Roundhand", cursive;
  font-size: 31px;
  transform: rotate(-2deg);
}

.yilla-runtime-entry {
  padding: 6px 0 38px;
  scroll-margin-top: 28px;
}

.yilla-runtime-section-heading {
  max-width: 780px;
  margin-bottom: 26px;
}

.yilla-runtime-section-heading h2 {
  margin: 8px 0 10px;
  font-size: clamp(34px, 4vw, 54px);
}

.yilla-runtime-section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.yilla-runtime-entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.76fr);
  gap: 24px;
  align-items: stretch;
}

.yilla-runtime-entry .yilla-form-card {
  padding: clamp(24px, 4vw, 38px);
  border-radius: 34px;
  box-shadow: 0 22px 54px rgba(94, 39, 22, 0.13);
}

.yilla-runtime-entry .yilla-form-heading h3 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 30px;
}

.yilla-runtime-ready {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 560px;
  border: 1px solid rgba(143, 23, 32, 0.12);
  border-radius: 34px;
  background:
    radial-gradient(circle at 83% 12%, rgba(255, 255, 255, 0.8), transparent 24%),
    linear-gradient(155deg, #fff5e5 0%, #ffe1cc 100%);
  box-shadow: 0 22px 54px rgba(94, 39, 22, 0.13);
}

.yilla-runtime-ready-copy {
  position: relative;
  z-index: 1;
  padding: 30px 30px 0;
}

.yilla-runtime-ready-copy > span {
  color: #9f2027;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.yilla-runtime-ready-copy h3 {
  margin: 8px 0 10px;
  color: #5f1016;
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.08;
}

.yilla-runtime-ready-copy p {
  margin: 0;
  color: #725f52;
  line-height: 1.7;
}

.yilla-runtime-ready-gallery {
  align-self: stretch;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 3vw, 38px) 12px;
  align-content: space-evenly;
  padding: 24px 20px 34px;
}

.yilla-runtime-ready-gallery img {
  justify-self: center;
  width: min(100%, 190px);
  max-height: 260px;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 18px 28px rgba(94, 39, 22, 0.13));
  transform-origin: 50% 100%;
  animation: yilla-thumbs-bounce 3.5s ease-in-out infinite;
}

.yilla-runtime-ready-gallery img:nth-child(even) {
  animation-delay: -1.7s;
}

.yilla-runtime-ready-gallery img:nth-child(3n) {
  animation-duration: 4.3s;
}

.yilla-runtime-ready::after {
  content: "✦";
  position: absolute;
  right: 12%;
  bottom: 42%;
  z-index: 2;
  color: #efa733;
  font-size: 30px;
  animation: yilla-image-spark 2.4s ease-in-out infinite;
}

@keyframes yilla-poster-hover {
  0%, 100% { transform: translateY(0) rotate(1.25deg); box-shadow: 0 34px 70px rgba(94, 39, 22, .18); }
  50% { transform: translateY(-10px) rotate(.25deg); box-shadow: 0 45px 82px rgba(94, 39, 22, .23); }
}

@keyframes yilla-poster-breathe {
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.012); filter: saturate(1.06); }
}

@keyframes yilla-wave-sway {
  0%, 100% { transform: translate3d(-12px, 3px, 0) rotate(-6deg) scale(1); }
  50% { transform: translate3d(14px, -20px, 0) rotate(7deg) scale(1.065); }
}

@keyframes yilla-thumbs-bounce {
  0%, 100% { transform: translate3d(-10px, 2px, 0) rotate(-4deg) scale(1); }
  42% { transform: translate3d(13px, -24px, 0) rotate(6deg) scale(1.085); }
  58% { transform: translate3d(6px, -12px, 0) rotate(2deg) scale(1.045); }
}

@keyframes yilla-cast-pop-a {
  0%, 100% { transform: translateY(3px) rotate(-5deg) scale(1); filter: saturate(1); }
  45% { transform: translateY(-18px) rotate(7deg) scale(1.16); filter: saturate(1.18); }
  62% { transform: translateY(-8px) rotate(2deg) scale(1.08); }
}

@keyframes yilla-cast-pop-b {
  0%, 100% { transform: translateY(-2px) rotate(5deg) scale(1.02); filter: saturate(1); }
  45% { transform: translateY(17px) rotate(-7deg) scale(1.17); filter: saturate(1.2); }
  62% { transform: translateY(8px) rotate(-2deg) scale(1.09); }
}

@keyframes yilla-image-spark {
  0%, 100% { transform: scale(.65) rotate(-12deg); opacity: .25; }
  50% { transform: scale(1.22) rotate(12deg); opacity: .95; }
}

@media (prefers-reduced-motion: reduce) {
  .yilla-runtime-poster figure,
  .yilla-runtime-poster figure img,
  .yilla-runtime-meet-portrait img,
  .yilla-runtime-meet-portrait::after,
  .yilla-runtime-ready-gallery img,
  .yilla-runtime-ready::after,
  .yilla-poster-cast img {
    animation: none !important;
  }
}

@media (max-width: 1060px) {
  .yilla-runtime-hero,
  .yilla-runtime-meet,
  .yilla-runtime-entry-layout {
    grid-template-columns: 1fr;
  }

  .yilla-runtime-hero {
    padding-top: 28px;
  }

  .yilla-runtime-poster {
    width: min(92%, 760px);
  }

  .yilla-runtime-meet-portrait {
    min-height: 440px;
  }

  .yilla-runtime-ready {
    min-height: 500px;
  }
}

@media (max-width: 720px) {
  .yilla-runtime-hero {
    gap: 42px;
    padding-bottom: 64px;
  }

  .yilla-runtime-poster {
    width: 100%;
  }

  .yilla-runtime-poster .yilla-poster-sticker {
    top: -24px;
    right: 10px;
  }

  .yilla-runtime-sparkle-one {
    left: -5px;
  }

  .yilla-runtime-sparkle-two {
    right: -2px;
  }

  .yilla-runtime-joy {
    grid-template-columns: 1fr;
    margin-bottom: 58px;
  }

  .yilla-runtime-joy-item {
    border-right: 0;
    border-bottom: 1px solid rgba(143, 23, 32, 0.14);
  }

  .yilla-runtime-joy-item:last-child {
    border-bottom: 0;
  }

  .yilla-runtime-meet {
    margin-bottom: 64px;
  }

  .yilla-runtime-meet-portrait {
    min-height: 350px;
  }

  .yilla-runtime-meet-copy {
    padding: 34px 24px 40px;
  }

  .yilla-runtime-facts {
    grid-template-columns: 1fr;
  }

  .yilla-runtime-ready {
    min-height: 460px;
  }
}

@media (max-width: 480px) {
  .yilla-local-page .yilla-runtime-copy .local-title {
    font-size: clamp(43px, 14vw, 58px);
  }

  .yilla-runtime-actions,
  .yilla-runtime-button {
    width: 100%;
  }

  .yilla-runtime-poster figure {
    padding: 6px;
    border-radius: 25px;
  }

  .yilla-runtime-poster figure img {
    border-radius: 19px;
  }

  .yilla-runtime-meet-portrait {
    min-height: 300px;
  }

  .yilla-runtime-meet-portrait::before {
    top: 20px;
    left: 20px;
    font-size: 25px;
  }

  .yilla-runtime-entry .yilla-form-card,
  .yilla-runtime-ready {
    border-radius: 25px;
  }

  .yilla-runtime-ready-copy {
    padding: 25px 22px 0;
  }
}

/* Animated Yilla reaction stickers inside the real chat. */
.yilla-local-page .message-content-row {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 12px;
}

.yilla-local-page .message-content-row .message-bubble {
  min-width: 0;
  flex: 1 1 auto;
}

/* A quiet, browser-native listening control. It overlays the reply so reaction
   stickers retain their existing position and no chat row needs a new column. */
.yilla-local-page .message.assistant .message-bubble {
  position: relative;
  padding-right: 48px;
}

.yilla-listen-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(188, 91, 44, 0.18);
  border-radius: 50%;
  background: rgba(255, 250, 244, 0.9);
  color: #a64b37;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.yilla-local-page .message.assistant .message-bubble:hover .yilla-listen-button,
.yilla-listen-button:focus-visible,
.yilla-listen-button.is-preparing,
.yilla-listen-button.is-speaking {
  opacity: 1;
  transform: translateY(0);
}

.yilla-listen-button:hover,
.yilla-listen-button.is-preparing,
.yilla-listen-button.is-speaking {
  background: #fff;
  border-color: rgba(166, 75, 55, 0.42);
}

.yilla-listen-button.is-speaking {
  color: #fff;
  background: #ad2e31;
}

.yilla-local-page .message.user .message-content-row {
  justify-content: flex-end;
}

/* Student characters: each session receives one of seven character sets. The
   real SVG orbit and CSS motion add life without animated-image decoding or
   any extra AI/server work. */
.student-avatar-shell {
  position: relative;
  z-index: 0;
  display: inline-grid;
  flex: 0 0 82px;
  width: 82px;
  height: 82px;
  place-items: center;
  isolation: isolate;
  transform-origin: center bottom;
  animation: student-avatar-arrive 620ms cubic-bezier(0.16, 0.9, 0.25, 1.25) both;
}

.student-avatar-shell img {
  z-index: 1;
  width: 70px;
  height: 70px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  border-radius: 25px;
  background: #fff6ed;
  box-shadow: 0 12px 24px rgba(111, 36, 42, 0.22);
  object-fit: cover;
  object-position: center 28%;
  animation: student-avatar-float 3.1s ease-in-out infinite;
}

.student-avatar-orbit {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 6px rgba(232, 146, 48, 0.23));
  animation: student-avatar-orbit 7s linear infinite;
}

.student-avatar-orbit circle {
  fill: none;
  stroke: #eda637;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-dasharray: 16 12;
}

.student-avatar-orbit circle:nth-child(2) {
  stroke: #bd3940;
  stroke-width: 1.5;
  stroke-dasharray: 7 17;
  animation: student-avatar-orbit-reverse 4.6s linear infinite;
  transform-origin: center;
}

.student-avatar-orbit path {
  fill: #ffc758;
  transform-origin: center;
  animation: student-avatar-star-pulse 1.25s ease-in-out infinite;
}

.student-avatar-spark {
  position: absolute;
  z-index: 3;
  color: #f2a82f;
  font-style: normal;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(122, 32, 38, 0.16);
  pointer-events: none;
}

.student-avatar-spark-one {
  top: 2px;
  right: 3px;
  font-size: 17px;
  animation: student-avatar-spark-one 1.6s ease-in-out infinite;
}

.student-avatar-spark-two {
  bottom: 5px;
  left: 2px;
  color: #b52c35;
  font-size: 9px;
  animation: student-avatar-spark-two 1.9s ease-in-out infinite;
}

.student-avatar-shell.is-compact {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
}

.student-avatar-shell.is-compact img {
  width: 45px;
  height: 45px;
  border-width: 2px;
  border-radius: 17px;
  box-shadow: 0 7px 15px rgba(111, 36, 42, 0.18);
}

.student-avatar-shell.is-compact .student-avatar-spark-one {
  font-size: 12px;
}

@keyframes student-avatar-arrive {
  0% {
    opacity: 0;
    transform: translate(24px, 18px) rotate(13deg) scale(0.42);
  }
  68% {
    opacity: 1;
    transform: translate(-4px, -5px) rotate(-5deg) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
}

@keyframes student-avatar-float {
  0%, 100% { transform: translateY(2px) rotate(-2deg) scale(1); }
  48% { transform: translateY(-6px) rotate(2.5deg) scale(1.045); }
  72% { transform: translateY(-2px) rotate(-1deg) scale(1.02); }
}

@keyframes student-avatar-orbit {
  to { transform: rotate(360deg); }
}

@keyframes student-avatar-orbit-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes student-avatar-star-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.72) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.18) rotate(18deg); }
}

@keyframes student-avatar-spark-one {
  0%, 100% { opacity: 0.38; transform: translate(2px, 3px) rotate(-12deg) scale(0.65); }
  45% { opacity: 1; transform: translate(-4px, -5px) rotate(12deg) scale(1.28); }
}

@keyframes student-avatar-spark-two {
  0%, 100% { opacity: 0.3; transform: translate(2px, -1px) scale(0.72); }
  55% { opacity: 0.95; transform: translate(-4px, 4px) scale(1.2); }
}

.yilla-reaction {
  position: relative;
  display: grid;
  flex: 0 0 108px;
  width: 108px;
  justify-items: center;
  padding: 6px 6px 9px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  background: linear-gradient(145deg, #fffdf8, #ffe7d1);
  box-shadow: 0 12px 25px rgba(94, 39, 22, 0.14);
  transform-origin: center bottom;
  animation: yilla-reaction-arrive 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.yilla-reaction-image {
  display: block;
  width: 94px;
  height: 94px;
  overflow: hidden;
  border-radius: 19px;
  background: #fff;
}

.yilla-reaction img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center bottom;
}

.yilla-reaction-caption {
  position: relative;
  z-index: 1;
  margin-top: 3px;
  color: #73141a;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-align: center;
}

.yilla-reaction-spark {
  position: absolute;
  top: -9px;
  right: -5px;
  z-index: 2;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: #9f2027;
  border-radius: 50%;
  background: #fff3bf;
  box-shadow: 0 7px 14px rgba(94, 39, 22, 0.12);
  animation: yilla-reaction-sparkle 1.15s ease-in-out 450ms 3;
}

.yilla-reaction-wave img {
  animation: yilla-sticker-wave 1.2s ease-in-out 480ms 3;
}

.yilla-reaction-bounce img {
  animation: yilla-sticker-bounce 1s ease-in-out 480ms 3;
}

.yilla-reaction-think img {
  animation: yilla-sticker-think 1.5s ease-in-out 480ms 3;
}

.yilla-reaction-float img {
  animation: yilla-sticker-float 1.45s ease-in-out 480ms 3;
}

.yilla-reaction-pop img {
  animation: yilla-sticker-pop 1.1s ease-in-out 480ms 3;
}

.yilla-reaction-groove img {
  animation: yilla-sticker-groove 1.15s ease-in-out 480ms 3;
}

.yilla-reaction-side-eye,
.yilla-reaction-think-again {
  background: linear-gradient(145deg, #fff8d9, #ffd9c4);
}

.yilla-reaction-side-eye img {
  object-position: right center;
  animation: yilla-sticker-side-eye 0.72s ease-in-out 480ms 4;
}

.yilla-reaction-think-again img {
  object-position: center;
  animation: yilla-sticker-think-again 1.05s ease-in-out 480ms 3;
}

.yilla-reaction-cat-dance,
.yilla-reaction-cat-heart,
.yilla-reaction-cheer {
  background: linear-gradient(145deg, #fff8e3, #ffd9d2);
}

.yilla-reaction-funny-think,
.yilla-reaction-doraemon {
  background: linear-gradient(145deg, #fff9d9, #dff0f4);
}

.yilla-reaction-fist-bump,
.yilla-reaction-knowing-look {
  background: linear-gradient(145deg, #fff8db, #dcefe7);
}

.yilla-reaction-repair-realize,
.yilla-reaction-repair-apologize,
.yilla-reaction-repair-reflect {
  border-color: rgba(143, 23, 32, 0.11);
  background: linear-gradient(145deg, #fffaf0, #f2e6dc);
  box-shadow: 0 10px 22px rgba(94, 39, 22, 0.1);
}

.yilla-reaction-repair-realize .yilla-reaction-spark,
.yilla-reaction-repair-apologize .yilla-reaction-spark,
.yilla-reaction-repair-reflect .yilla-reaction-spark {
  display: none;
}

.yilla-reaction-repair-realize .yilla-reaction-caption,
.yilla-reaction-repair-apologize .yilla-reaction-caption,
.yilla-reaction-repair-reflect .yilla-reaction-caption {
  color: #685146;
}

.yilla-reaction-cat-dance img {
  animation: yilla-sticker-cat-dance 0.82s ease-in-out 480ms 4;
}

.yilla-reaction-cat-heart img {
  animation: yilla-sticker-cat-heart 1.05s ease-in-out 480ms 3;
}

.yilla-reaction-cheer img {
  object-position: center;
  animation: yilla-sticker-cheer 0.78s ease-in-out 480ms 4;
}

.yilla-reaction-funny-think img {
  object-position: left center;
  animation: yilla-sticker-funny-think 1.15s ease-in-out 480ms 3;
}

.yilla-reaction-doraemon img {
  object-position: left center;
  animation: yilla-sticker-doraemon 0.92s ease-in-out 480ms 4;
}

.yilla-reaction-fist-bump img {
  object-position: center;
  animation: yilla-sticker-fist-bump 0.86s ease-in-out 480ms 4;
}

.yilla-reaction-knowing-look img {
  object-position: center 32%;
  animation: yilla-sticker-knowing-look 1.08s ease-in-out 480ms 3;
}

.yilla-reaction-repair-realize img {
  object-position: center 26%;
  animation: yilla-sticker-repair-realize 1.35s ease-in-out 480ms 2;
}

.yilla-reaction-repair-apologize img {
  object-position: center 24%;
  animation: yilla-sticker-repair-apologize 1.5s ease-in-out 480ms 2;
}

.yilla-reaction-repair-reflect img {
  object-position: center 24%;
  animation: yilla-sticker-repair-reflect 1.7s ease-in-out 480ms 2;
}

@keyframes yilla-reaction-arrive {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.78) rotate(5deg);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(-1deg);
  }
}

@keyframes yilla-reaction-sparkle {
  0%,
  100% {
    transform: scale(0.82) rotate(-8deg);
  }

  50% {
    transform: scale(1.12) rotate(9deg);
  }
}

@keyframes yilla-sticker-wave {
  0%,
  100% {
    transform: rotate(0deg);
  }

  35% {
    transform: rotate(-4deg) translateY(-3px);
  }

  70% {
    transform: rotate(4deg);
  }
}

@keyframes yilla-sticker-bounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  45% {
    transform: translateY(-8px) scale(1.035);
  }
}

@keyframes yilla-sticker-think {
  0%,
  100% {
    transform: rotate(0deg) translateY(0);
  }

  50% {
    transform: rotate(-3deg) translateY(-4px);
  }
}

@keyframes yilla-sticker-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

@keyframes yilla-sticker-pop {
  0%,
  100% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.07) rotate(-2deg);
  }

  70% {
    transform: scale(0.98) rotate(2deg);
  }
}

@keyframes yilla-sticker-groove {
  0%,
  100% {
    transform: rotate(0deg) translateY(0);
  }

  30% {
    transform: rotate(-4deg) translateY(-3px);
  }

  70% {
    transform: rotate(4deg) translateY(-3px);
  }
}

@keyframes yilla-sticker-side-eye {
  0%,
  100% {
    transform: translateX(0) rotate(0deg);
  }

  35% {
    transform: translateX(-4px) rotate(-1.5deg) scale(1.025);
  }

  70% {
    transform: translateX(3px) rotate(1deg);
  }
}

@keyframes yilla-sticker-think-again {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }

  45% {
    transform: translateY(-4px) rotate(2deg) scale(1.04);
  }

  72% {
    transform: translateY(1px) rotate(-1deg) scale(0.99);
  }
}

@keyframes yilla-sticker-cat-dance {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  25% {
    transform: translateY(-5px) rotate(-3deg);
  }

  70% {
    transform: translateY(-2px) rotate(3deg);
  }
}

@keyframes yilla-sticker-cat-heart {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.07) rotate(-1deg);
  }
}

@keyframes yilla-sticker-cheer {
  0%,
  100% {
    transform: translateY(0) scale(1.2);
  }

  50% {
    transform: translateY(-6px) scale(1.24);
  }
}

@keyframes yilla-sticker-funny-think {
  0%,
  100% {
    transform: translateX(0) scale(1.12) rotate(0deg);
  }

  45% {
    transform: translateX(-2px) scale(1.18) rotate(-2deg);
  }

  72% {
    transform: translateX(2px) scale(1.13) rotate(1deg);
  }
}

@keyframes yilla-sticker-doraemon {
  0%,
  100% {
    transform: scale(1.08) rotate(0deg);
  }

  35% {
    transform: scale(1.15) rotate(-2deg);
  }

  70% {
    transform: scale(1.1) rotate(2deg);
  }
}

@keyframes yilla-sticker-fist-bump {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }

  42% {
    transform: translateX(4px) scale(1.07);
  }

  68% {
    transform: translateX(-1px) scale(1.02);
  }
}

@keyframes yilla-sticker-knowing-look {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1.04);
  }

  45% {
    transform: translateY(-3px) rotate(-1.5deg) scale(1.08);
  }

  72% {
    transform: translateY(1px) rotate(1deg) scale(1.045);
  }
}

@keyframes yilla-sticker-repair-realize {
  0%,
  100% {
    transform: scale(1.02) translateY(0);
  }

  50% {
    transform: scale(1.055) translateY(-2px);
  }
}

@keyframes yilla-sticker-repair-apologize {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1.02);
  }

  45% {
    transform: translateY(4px) rotate(0.7deg) scale(1.01);
  }
}

@keyframes yilla-sticker-repair-reflect {
  0%,
  100% {
    transform: translateY(0) scale(1.025);
  }

  50% {
    transform: translateY(-2px) scale(1.045);
  }
}

@media (max-width: 640px) {
  body.mobile-panel-open {
    overflow: hidden;
  }

  .yilla-local-page .shell {
    width: min(100% - 22px, 1180px);
  }

  .yilla-runtime-entry-layout {
    grid-template-columns: 1fr;
  }

  .yilla-runtime-ready {
    min-height: 300px;
  }

  .yilla-runtime-ready-gallery {
    display: flex;
    min-height: 180px;
    gap: 0;
    overflow: hidden;
    padding: 12px 8px 22px;
  }

  .yilla-runtime-ready-gallery img {
    display: none;
    width: 100%;
    max-height: 190px;
  }

  .yilla-runtime-ready-gallery img:first-child {
    display: block;
  }

  .student-character-picker {
    padding: 15px;
  }

  .student-character-picker > p {
    margin-bottom: 10px;
  }

  .mobile-character-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 66px;
    padding: 9px 10px;
    border-radius: 17px;
    background: #fff;
  }

  #mobile-character-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: #73141a;
  }

  #mobile-character-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    object-position: center 18%;
    border-radius: 14px;
  }

  .mobile-character-placeholder {
    color: var(--muted);
    font-size: 13px;
  }

  .mobile-picker-heading,
  .mobile-drawer-heading {
    align-items: center;
    justify-content: space-between;
    color: #73141a;
    font-family: var(--font-display);
    font-size: 18px;
  }

  .student-character-grid {
    position: fixed;
    inset: auto 0 0;
    z-index: 81;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 74dvh;
    padding: 68px 14px max(18px, env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    background: #fffaf3;
    box-shadow: 0 -18px 50px rgba(70, 30, 20, 0.22);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 220ms ease, visibility 220ms;
  }

  .student-character-picker.is-mobile-open .student-character-grid {
    transform: translateY(0);
    visibility: visible;
  }

  .student-character-picker .mobile-picker-heading {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(74dvh - 58px);
    z-index: 82;
    display: none;
  }

  .student-character-picker.is-mobile-open .mobile-picker-heading {
    display: flex;
  }

  .student-character-option {
    min-height: 116px;
    padding: 8px 5px;
  }

  .student-character-option img {
    width: 66px;
    height: 70px;
  }

  .mobile-learning-tools {
    grid-area: tools;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-learning-tools .ghost-btn {
    min-height: 46px;
  }

  .yilla-local-page .local-chat {
    grid-template-areas:
      "header"
      "tools"
      "conversation";
    grid-template-columns: 1fr;
    padding-bottom: calc(158px + env(safe-area-inset-bottom));
  }

  .yilla-local-page .yilla-chat-header {
    padding: 14px;
  }

  .yilla-chat-identity p,
  .teacher-kicker {
    display: none;
  }

  .yilla-student-actions {
    width: 100%;
    grid-template-columns: 48px 1fr auto;
    justify-items: start;
  }

  .yilla-student-actions .ghost-btn {
    min-height: 44px;
    padding: 0 11px;
  }

  .yilla-local-page .yilla-chat-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 81;
    width: min(90vw, 390px);
    max-height: 100dvh;
    overflow-y: auto;
    padding: 18px;
    border-radius: 24px 0 0 24px;
    transform: translateX(105%);
    visibility: hidden;
    transition: transform 220ms ease, visibility 220ms;
  }

  .yilla-local-page .local-chat.is-context-open .yilla-chat-sidebar {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-drawer-heading {
    display: flex;
    position: sticky;
    top: -18px;
    z-index: 2;
    margin: -18px -18px 14px;
    padding: 14px 18px;
    background: rgba(255, 250, 243, 0.97);
    backdrop-filter: blur(10px);
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(45, 24, 18, 0.42);
  }

  .student-character-picker.is-mobile-open .mobile-overlay,
  .local-chat.is-context-open .mobile-overlay {
    display: block;
  }

  .yilla-local-page .local-messages {
    height: auto;
    min-height: 58dvh;
    max-height: none;
    padding: 14px 11px;
    overflow: visible;
    scroll-margin-bottom: 180px;
  }

  .yilla-local-page .local-composer {
    position: fixed;
    right: 0;
    bottom: var(--mobile-keyboard-offset, 0px);
    left: 0;
    z-index: 40;
    gap: 5px;
    padding: 8px 10px max(12px, env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 34px rgba(70, 30, 20, 0.16);
  }

  .yilla-local-page .local-composer label {
    font-size: 12px;
  }

  .yilla-local-page .local-composer textarea {
    min-height: 46px;
    max-height: 88px;
    padding: 10px 12px;
    font-size: 16px;
    line-height: 1.4;
  }

  .yilla-local-page .local-composer .local-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 7px;
    margin-top: 2px;
  }

  .yilla-local-page .local-composer .status-line {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .yilla-local-page .local-composer .primary-btn,
  .yilla-local-page .voice-input-btn {
    min-height: 44px;
    padding: 0 12px;
    white-space: nowrap;
  }

  .yilla-local-page .message {
    width: 100%;
    max-width: 100%;
  }

  .yilla-local-page .local-chat,
  .yilla-local-page .yilla-conversation,
  .yilla-local-page .local-chat .card-panel,
  .yilla-local-page .yilla-runtime-entry-layout > *,
  .yilla-local-page .yilla-form-card {
    min-width: 0;
  }

  .yilla-local-page .lesson-library-list,
  .yilla-local-page .lesson-preview-text,
  .yilla-local-page .local-context-text {
    overflow-wrap: anywhere;
  }

  .yilla-local-page .message-content-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    width: 100%;
  }

  .yilla-local-page .message-content-row .message-bubble {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 14px 44px 14px 14px;
    overflow-wrap: anywhere;
    font-size: 16px;
    line-height: 1.58;
  }

  .yilla-local-page .message.user .message-content-row {
    align-items: flex-end;
  }

  .yilla-local-page .message.user .message-bubble {
    width: min(92%, 560px);
    padding-right: 14px;
  }

  .yilla-reaction {
    order: -1;
    display: flex;
    flex: 0 0 auto;
    width: fit-content;
    max-width: 170px;
    min-height: 54px;
    align-self: flex-start;
    align-items: center;
    gap: 7px;
    padding: 4px 9px 4px 4px;
    border-radius: 17px;
  }

  .yilla-reaction-image {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .yilla-reaction-caption {
    margin: 0;
    font-size: 10px;
    line-height: 1.2;
    text-align: left;
  }

  .yilla-local-page .message.assistant .yilla-listen-button {
    right: 9px;
    bottom: 9px;
    width: 34px;
    height: 34px;
    opacity: 1;
  }

  .student-avatar-shell {
    width: 66px;
    height: 66px;
    flex-basis: 66px;
  }

  .student-avatar-shell img {
    width: 57px;
    height: 57px;
    border-radius: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yilla-reaction,
  .yilla-reaction img,
  .yilla-reaction-spark,
  .student-avatar-shell,
  .student-avatar-shell img,
  .student-avatar-orbit,
  .student-avatar-orbit circle,
  .student-avatar-orbit path,
  .student-avatar-spark,
  .yilla-chat-avatar-shell,
  .yilla-chat-avatar-shell img,
  .yilla-chat-avatar-orbit,
  .yilla-chat-avatar-orbit path,
  .yilla-chat-avatar-shell > i {
    animation: none !important;
  }
}
