/* MathFilm — Gia sư AI (home-matched 2.5D: navy / blue / orange) */

:root {
  --tutor-blue: #2f6bff;
  --tutor-blue-hi: #5b8cff;
  --tutor-blue-soft: #d6e6ff;
  --tutor-orange: #ff7a3d;
  --tutor-orange-hi: #ff9a5c;
  --tutor-orange-soft: #ffe4d4;
  --tutor-ink: #0f2942;
  --tutor-text: #1a3a5c;
  --tutor-muted: #5a7194;
  --tutor-line: #d0dced;
  --tutor-line-strong: #aebfd5;
  --tutor-panel: #ffffff;
  --tutor-panel-soft: #f7faff;
  --tutor-bg: #d9e6f7;
  --tutor-success: #0b8a74;
  --tutor-shadow-1:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 18px 40px rgba(15, 41, 66, 0.12),
    0 6px 14px rgba(47, 107, 255, 0.08),
    0 2px 4px rgba(15, 41, 66, 0.06);
  --tutor-shadow-2:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 22px 48px rgba(15, 41, 66, 0.14),
    0 8px 18px rgba(47, 107, 255, 0.1),
    0 3px 0 rgba(47, 107, 255, 0.08);
  --tutor-grad-cta: linear-gradient(135deg, #2f6bff 0%, #3d7aff 48%, #ff7a3d 100%);
  --tutor-grad-panel: linear-gradient(165deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 251, 255, 0.92) 48%, rgba(255, 244, 236, 0.88) 100%);
  --tutor-font-body: "Manrope", "Segoe UI", Tahoma, "Noto Sans", sans-serif;
  --tutor-font-display: "Outfit", "Manrope", "Segoe UI", Tahoma, sans-serif;
}

body.user-shell.tutor-page {
  overflow: hidden;
  color: var(--tutor-ink);
  font-family: var(--tutor-font-body);
  font-size: 15px;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  background-color: #d9e6f7;
  background-image:
    radial-gradient(ellipse 52% 48% at 12% 10%, rgba(255, 154, 92, 0.34), transparent 58%),
    radial-gradient(ellipse 48% 52% at 88% 18%, rgba(91, 140, 255, 0.38), transparent 55%),
    radial-gradient(ellipse 40% 40% at 70% 88%, rgba(255, 228, 212, 0.62), transparent 60%),
    radial-gradient(ellipse 36% 36% at 20% 80%, rgba(214, 230, 255, 0.75), transparent 58%),
    linear-gradient(145deg, #d4e4f8 0%, #e8eef8 38%, #f3e9e2 72%, #dbe8f7 100%);
}

body.user-shell.tutor-page .tutor-chat-title,
body.user-shell.tutor-page .tutor-stage-head > span,
body.user-shell.tutor-page .history-title {
  font-family: var(--tutor-font-display);
}

body.user-shell.tutor-page .tutor-message-bubble,
body.user-shell.tutor-page #tutor-textarea,
body.user-shell.tutor-page #air-textarea,
body.user-shell.tutor-page .tutor-empty,
body.user-shell.tutor-page .tutor-status,
body.user-shell.tutor-page .tutor-conv-title,
body.user-shell.tutor-page .tutor-conv-preview {
  font-size: 14px !important;
  line-height: 1.5 !important;
}

body.user-shell.tutor-page .tutor-message-bubble {
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-weight: 500 !important;
}

body.user-shell.tutor-page .air-one-item,
body.user-shell.tutor-page .air-one-item-stem,
body.user-shell.tutor-page .air-one-item-choice,
body.user-shell.tutor-page .air-one-item-choice-text,
body.user-shell.tutor-page .air-one-item-verdict,
body.user-shell.tutor-page .air-one-item-input {
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-weight: 500 !important;
}

body.user-shell.tutor-page .air-one-item-submit {
  font-size: 12px !important;
  line-height: 1.2 !important;
  font-weight: 750 !important;
}

body.user-shell.tutor-page .air-one-item-key {
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 750 !important;
}

/* Override edu-atmosphere `button { font-size: 20px !important }` */
body.user-shell.tutor-page .header-action {
  font-size: 13px !important;
  line-height: 1.1 !important;
}

body.user-shell.tutor-page .tutor-msg-action,
body.user-shell.tutor-page .tutor-msg-simulate {
  font-size: 9px !important;
  line-height: 1 !important;
}

body.user-shell.tutor-page .tutor-simulate-label,
body.user-shell.tutor-page .tutor-simulate-timer {
  font-size: 9px !important;
  line-height: 1 !important;
}

body.user-shell.tutor-page button,
body.user-shell.tutor-page textarea,
body.user-shell.tutor-page input {
  font-family: inherit;
}

body.user-shell.tutor-page button {
  cursor: pointer;
}

.tutor-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: transparent;
  position: relative;
}

body.user-shell.tutor-page .shell-content-column {
  position: relative;
  z-index: 1;
}

.tutor-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  margin: 0;
}

.tutor-main {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
  gap: 12px;
}

/* Stage */
.tutor-stage-wrap {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: var(--tutor-grad-panel);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--tutor-shadow-1);
}

.tutor-stage-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  border-top: 2px solid rgba(255, 255, 255, 0.95);
  border-left: 1px solid rgba(255, 255, 255, 0.7);
  background:
    radial-gradient(circle at 78% 10%, rgba(255, 122, 61, 0.14), transparent 28%),
    radial-gradient(circle at 18% 88%, rgba(47, 107, 255, 0.12), transparent 30%);
  z-index: 2;
}

.tutor-stage-head {
  min-height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(174, 191, 213, 0.55);
  border-top: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.78));
  color: var(--tutor-ink);
  font-size: 15px !important;
  font-weight: 800;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 9;
}

.tutor-stage-head .tutor-context-chip {
  margin-left: auto;
  max-width: min(320px, 40vw);
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--tutor-blue-soft), #fff6f0 55%, var(--tutor-orange-soft));
  border: 1px solid var(--tutor-line);
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 rgba(47, 107, 255, 0.06);
  color: var(--tutor-text);
  font-size: 12px;
  font-weight: 750;
}

.tutor-stage-head .tutor-context-chip[hidden] {
  display: none !important;
}

#tutor-context-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tutor-context-dismiss {
  width: 23px;
  height: 23px;
  border: 0;
  border-radius: 7px;
  background: #fff;
  color: #7087a3;
  flex-shrink: 0;
}

.tutor-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 3;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px 10px 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 34%),
    radial-gradient(circle at 50% 78%, rgba(255, 255, 255, 0.96), transparent 26%),
    linear-gradient(150deg, #e9f3ff 0%, #f8fbff 46%, #fff0e4 100%);
}

.tutor-stage-frame {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 6%;
  bottom: 8%;
  border-radius: 10px;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.56));
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-bottom-color: #d8e4f0;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    inset 0 -4px 0 rgba(71, 101, 139, 0.03),
    0 7px 0 rgba(42, 80, 127, 0.025),
    0 18px 40px rgba(48, 80, 119, 0.07);
}

.tutor-stage::before,
.tutor-stage::after {
  display: none;
}

/* Code-drawn SVG puppet character (animated body + lipsync) */
.tutor-character-host {
  position: absolute;
  z-index: 3;
  left: 6%;
  right: 6%;
  top: 4%;
  bottom: 8%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

.tutor-puppet,
.tutor-character-sprite,
.tutor-character-static {
  --mouth-open: 0;
  --tp-breath: 0.5;
  --tp-sway: 0deg;
  --tp-talk: 0;
  --tp-arm: 0deg;
  --tp-mascot-y: 0px;
  width: min(82%, 300px);
  height: auto;
  max-height: 100%;
  aspect-ratio: 200 / 280;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
  flex-shrink: 0;
  transform-origin: 50% 100%;
}

.tutor-puppet-glow {
  --tp-accent: #2f6bff;
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 1%;
  height: 14%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--tp-accent) 40%, transparent), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}

.tutor-puppet-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform:
    translateY(calc((var(--tp-breath) - 0.5) * -6px))
    rotate(var(--tp-sway));
  transform-origin: 50% 100%;
}

.tutor-puppet .tp-figure {
  transform-origin: 100px 250px;
  transform: scale(1, calc(1 + (var(--tp-breath) - 0.5) * 0.018));
}

.tutor-puppet .tp-head {
  transform-origin: 100px 120px;
  transform: rotate(calc(var(--tp-sway) * -0.35 + var(--tp-talk) * 0.4deg));
  transition: transform 0.2s ease;
}

.tutor-puppet .tp-arm-left {
  transform-origin: 68px 168px;
  transform: rotate(calc(var(--tp-arm) * -1));
}

.tutor-puppet .tp-arm-right {
  transform-origin: 132px 168px;
  transform: rotate(var(--tp-arm));
}

.tutor-puppet .tp-mascot-body {
  transform: translateY(var(--tp-mascot-y));
}

.tutor-puppet .tp-mouth {
  transition: d 0.05s linear, fill 0.05s linear;
}

.tutor-puppet.is-blinking .tp-lid {
  height: 16px;
}

.tutor-puppet[data-expression="thinking"] .tp-head {
  transform: rotate(-6deg) translate(2px, 1px);
}

.tutor-puppet[data-expression="listening"] .tp-head {
  transform: rotate(4deg) translate(-1px, 0);
}

.tutor-puppet[data-state="speaking"] .tp-mascot-eye {
  fill: #ff9a5c;
}

.tutor-character-glow,
.tutor-character-art,
.tutor-mouth-stage {
  display: none;
}

.tutor-character-avatar {
  width: 100%;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 35%, #fff 0 29%, transparent 30%),
    linear-gradient(145deg, #d8e8ff, #fff0e4);
  border: 1px solid #dfe8f3;
  position: relative;
}

.tutor-character-face {
  position: absolute;
  inset: 28% 28% auto;
  height: 12%;
  display: flex;
  justify-content: space-between;
}

.tutor-character-eye {
  width: 16%;
  height: 100%;
  border-radius: 50%;
  background: #2a5078;
}

.tutor-character-mouth {
  position: absolute;
  left: 50%;
  bottom: 32%;
  transform: translateX(-50%);
  width: 18%;
  height: 8%;
  border-radius: 999px;
  background: rgba(42, 80, 120, 0.75);
}

.tutor-status {
  position: absolute;
  z-index: 9;
  top: 16px;
  left: 16px;
  min-height: 35px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 #fff,
    0 3px 0 rgba(15, 41, 66, 0.06),
    0 12px 22px rgba(15, 41, 66, 0.1);
  font-size: 12px;
  font-weight: 800;
  color: var(--tutor-text);
}

.tutor-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tutor-success);
  box-shadow: 0 0 0 4px rgba(11, 138, 116, 0.16);
}

.tutor-subtitle {
  position: absolute;
  z-index: 10;
  left: 10%;
  right: 10%;
  bottom: 12px;
  margin: auto;
  max-width: 520px;
  padding: 10px 14px;
  border-radius: 9px;
  background: rgba(17, 44, 77, 0.86);
  color: #fff;
  text-align: center;
  box-shadow: 0 5px 0 rgba(15, 39, 68, 0.08), 0 12px 24px rgba(15, 39, 68, 0.16);
  backdrop-filter: blur(10px);
  font-size: 12px;
  line-height: 1.45;
}

.tutor-subtitle,
.tutor-subtitle[hidden] {
  display: none !important;
}

/* Chat */
.tutor-chat {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: var(--tutor-grad-panel);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--tutor-shadow-2);
  position: relative;
}

.tutor-chat::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(circle at 86% 8%, rgba(255, 122, 61, 0.12), transparent 26%),
    radial-gradient(circle at 12% 92%, rgba(47, 107, 255, 0.1), transparent 28%);
  z-index: 0;
}

.tutor-chat > * {
  position: relative;
  z-index: 1;
}

.tutor-chat-head {
  min-height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(174, 191, 213, 0.55);
  border-top: 2px solid rgba(255, 255, 255, 0.95);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 255, 0.78));
  position: relative;
  z-index: 20;
  overflow: visible;
}

.tutor-chat-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--tutor-ink);
  letter-spacing: -0.02em;
}

.tutor-chat-spacer {
  flex: 1;
}

.chat-head-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
}

.tutor-history-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tutor-history-dropdown {
  position: fixed;
  z-index: 1200;
  width: min(280px, calc(100vw - 28px));
  max-height: min(320px, 50vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #d5e0ee;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 3px 0 rgba(15, 41, 66, 0.06),
    0 16px 32px rgba(15, 41, 66, 0.14);
}

.tutor-history-dropdown[hidden] {
  display: none !important;
}

.tutor-history-dropdown .history-list {
  min-height: 0;
  max-height: min(320px, 50vh);
  overflow: auto;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.55) transparent;
}

.tutor-history-dropdown .history-list::-webkit-scrollbar {
  width: 6px;
}

.tutor-history-dropdown .history-list::-webkit-scrollbar-track {
  background: transparent;
}

.tutor-history-dropdown .history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  border: 1px solid rgba(210, 220, 235, 0.35);
}

.tutor-history-dropdown .history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.78);
}

.tutor-history-dropdown .tutor-conv-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: 8px;
}

.tutor-history-dropdown .tutor-conv-row:hover,
.tutor-history-dropdown .tutor-conv-row.is-active {
  background: #eef4ff;
}

.tutor-history-dropdown .tutor-conv-row.is-active {
  background: linear-gradient(145deg, #e8f0ff, #dce9ff);
}

.tutor-history-dropdown .tutor-conv-open {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
  padding: 8px 8px 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tutor-ink);
  cursor: pointer;
}

.tutor-history-dropdown .tutor-conv-hide {
  flex: 0 0 30px;
  width: 30px;
  align-self: center;
  display: grid;
  place-items: center;
  margin-right: 4px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #8aa0bb;
  cursor: pointer;
}

.tutor-history-dropdown .tutor-conv-hide:hover,
.tutor-history-dropdown .tutor-conv-hide:focus-visible {
  background: #ffe8e8;
  color: #c44d4d;
  outline: none;
}

.tutor-history-dropdown .tutor-conv-hide svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutor-history-dropdown .tutor-conv-title {
  font-size: 12px;
  font-weight: 800;
  color: #0f2942;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tutor-history-dropdown .tutor-conv-preview {
  font-size: 11px;
  color: #5a7194;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tutor-history-dropdown .history-empty {
  padding: 14px 10px;
  text-align: center;
  color: #7c90aa;
  font-size: 12px;
  font-weight: 650;
}

.header-action {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 750;
  border: 1px solid var(--tutor-line);
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 55%, #eef3fa 100%);
  color: var(--tutor-text);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 rgba(15, 41, 66, 0.06),
    0 5px 10px rgba(15, 41, 66, 0.06);
  transition: 0.16s ease;
  white-space: nowrap;
}

.header-action:hover {
  transform: translateY(-1px);
  border-color: #b7c9e0;
  box-shadow:
    inset 0 1px 0 #fff,
    0 3px 0 rgba(15, 41, 66, 0.07),
    0 10px 16px rgba(47, 107, 255, 0.1);
}

.header-action.primary {
  color: #fff;
  border-color: transparent;
  background: var(--tutor-grad-cta);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 0 rgba(35, 82, 190, 0.14),
    0 8px 14px rgba(47, 107, 255, 0.18);
}

.header-action.is-muted {
  opacity: 0.72;
  color: #7c90aa;
}

.header-action .ico {
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.header-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutor-error-banner {
  margin: 10px 14px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff0f0;
  border: 1px solid #ffd6d6;
  color: #b34d4d;
  font-size: 12px;
  font-weight: 750;
}

.tutor-error-banner[hidden] {
  display: none !important;
}

.tutor-thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px clamp(15px, 2vw, 24px) 22px;
  scroll-behavior: smooth;
  background:
    radial-gradient(circle at 93% 5%, rgba(47, 107, 255, 0.07), transparent 18%),
    radial-gradient(circle at 8% 90%, rgba(255, 122, 61, 0.06), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(247, 251, 255, 0.72));
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.55) transparent;
}

.tutor-thread::-webkit-scrollbar {
  width: 6px;
}

.tutor-thread::-webkit-scrollbar-track {
  background: transparent;
}

.tutor-thread::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  border: 1px solid rgba(210, 220, 235, 0.35);
}

.tutor-thread::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.78);
}

.tutor-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  color: var(--tutor-muted);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 600;
}

.tutor-empty::before {
  content: "✦";
  width: 68px;
  height: 68px;
  margin-bottom: 14px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-size: 26px;
  background: var(--tutor-grad-cta);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.34),
    0 5px 0 rgba(47, 107, 255, 0.14),
    0 16px 28px rgba(47, 107, 255, 0.22);
}

.tutor-empty::after {
  content: "Gõ câu hỏi, nói bằng giọng nói hoặc gửi ảnh bài tập.";
  margin-top: 7px;
  display: block;
  color: #97a6b8;
  font-size: 12px;
}

.tutor-message {
  display: flex;
  gap: 9px;
  margin-bottom: 12px;
}

.tutor-message.user,
.tutor-message[data-role="user"] {
  justify-content: flex-end;
}

.tutor-message.assistant,
.tutor-message[data-role="assistant"] {
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.tutor-message-bubble {
  max-width: 80%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 3px 0 rgba(47, 107, 255, 0.06),
    0 10px 18px rgba(47, 107, 255, 0.08);
}

.tutor-message.user .tutor-message-bubble,
.tutor-message[data-role="user"] .tutor-message-bubble {
  background: linear-gradient(145deg, #2f6bff 0%, #3d7aff 55%, #5b8cff 100%);
  border: 1px solid #2a62ef;
  color: #fff;
  border-bottom-right-radius: 5px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 3px 0 rgba(35, 82, 190, 0.14),
    0 10px 18px rgba(47, 107, 255, 0.18);
}

.tutor-message.assistant .tutor-message-bubble,
.tutor-message[data-role="assistant"] .tutor-message-bubble {
  background: linear-gradient(145deg, #ffffff 0%, #f3f7ff 48%, #dce9ff 100%);
  border: 1px solid #b7ccef;
  color: #0f2942;
  border-bottom-left-radius: 5px;
  max-width: 80%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 3px 0 rgba(47, 107, 255, 0.08),
    0 12px 20px rgba(47, 107, 255, 0.1);
}

.tutor-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
  width: 100%;
  max-width: 100%;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.tutor-msg-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 20px;
  min-height: 20px;
  max-height: 20px;
  border: 1px solid var(--tutor-line);
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
  color: var(--tutor-text);
  border-radius: 6px;
  padding: 0 6px;
  font-size: 9px !important;
  font-weight: 750;
  line-height: 1 !important;
  cursor: pointer;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(15, 41, 66, 0.07),
    0 4px 8px rgba(15, 41, 66, 0.06);
}

.tutor-msg-speak {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-radius: 6px;
}

.tutor-msg-action svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutor-msg-speak.is-playing {
  color: var(--tutor-blue);
  border-color: #9fc0f0;
  background: linear-gradient(180deg, #f7fbff 0%, #eaf3ff 100%);
}

.tutor-msg-speak .tutor-icon-stop {
  fill: currentColor;
  stroke: none;
}

.tutor-msg-action:hover:not(:disabled) {
  border-color: #9fc0f0;
  color: var(--tutor-blue);
  background: linear-gradient(180deg, #f7fbff 0%, #eaf3ff 100%);
  transform: translateY(-1px);
}

.tutor-msg-action:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 1px 0 rgba(58, 88, 126, 0.08);
}

.tutor-msg-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.tutor-msg-simulate {
  height: 20px;
  min-height: 20px;
  max-height: 20px;
  padding: 0 6px;
  font-size: 9px !important;
  line-height: 1 !important;
  white-space: nowrap;
  border-color: #b7ccef;
  color: #2f6bff;
  background: linear-gradient(180deg, #ffffff 0%, #e8f0ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(47, 107, 255, 0.12),
    0 4px 8px rgba(47, 107, 255, 0.1);
}

.tutor-msg-simulate:hover:not(:disabled) {
  border-color: #9fc0f0;
  color: #1f56d8;
  background: linear-gradient(180deg, #f7fbff 0%, #dce9ff 100%);
}

.tutor-msg-simulate.is-ready {
  height: 20px;
  min-height: 20px;
  border-color: #2f6bff;
  color: #fff;
  background: linear-gradient(145deg, #2f6bff, #3d7aff 55%, #5b8cff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 0 rgba(35, 82, 190, 0.14),
    0 6px 10px rgba(47, 107, 255, 0.16);
}

.tutor-simulate-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 20px;
  min-height: 20px;
  min-width: 0;
  max-width: 220px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid #b7ccef;
  background: linear-gradient(180deg, #ffffff 0%, #e8f0ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(47, 107, 255, 0.1),
    0 4px 8px rgba(47, 107, 255, 0.1);
}

.tutor-simulate-skeleton {
  display: none;
}

.tutor-simulate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.tutor-simulate-label {
  color: #2f6bff;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.tutor-simulate-timer {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(47, 107, 255, 0.14);
  color: #1f56d8;
  font-size: 9px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 14px;
}

.tutor-skeleton .tutor-skeleton-bubble {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.tutor-skeleton-line {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef3f9 0%, #f7fafc 45%, #eef3f9 100%);
  background-size: 200% 100%;
  animation: tutor-skeleton 1.2s ease-in-out infinite;
}

.tutor-skeleton-line.short {
  width: 62%;
}

@keyframes tutor-skeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.tutor-thread img {
  display: block;
  max-width: min(100%, 420px);
  margin-top: 8px;
  border-radius: 9px;
  border: 1px solid var(--tutor-line);
  box-shadow: 0 4px 0 rgba(43, 77, 116, 0.04), 0 12px 22px rgba(43, 77, 116, 0.08);
}

.tutor-typing {
  color: #7086a2;
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 14px;
}

/* Composer */
.tutor-composer-wrap {
  flex: 0 0 auto;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(174, 191, 213, 0.5);
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.9), rgba(255, 255, 255, 0.98));
}

.tutor-attachment-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #f6f9fc;
  border: 1px solid #e2eaf3;
}

.tutor-attachment-preview[hidden] {
  display: none !important;
}

.tutor-attachment-preview img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--tutor-line);
}

.tutor-composer-field {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
}

.tutor-recording {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 251, 247, 0.96);
  color: #c56a31;
  pointer-events: none;
  z-index: 2;
}

.tutor-recording[hidden] {
  display: none !important;
}

.tutor-composer.is-recording #tutor-textarea,
.tutor-composer.is-voice-processing #tutor-textarea,
.tutor-composer.is-recording #air-textarea,
.tutor-composer.is-voice-processing #air-textarea,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-recording #tutor-textarea,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-voice-processing #tutor-textarea,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-recording #air-textarea,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-voice-processing #air-textarea,
body.user-shell.tutor-page .tutor-composer.is-recording #tutor-textarea,
body.user-shell.tutor-page .tutor-composer.is-voice-processing #tutor-textarea,
body.user-shell.tutor-page .tutor-composer.is-recording #air-textarea,
body.user-shell.tutor-page .tutor-composer.is-voice-processing #air-textarea {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: transparent !important;
  pointer-events: none;
}

.tutor-composer.is-recording #tutor-textarea::placeholder,
.tutor-composer.is-voice-processing #tutor-textarea::placeholder,
.tutor-composer.is-recording #air-textarea::placeholder,
.tutor-composer.is-voice-processing #air-textarea::placeholder,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-recording #tutor-textarea::placeholder,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-voice-processing #tutor-textarea::placeholder,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-recording #air-textarea::placeholder,
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer.is-voice-processing #air-textarea::placeholder,
body.user-shell.tutor-page .tutor-composer.is-recording #tutor-textarea::placeholder,
body.user-shell.tutor-page .tutor-composer.is-voice-processing #tutor-textarea::placeholder,
body.user-shell.tutor-page .tutor-composer.is-recording #air-textarea::placeholder,
body.user-shell.tutor-page .tutor-composer.is-voice-processing #air-textarea::placeholder {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}

.tutor-recording-countdown {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: #ff7b32;
  font-weight: 600;
}

.tutor-recording-countdown[hidden] {
  display: none !important;
}

.tutor-recording-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
  width: min(100%, 280px);
}

.tutor-recording-wave[hidden] {
  display: none !important;
}

.tutor-recording-wave .wave {
  flex: 1 1 0;
  max-width: 4px;
  min-width: 2px;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffb27a, #ff7b32);
  transform-origin: center;
  animation: tutor-rec-wave 0.9s ease-in-out infinite;
}

.tutor-recording-wave .wave:nth-child(1) { animation-delay: 0s; }
.tutor-recording-wave .wave:nth-child(2) { animation-delay: 0.05s; }
.tutor-recording-wave .wave:nth-child(3) { animation-delay: 0.1s; }
.tutor-recording-wave .wave:nth-child(4) { animation-delay: 0.15s; }
.tutor-recording-wave .wave:nth-child(5) { animation-delay: 0.2s; }
.tutor-recording-wave .wave:nth-child(6) { animation-delay: 0.25s; }
.tutor-recording-wave .wave:nth-child(7) { animation-delay: 0.3s; }
.tutor-recording-wave .wave:nth-child(8) { animation-delay: 0.35s; }
.tutor-recording-wave .wave:nth-child(9) { animation-delay: 0.4s; }
.tutor-recording-wave .wave:nth-child(10) { animation-delay: 0.45s; }
.tutor-recording-wave .wave:nth-child(11) { animation-delay: 0.5s; }
.tutor-recording-wave .wave:nth-child(12) { animation-delay: 0.55s; }
.tutor-recording-wave .wave:nth-child(13) { animation-delay: 0.6s; }
.tutor-recording-wave .wave:nth-child(14) { animation-delay: 0.65s; }
.tutor-recording-wave .wave:nth-child(15) { animation-delay: 0.7s; }
.tutor-recording-wave .wave:nth-child(16) { animation-delay: 0.75s; }
.tutor-recording-wave .wave:nth-child(17) { animation-delay: 0.8s; }
.tutor-recording-wave .wave:nth-child(18) { animation-delay: 0.85s; }

@keyframes tutor-rec-wave {
  0%, 100% { transform: scaleY(0.28); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 1; }
}

.tutor-recording-loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: min(100%, 240px);
}

.tutor-recording-loading[hidden] {
  display: none !important;
}

.tutor-recording-loading-bar {
  display: block;
  height: 8px;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #e8eef5 0%, #f7fafc 45%, #e8eef5 90%);
  background-size: 200% 100%;
  animation: tutor-recording-loading 1.15s ease-in-out infinite;
}

.tutor-recording-loading-bar.short {
  width: 62%;
  align-self: center;
}

@keyframes tutor-recording-loading {
  0% { background-position: 100% 0; opacity: 0.7; }
  50% { background-position: 0% 0; opacity: 1; }
  100% { background-position: -100% 0; opacity: 0.7; }
}

.tutor-composer {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e8eef5;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 0 rgba(222, 233, 248, 0.9),
    0 6px 14px rgba(15, 41, 66, 0.06);
  transition: 0.16s ease;
}

.tutor-composer:focus-within {
  background: #fff;
  border-color: #c5d6ef;
  box-shadow:
    0 0 0 3px rgba(47, 107, 255, 0.08),
    inset 0 1px 0 #fff,
    0 6px 14px rgba(15, 41, 66, 0.07);
}

.tutor-icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--tutor-line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f7fb 100%);
  color: var(--tutor-text);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 rgba(15, 41, 66, 0.07),
    0 6px 12px rgba(15, 41, 66, 0.08);
}

#tutor-plus-btn,
#air-plus-btn,
#tutor-mic-btn,
#air-mic-btn {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

#tutor-plus-btn,
#air-plus-btn {
  font-size: 20px;
  line-height: 1;
}

#tutor-plus-btn:hover,
#air-plus-btn:hover {
  background: var(--tutor-orange-soft);
  color: var(--tutor-orange);
  border-color: #ffd6bb;
}

.tutor-mic-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.tutor-mic-btn:hover {
  background: var(--tutor-blue-soft);
  color: var(--tutor-blue);
  border-color: #d5e4fb;
}

.tutor-mic-btn.is-recording {
  background: var(--tutor-orange-soft);
  color: var(--tutor-orange);
  border-color: #ffd6bb;
  animation: tutor-mic-pulse 1.2s ease infinite;
}

@keyframes tutor-mic-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 #fff, 0 0 0 0 rgba(255, 123, 50, 0.35); }
  50% { box-shadow: inset 0 1px 0 #fff, 0 0 0 6px rgba(255, 123, 50, 0.12); }
}

#tutor-textarea,
#air-textarea {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  max-height: 88px;
  padding: 6px 4px;
  resize: none;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  color: #0f2942 !important;
  -webkit-text-fill-color: #0f2942 !important;
  caret-color: #0f2942 !important;
  box-shadow: none !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  font-weight: 600;
}

#tutor-textarea::placeholder,
#air-textarea::placeholder {
  color: #7f93ad !important;
  -webkit-text-fill-color: #7f93ad !important;
  font-weight: 500;
  opacity: 1 !important;
}

/* Keep chat composer light even when app theme is dark. */
html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer,
body.user-shell.tutor-page .tutor-composer {
  background: #ffffff !important;
  border-color: #e8eef5 !important;
}

html[data-theme="dark"] body.user-shell.tutor-page #tutor-textarea,
html[data-theme="dark"] body.user-shell.tutor-page #air-textarea,
body.user-shell.tutor-page #tutor-textarea,
body.user-shell.tutor-page #air-textarea {
  background: transparent !important;
  color: #0f2942 !important;
  -webkit-text-fill-color: #0f2942 !important;
  caret-color: #0f2942 !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body.user-shell.tutor-page #tutor-textarea::placeholder,
html[data-theme="dark"] body.user-shell.tutor-page #air-textarea::placeholder,
body.user-shell.tutor-page #tutor-textarea::placeholder,
body.user-shell.tutor-page #air-textarea::placeholder {
  color: #7f93ad !important;
  -webkit-text-fill-color: #7f93ad !important;
  opacity: 1 !important;
}

html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 0 rgba(222, 233, 248, 0.9),
    0 6px 14px rgba(15, 41, 66, 0.06) !important;
}

html[data-theme="dark"] body.user-shell.tutor-page .tutor-composer:focus-within {
  background: #ffffff !important;
  border-color: #c5d6ef !important;
}

.tutor-send-btn {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--tutor-grad-cta);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 3px 0 rgba(35, 82, 190, 0.16),
    0 10px 16px rgba(47, 107, 255, 0.22);
  transition: 0.16s ease;
}

.tutor-send-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutor-send-btn:hover {
  transform: translateY(-1px);
}

.tutor-send-btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* Plus attach dropdown */
.tutor-plus-wrap {
  position: relative;
  flex: 0 0 auto;
}

.tutor-plus-menu {
  position: fixed;
  z-index: 1200;
  min-width: 148px;
  padding: 4px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #dce6f0;
  box-shadow:
    0 1px 0 rgba(41, 72, 109, 0.04),
    0 10px 24px rgba(20, 52, 90, 0.14);
}

.tutor-plus-menu[hidden] {
  display: none !important;
}

.tutor-plus-menu button {
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4a6688;
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
}

.tutor-plus-menu button:hover,
.tutor-plus-menu button:focus-visible {
  background: #f3f7fc;
  outline: none;
}

#tutor-attach-upload::before {
  content: "🖼️  ";
}

#tutor-attach-capture::before {
  content: "📷  ";
}

.history-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(174, 191, 213, 0.55);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 251, 255, 0.82));
}

.history-title {
  flex: 1;
  font-size: 14px;
  font-weight: 900;
  color: #315476;
}

.history-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.history-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.history-list button {
  width: 100%;
  display: block;
  padding: 11px 12px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #4d6b89;
  text-align: left;
}

.history-list button:hover {
  background: #f3f7fb;
  border-color: #e6edf5;
}

.history-list button.active,
.history-list button[aria-current="true"] {
  background: linear-gradient(135deg, #edf4ff, #fff5ed);
  border-color: #dfe8f2;
  color: #285a94;
  box-shadow: inset 3px 0 0 var(--tutor-blue);
}

.tutor-conv-title {
  font-weight: 850;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tutor-conv-preview {
  margin-top: 4px;
  font-size: 12px;
  color: #8a9bb0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-empty {
  padding: 34px 20px;
  text-align: center;
  color: #8a9bb0;
  font-size: 13px;
}

/* Tablet */
@media (max-width: 1100px) {
  .tutor-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 38fr) minmax(0, 62fr);
    gap: 10px;
  }

  .tutor-stage-wrap,
  .tutor-chat {
    border-radius: 10px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .tutor-body {
    max-width: none;
  }

  .tutor-main {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 36fr) minmax(0, 64fr);
    gap: 8px;
  }

  .tutor-stage-wrap {
    border: 0;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 5px 0 rgba(44, 76, 114, 0.03), 0 12px 24px rgba(44, 76, 114, 0.07);
  }

  .tutor-stage-head {
    min-height: 50px;
    flex-basis: 50px;
    padding: 0 12px;
  }

  .tutor-stage-head .tutor-context-chip {
    max-width: 46vw;
    min-height: 28px;
    font-size: 11px;
  }

  .tutor-stage-frame {
    left: 6%;
    right: 6%;
    top: 5%;
    bottom: 6%;
  }

  .tutor-character-host {
    left: 8%;
    right: 8%;
    top: 6%;
    bottom: 8%;
  }

  .tutor-puppet,
  .tutor-character-sprite,
  .tutor-character-static {
    width: min(72%, 210px);
  }

  .tutor-mouth-stage {
    /* keep manifest-driven anchor; only nudge size on narrow screens */
    width: calc(var(--mouth-width, 11.2%) + 1.2%);
  }

  .tutor-character-avatar {
    width: min(100%, 150px);
    max-height: 150px;
  }

  .tutor-status {
    top: 9px;
    left: 9px;
    min-height: 31px;
    border-radius: 7px;
    font-size: 11px;
  }

  .tutor-subtitle {
    left: 9px;
    right: 9px;
    bottom: 9px;
    padding: 9px 11px;
    border-radius: 7px;
    font-size: 12px;
  }

  .tutor-chat {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .tutor-chat-head {
    min-height: 50px;
    padding: 0 10px;
  }

  .chat-head-actions {
    gap: 6px;
  }

  .header-action {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
  }

  .header-action .label {
    display: none;
  }

  .header-action .ico {
    font-size: 12px;
  }

  .tutor-thread {
    padding: 13px 10px 15px;
  }

  .tutor-empty {
    padding: 20px 15px;
    font-size: 13px;
  }

  .tutor-empty::before {
    width: 56px;
    height: 56px;
    border-radius: 9px;
    font-size: 22px;
  }

  .tutor-composer-wrap {
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
  }

  .tutor-composer {
    min-height: 42px;
    padding: 4px;
    gap: 5px;
    border-radius: 9px;
  }

  #tutor-plus-btn,
  #tutor-mic-btn,
  #air-mic-btn {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 8px;
  }

  .tutor-send-btn {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 8px;
  }

  #tutor-textarea,
  #air-textarea {
    min-height: 32px;
    max-height: 88px;
    padding: 6px 4px;
    font-size: 16px;
  }

  .tutor-message-bubble {
    max-width: 88%;
    border-radius: 9px;
  }

  .tutor-body.keyboard-open .tutor-main {
    grid-template-rows: minmax(0, 28fr) minmax(0, 72fr);
  }

  .tutor-body.keyboard-open .tutor-stage-wrap {
    min-height: 96px;
  }
}

@media (max-width: 767px) and (max-height: 620px) {
  .tutor-main {
    grid-template-rows: minmax(0, 30fr) minmax(0, 70fr);
  }

  .tutor-puppet,
  .tutor-character-sprite,
  .tutor-character-static {
    width: min(64%, 150px);
  }

  .tutor-subtitle {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tutor-mic-btn.is-recording {
    animation: none;
  }

  .tutor-puppet,
  .tutor-character-sprite,
  .tutor-character-static {
    animation: none;
  }

  .tutor-puppet-svg,
  .tutor-puppet .tp-figure,
  .tutor-puppet .tp-head,
  .tutor-puppet .tp-arm-left,
  .tutor-puppet .tp-arm-right,
  .tutor-puppet .tp-mascot-body {
    transform: none !important;
  }

  .tutor-character-mouth,
  .tutor-mouth-path,
  .tutor-puppet .tp-mouth {
    transition: none;
  }

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
