/* IELTS lesson tutor: a right-side drawer on desktop, a bottom sheet on phones. Vidi game style (vidi-game.css):
   a night header with the otter, a light message area, bevelled corners instead of rounded ones, and bevelled aqua /
   gold buttons with the hover shine. Self-contained (colours repeat vidi-game.css) so it works on any page.
   Radii need !important because landing-edu/styles.css forces square corners. */
#study-tutor, .st-inline { --st-night: #140f2e; --st-aqua: #56dadc; --st-violet: #8a72f6; --st-violet-lite: #b9a8ff; --st-gold: #ffc83d; --st-ink: #141225; --st-line: #e3def5; --st-paper: #f7f5fd;
  font-family: "Be Vietnam Pro", system-ui, "Segoe UI", Arial, sans-serif; }
#study-tutor { color: var(--st-ink); font-size: 15px; line-height: 1.55; }
#study-tutor *, #study-tutor *::before, #study-tutor *::after { box-sizing: border-box; }
#study-tutor [hidden] { display: none !important; }
#study-tutor button, #study-tutor textarea { font: inherit; }
#study-tutor :is(button, a, textarea, .st-log):focus-visible, .st-inline:focus-visible { outline: 3px solid var(--st-violet); outline-offset: 2px; }
.st-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#study-tutor svg path, .st-inline svg path { fill: currentColor; }

/* Launchers: the floating one is a night bevelled button with an aqua spark; the one in the page header is aqua. */
#study-tutor .st-launch, .st-inline { position: relative; overflow: hidden; cursor: pointer; border: 0 !important; border-radius: 0 !important;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); transition: transform .18s, filter .18s; }
#study-tutor .st-launch::before, .st-inline::before { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .5) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .6s; pointer-events: none; }
#study-tutor .st-launch:hover, .st-inline:hover { transform: translateY(-2px); filter: brightness(1.06); }
#study-tutor .st-launch:hover::before, .st-inline:hover::before { transform: translateX(120%); }
#study-tutor .st-launch { position: fixed; z-index: 181; right: 22px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; color: #fff; font-weight: 800; font-size: 14px; box-shadow: inset 0 0 0 2px rgba(86, 218, 220, .65);
  background: radial-gradient(120px 60px at 80% -20%, rgba(138, 114, 246, .7), transparent 70%), var(--st-night); }
#study-tutor .st-launch svg { color: var(--st-aqua); filter: drop-shadow(0 0 5px rgba(86, 218, 220, .9)); }
.st-inline { display: inline-flex; align-items: center; gap: 8px; margin: -6px 0 18px; min-height: 44px; padding: 10px 18px; background: var(--st-aqua) !important; color: var(--st-night) !important;
  font-weight: 800; font-size: 14px; }
.st-inline:hover { background: var(--st-aqua) !important; color: var(--st-night) !important; }
.exercise-page .st-inline { margin: 0 0 16px; }

/* Drawer */
#study-tutor .st-backdrop { position: fixed; inset: 0; z-index: 220; background: rgba(20, 15, 46, .45); }
#study-tutor .st-panel { position: fixed; z-index: 221; top: 12px; right: 12px; bottom: 12px; width: min(430px, calc(100vw - 24px)); display: flex; flex-direction: column;
  background: #fff; border-radius: 0 !important; box-shadow: none; overflow: hidden; animation: st-in .25s cubic-bezier(.2, .8, .2, 1);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px); }
@keyframes st-in { from { transform: translateX(24px); opacity: 0; } }
#study-tutor .st-head { position: relative; isolation: isolate; display: flex; align-items: center; gap: 12px; padding: 16px 14px 14px 20px; flex: none; color: #eaf7ff;
  background: radial-gradient(360px 140px at 85% -30%, rgba(138, 114, 246, .55), transparent 70%), radial-gradient(260px 120px at 0% 140%, rgba(86, 218, 220, .3), transparent 70%), var(--st-night); }
#study-tutor .st-head::before { content: ''; position: absolute; inset: 0; z-index: -1; background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .03) 0 1px, transparent 1px 4px); pointer-events: none; }
#study-tutor .st-avatar { display: block; flex: none; width: 52px; height: 52px; overflow: hidden; border-radius: 0 !important; background: linear-gradient(160deg, var(--st-aqua), var(--st-violet));
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
#study-tutor .st-avatar img { display: block; width: 100%; height: 125%; object-fit: cover; object-position: 50% 8%; transform-origin: 50% 100%; animation: st-bob 3.2s ease-in-out infinite; }
@keyframes st-bob { 50% { transform: translateY(-3px) rotate(-3deg); } }
#study-tutor .st-titles { min-width: 0; flex: 1; }
#study-tutor .st-head h2 { margin: 0; padding-top: 2px; font: 800 20px/1.35 "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif; letter-spacing: .3px; text-transform: none;
  background: linear-gradient(180deg, #fff 30%, var(--st-gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#study-tutor .st-head h2 span { color: transparent; }
#study-tutor .st-head p { margin: 2px 0 0; color: #b8c4e6; font-size: 12.5px; line-height: 1.4; }
#study-tutor .st-clear, #study-tutor .st-close { flex: none; border: 0; border-radius: 0 !important; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); transition: background-color .18s; }
#study-tutor .st-clear { min-height: 36px; padding: 6px 12px; font-size: 12.5px; font-weight: 800; }
#study-tutor .st-close { width: 40px; height: 40px; font-size: 26px; line-height: 1; }
#study-tutor :is(.st-clear, .st-close):hover { background: var(--st-violet-lite); color: var(--st-night); }
#study-tutor .st-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--st-paper); overscroll-behavior: contain; }
#study-tutor .st-bubble { width: fit-content; max-width: 92%; margin: 0 0 10px; padding: 11px 14px; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
#study-tutor .st-bubble p { margin: 0 0 8px; }
#study-tutor .st-bubble p:last-child { margin-bottom: 0; }
#study-tutor .st-bubble ul, #study-tutor .st-bubble ol { margin: 4px 0 8px; padding-left: 20px; }
#study-tutor .st-bubble li { margin: 0 0 4px; padding: 0; background: none; }
#study-tutor .st-bubble li::before { content: none; }
#study-tutor .st-bubble strong { font-weight: 700; }
#study-tutor .st-bot { background: #fff; border-radius: 0 !important; box-shadow: none; outline: 1px solid var(--st-line); outline-offset: -1px;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px); }
#study-tutor .st-me { margin-left: auto; color: #fff; border-radius: 0 !important; white-space: pre-wrap;
  background: radial-gradient(160px 60px at 90% -20%, rgba(138, 114, 246, .55), transparent 70%), var(--st-night);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%); }
#study-tutor .st-intro { background: linear-gradient(90deg, var(--st-gold), #ffe08a) top / 100% 3px no-repeat, #fff6d8; outline: 0; }
#study-tutor .st-thinking { display: inline-flex; gap: 5px; padding: 12px 16px; background: #fff; border-radius: 0 !important; outline: 1px solid var(--st-line); outline-offset: -1px;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px); }
#study-tutor .st-thinking span { width: 7px; height: 7px; border-radius: 0 !important; background: var(--st-violet-lite); transform: rotate(45deg); animation: st-dot 1s infinite ease-in-out; }
#study-tutor .st-thinking span:nth-child(2) { animation-delay: .15s; }
#study-tutor .st-thinking span:nth-child(3) { animation-delay: .3s; }
@keyframes st-dot { 50% { transform: translateY(-4px) rotate(45deg); background: var(--st-aqua); box-shadow: 0 0 6px var(--st-aqua); } }
#study-tutor .st-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; flex: none; }
#study-tutor .st-chip { min-height: 36px; padding: 7px 12px; border: 0; border-radius: 0 !important; background: var(--st-paper); color: var(--st-ink); font-size: 13px; font-weight: 700; line-height: 1.3;
  text-align: left; cursor: pointer; outline: 1.5px solid var(--st-line); outline-offset: -1.5px; transition: background-color .18s, transform .18s;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
#study-tutor .st-chip:hover { background: #f1edff; outline-color: var(--st-violet); transform: translateY(-1px); }
#study-tutor .st-form { padding: 10px 16px 0; flex: none; }
#study-tutor .st-form textarea { display: block; width: 100%; min-height: 56px; max-height: 140px; padding: 10px 12px; border: 1.5px solid #d6d0ec; border-radius: 0 !important;
  background: #fff; color: #000; font-size: 15px; resize: vertical; }
#study-tutor .st-form textarea:focus { border-color: var(--st-violet); outline: none; box-shadow: 0 0 0 3px rgba(138, 114, 246, .2); }
#study-tutor .st-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
#study-tutor .st-left { flex: 1; min-width: 0; color: #4a4766; font-size: 12.5px; line-height: 1.4; }
#study-tutor .st-left a { color: #6a4fe0; font-weight: 800; }
#study-tutor .st-count { color: #777; font-size: 12px; }
/* Send and sign-in: the .vg-btn look (gold send, aqua sign-in), repeated here so the tutor does not need vidi-game.css. */
#study-tutor .st-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 20px; overflow: hidden; border: 0 !important;
  border-radius: 0 !important; box-shadow: none !important; background: var(--st-aqua) !important; color: var(--st-night) !important; font-size: 15px; font-weight: 800; text-decoration: none !important;
  cursor: pointer; clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); transition: transform .18s, filter .18s; }
#study-tutor .st-send { background: var(--st-gold) !important; }
#study-tutor .st-btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%); transform: translateX(-120%); transition: transform .6s; pointer-events: none; }
#study-tutor .st-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.04); }
#study-tutor .st-btn:hover:not(:disabled)::before { transform: translateX(120%); }
#study-tutor .st-btn:disabled { opacity: .45; cursor: not-allowed; }
#study-tutor .st-guest { padding: 14px 16px 0; flex: none; }
#study-tutor .st-guest p { margin: 0 0 10px; font-size: 14px; }
#study-tutor .st-status { margin: 6px 16px 0; font-size: 12.5px; color: #333; flex: none; }
#study-tutor .st-status:empty { display: none; }
#study-tutor .st-status[data-error="true"] { color: #b42318; }
#study-tutor .st-note { margin: 6px 16px 12px; color: #6b6889; font-size: 11.5px; line-height: 1.4; flex: none; }

/* Phones: a bottom sheet. */
@media (max-width: 640px) {
  /* A square icon button bottom-left, clear of the feedback pill bottom-right; the inline button carries the words. */
  #study-tutor .st-launch { right: auto; left: 12px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: 50px; height: 50px; min-height: 0; padding: 0; justify-content: center; }
  #study-tutor .st-launch svg { width: 22px; height: 22px; }
  #study-tutor .st-launch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #study-tutor .st-panel { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 88dvh; height: 88dvh; padding-bottom: env(safe-area-inset-bottom, 0px); animation-name: st-up;
    clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%, 0 18px); }
  #study-tutor .st-panel.st-short { height: auto; }
  #study-tutor .st-short .st-log { flex: none; }
  #study-tutor .st-form textarea { font-size: 16px; }
  #study-tutor .st-titles p { display: none; }
  #study-tutor .st-avatar { width: 44px; height: 44px; }
  html.st-open, html.st-open body { overflow: hidden; }
}
@keyframes st-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  #study-tutor .st-panel, #study-tutor .st-thinking span, #study-tutor .st-avatar img { animation: none; }
  #study-tutor :is(.st-launch, .st-btn, .st-chip), #study-tutor :is(.st-launch, .st-btn)::before, .st-inline, .st-inline::before { transition: none; }
}
@media print { #study-tutor, .st-inline { display: none !important; } }
