/* 윙키 AI 비서 — floating launcher and drawer.
   Loaded only on learner-facing pages; it never covers the page's primary action. */
/* Launcher: a speech bubble instead of the heavy black donut. The winged character
   is the bubble itself; on a phone only the bubble shows, on a wide screen the label
   rides along in a light card with a tail at the bottom-right corner. */
.wk-tutor-launch{
  position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(18px + env(safe-area-inset-bottom));
  z-index:60;display:inline-flex;align-items:center;gap:9px;min-height:0;padding:5px 18px 5px 5px;
  border:1px solid rgba(3,36,81,.09);border-radius:26px 26px 6px 26px;background:#fff;color:var(--navy,#032451);
  font-size:14px;font-weight:700;letter-spacing:-.01em;
  box-shadow:0 10px 24px rgba(3,36,81,.16),0 2px 6px rgba(3,36,81,.10);cursor:pointer;
  transition:box-shadow .16s ease,transform .16s ease;
}
.wk-tutor-launch:hover{background:#fff;transform:translateY(-1px);box-shadow:0 14px 30px rgba(3,36,81,.2),0 3px 8px rgba(3,36,81,.12)}
.wk-tutor-launch:focus-visible{outline:3px solid #356ac6;outline-offset:3px}
.wk-tutor-launch svg{width:20px;height:20px;flex:none}
.wk-tutor-launch .wk-tutor-launch-label{white-space:nowrap}
.wk-tutor-launch-avatar{width:42px;height:42px;flex:none;border-radius:50%;object-fit:cover;object-position:center;background:#1a56f0;display:block;box-shadow:inset 0 0 0 1px rgba(3,36,81,.06)}
.wk-tutor-panel{
  position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(78px + env(safe-area-inset-bottom));
  z-index:61;display:flex;flex-direction:column;box-sizing:border-box;
  width:min(400px,calc(100vw - 32px));max-height:min(620px,calc(100vh - 120px));max-height:min(620px,calc(100dvh - 120px));
  background:#fff;color:var(--ink,#1d1d1f);border:1px solid var(--hair,#e6e8ec);border-radius:18px;
  box-shadow:0 18px 48px rgba(3,36,81,.22);overflow:hidden;
}
.wk-tutor-panel[hidden]{display:none}
.wk-tutor-head{display:flex;align-items:center;gap:10px;padding:14px 14px 12px;background:var(--navy,#032451);color:#fff}
.wk-tutor-avatar{width:40px;height:40px;flex:none;border-radius:50%;object-fit:cover;object-position:center;background:#fff;box-shadow:0 0 0 2px rgba(255,255,255,.32)}
.wk-tutor-rename{min-height:44px;padding:0 10px;border:1px solid rgba(255,255,255,.42);border-radius:10px;background:transparent;color:#fff;font-size:12px;font-weight:600;line-height:1.2;white-space:nowrap;cursor:pointer}
.wk-tutor-rename:hover{background:rgba(255,255,255,.14)}
.wk-tutor-rename[hidden]{display:none}
.wk-tutor-head h2{margin:0;font-size:15px;font-weight:700;color:#fff;letter-spacing:-.01em}
.wk-tutor-head p{margin:2px 0 0;font-size:12px;color:rgba(255,255,255,.72);line-height:1.4}
.wk-tutor-head-copy{flex:1;min-width:0}
/* The name card is never squeezed: it either gets the whole panel (naming mode, below) or,
   while hidden, takes no room at all. A max-height here used to clip the card and push the
   save buttons under the card's own scroll. */
.wk-tutor-onboard{flex:0 0 auto;padding:14px;background:#fff;border-bottom:1px solid var(--hair,#e6e8ec);overflow-y:auto;overscroll-behavior:contain}
.wk-tutor-onboard[hidden]{display:none}
.wk-tutor-onboard-avatar{display:block;width:56px;height:56px;border-radius:50%;object-fit:cover;object-position:center;margin:0 0 8px;background:#fff;box-shadow:0 4px 14px rgba(3,36,81,.16)}
.wk-tutor-onboard-title{display:block;font-size:15px;line-height:1.45;color:var(--navy,#032451);letter-spacing:-.01em}
.wk-tutor-onboard-body{margin:6px 0 4px;font-size:13px;line-height:1.5;color:var(--ink2,#6e6e73)}
.wk-tutor-onboard-roles{margin:0 0 8px;padding-left:18px;font-size:13px;line-height:1.55;color:var(--ink,#1d1d1f)}
.wk-tutor-onboard-roles li{margin:2px 0}
.wk-tutor-onboard-coach{margin:0 0 10px;font-size:12px;line-height:1.5;color:var(--ink2,#6e6e73)}
/* 등급별 하루 질문 한도: 이름 짓기 위에 한 줄 배지로만 둔다(카드가 세로로 길어지지 않게). */
.wk-tutor-onboard-limit{display:flex;flex-wrap:wrap;align-items:baseline;gap:1px 8px;margin:0 0 10px;padding:6px 10px;border:1px solid #dfe6f1;border-radius:10px;background:#f4f7fc;color:var(--navy,#032451);font-size:13px;line-height:1.5}
.wk-tutor-onboard-limit[hidden]{display:none}
.wk-tutor-onboard-limit-title{flex:0 0 auto;font-weight:700}
.wk-tutor-onboard-limit-line{flex:1 1 auto;min-width:0;font-variant-numeric:tabular-nums}
.wk-tutor-name-label{display:block;font-size:13px;font-weight:600;color:var(--navy,#032451)}
.wk-tutor-name-input{display:block;box-sizing:border-box;width:100%;min-height:44px;margin:6px 0 8px;padding:10px 12px;border:1px solid var(--steel,#c9ced6);border-radius:12px;font-size:15px;line-height:1.4}
.wk-tutor-name-chips{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px}
.wk-tutor-name-chip{min-height:36px;padding:6px 11px;border:1px dashed var(--steel,#c9ced6);border-radius:999px;background:#fff;color:var(--navy,#032451);font-size:12px;font-weight:600;cursor:pointer}
.wk-tutor-name-chip:hover{background:#eef2f6}
.wk-tutor-onboard-actions{display:flex;flex-wrap:wrap;gap:8px}
.wk-tutor-name-save{min-height:44px;padding:0 14px;border:0;border-radius:12px;background:var(--brand,#ff6600);color:#fff;font-size:13px;font-weight:700;cursor:pointer}
.wk-tutor-name-later{min-height:44px;padding:0 12px;border:1px solid var(--steel,#c9ced6);border-radius:12px;background:#fff;color:var(--navy,#032451);font-size:13px;font-weight:600;cursor:pointer}
.wk-tutor-name-save:disabled,.wk-tutor-name-later:disabled{opacity:.55;cursor:default}
.wk-tutor-name-msg{margin:8px 0 0;font-size:12px;line-height:1.5;color:#a3121b}
.wk-tutor-name-msg[hidden]{display:none}
.wk-tutor-name-link{display:block;box-sizing:border-box;width:100%;min-height:44px;margin:0;padding:0 14px 10px;border:0;background:#fff;color:var(--navy,#032451);font-size:12px;font-weight:600;line-height:1.4;text-align:left;text-decoration:underline;cursor:pointer}
.wk-tutor-name-link[hidden]{display:none}
/* Naming mode: the first-visit card or the rename card owns the panel. The message area,
   the quick chips, the quota line and the composer step aside (they come back the moment the
   card closes), so the title, the three roles, the name field, the suggestion chips and both
   「저장」·「나중에 정할래」 buttons fit on one screen without scrolling — in the 620px desktop
   panel and in the mobile sheet alike. */
.wk-tutor-panel.wk-tutor-naming{max-height:min(720px,calc(100vh - 96px));max-height:min(720px,calc(100dvh - 96px))}
.wk-tutor-panel.wk-tutor-naming .wk-tutor-onboard{flex:1 1 auto;max-height:none;border-bottom:0}
.wk-tutor-panel.wk-tutor-naming .wk-tutor-body,
.wk-tutor-panel.wk-tutor-naming .wk-tutor-chips,
.wk-tutor-panel.wk-tutor-naming .wk-tutor-quota,
.wk-tutor-panel.wk-tutor-naming .wk-tutor-invite,
.wk-tutor-panel.wk-tutor-naming .wk-tutor-name-link,
.wk-tutor-panel.wk-tutor-naming .wk-tutor-form,
.wk-tutor-panel.wk-tutor-naming .wk-tutor-foot{display:none}
.wk-tutor-mode{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:6px;background:rgba(255,255,255,.16);font-size:12px;font-weight:600;vertical-align:1px}
.wk-tutor-close{min-width:44px;min-height:44px;padding:0;display:grid;place-items:center;background:transparent;color:#fff;border:0;border-radius:10px;font-size:22px;line-height:1;cursor:pointer}
.wk-tutor-close:hover{background:rgba(255,255,255,.14)}
.wk-tutor-body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:14px;background:var(--bg2,#f6f7f9)}
.wk-tutor-msg{max-width:88%;margin:0 0 10px;padding:10px 13px;border-radius:14px;font-size:14px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere;word-break:keep-all}
.wk-tutor-msg.bot{align-self:flex-start;background:#fff;border:1px solid var(--hair,#e6e8ec);border-bottom-left-radius:6px}
.wk-tutor-msg.user{margin-left:auto;background:var(--navy,#032451);color:#fff;border-bottom-right-radius:6px}
.wk-tutor-msg.system{max-width:none;background:#fff8ec;border:1px solid #f0dfc2;color:#7a4b0a;font-size:13px}
.wk-tutor-msg.system a{color:#7a4b0a;font-weight:650}
.wk-tutor-msg.note{max-width:none;margin:0 0 8px;padding:0 2px;border:0;background:transparent;color:var(--ink2,#6e6e73);font-size:12px;line-height:1.5}
.wk-tutor-chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 14px 10px;background:var(--bg2,#f6f7f9)}
.wk-tutor-chip{min-height:36px;padding:7px 11px;border:1px solid var(--steel,#c9ced6);border-radius:999px;background:#fff;color:var(--navy,#032451);font-size:12px;font-weight:600;line-height:1.35;cursor:pointer;text-align:left}
.wk-tutor-chip:hover{background:#eef2f6}
.wk-tutor-chip:disabled{opacity:.55;cursor:default}
.wk-tutor-quota{margin:0;padding:0 14px 8px;background:var(--bg2,#f6f7f9);color:var(--ink2,#6e6e73);font-size:12px;font-weight:600;line-height:1.4}
.wk-tutor-quota.empty{color:#a33b00}
.wk-tutor-invite{margin:0 14px 10px;padding:10px 12px;border:1px solid #f0dfc2;border-radius:12px;background:#fff8ec;font-size:13px;line-height:1.5}
.wk-tutor-invite-title{display:block;font-size:13px;color:#7a4b0a}
.wk-tutor-invite-body{margin:4px 0 8px;color:#7a4b0a}
.wk-tutor-invite-link{display:inline-flex;align-items:center;min-height:36px;color:#7a4b0a;font-weight:700;text-decoration:underline}
.wk-tutor-delivery{margin:0 0 10px;padding:11px 12px;border:1px solid var(--steel,#c9ced6);border-radius:14px;background:#fff}
.wk-tutor-delivery-title{display:block;font-size:13px;color:var(--navy,#032451)}
.wk-tutor-delivery-note{margin:6px 0 10px;padding:8px 10px;border-radius:10px;background:var(--bg2,#f6f7f9);font-size:14px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}
.wk-tutor-delivery-actions{display:flex;gap:8px}
.wk-tutor-delivery-send,.wk-tutor-delivery-cancel{min-height:40px;padding:0 14px;border:0;border-radius:10px;font-size:13px;font-weight:700;cursor:pointer}
.wk-tutor-delivery-send{background:var(--brand,#ff6600);color:#fff}
.wk-tutor-delivery-cancel{background:#eef2f6;color:var(--navy,#032451)}
.wk-tutor-delivery-send:disabled,.wk-tutor-delivery-cancel:disabled{opacity:.55;cursor:default}
.wk-tutor-delivery-result{margin:8px 0 0;font-size:12px;line-height:1.5;color:var(--ink2,#6e6e73)}
.wk-tutor-delivery-result.error{color:#a3121b}
.wk-tutor-form{display:flex;align-items:flex-end;gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--hair,#e6e8ec);background:#fff}
.wk-tutor-input{flex:1;min-width:0;min-height:44px;max-height:120px;padding:10px 12px;border:1px solid var(--steel,#c9ced6);border-radius:12px;font-size:15px;line-height:1.45;resize:none}
.wk-tutor-send{flex:none;min-width:56px;min-height:44px;padding:0 14px;border:0;border-radius:12px;background:var(--brand,#ff6600);color:#fff;font-size:14px;font-weight:700;cursor:pointer}
.wk-tutor-send:disabled{opacity:.55;cursor:default}
.wk-tutor-foot{margin:0;padding:0 14px 10px;background:#fff;color:var(--ink2,#6e6e73);font-size:12px;line-height:1.5}
.wk-tutor-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.wk-tutor-skip{position:absolute;left:-9999px;top:auto;width:1px;height:1px;overflow:hidden}
@media (max-width:520px){
  /* On a phone the launcher is only the character: the bubble artwork already carries the
     blue disc, the bottom-right tail and a 2px white rim, so there is no black ring left. */
  .wk-tutor-launch{right:max(10px,env(safe-area-inset-right));bottom:calc(10px + env(safe-area-inset-bottom));width:64px;height:64px;min-height:0;padding:0;gap:0;border:0;border-radius:0;background:url(tutor-chat-bubble.png?v=tutor-chat-5) center/contain no-repeat;box-shadow:none;filter:drop-shadow(0 8px 14px rgba(3,36,81,.22))}
  .wk-tutor-launch:hover{background:url(tutor-chat-bubble.png?v=tutor-chat-5) center/contain no-repeat;transform:translateY(-1px);box-shadow:none;filter:drop-shadow(0 10px 18px rgba(3,36,81,.26))}
  .wk-tutor-launch-avatar{display:none}
  .wk-tutor-launch-label{display:none}
  .wk-tutor-rename{padding:0 8px}
  .wk-tutor-panel{
    right:0;left:0;bottom:0;width:100%;max-width:none;
    max-height:calc(100vh - 64px);max-height:calc(100dvh - 64px);border-radius:18px 18px 0 0;border-bottom:0;
  }
  .wk-tutor-msg{max-width:92%;font-size:15px}
  .wk-tutor-input{font-size:16px} /* prevents iOS zoom on focus */
  .wk-tutor-name-input{font-size:16px} /* prevents iOS zoom on focus */
  .wk-tutor-panel.wk-tutor-naming{max-height:calc(100dvh - 12px)}
  .wk-tutor-panel.wk-tutor-naming .wk-tutor-onboard{padding-bottom:calc(14px + env(safe-area-inset-bottom))}
}
/* A short window (small laptop, phone in landscape): keep the card's own bulk down so the name
   field, the suggestions and the two buttons stay reachable without scrolling. */
@media (max-height:640px){
  .wk-tutor-panel.wk-tutor-naming .wk-tutor-onboard{padding:12px;padding-bottom:calc(12px + env(safe-area-inset-bottom))}
  .wk-tutor-panel.wk-tutor-naming .wk-tutor-onboard-avatar,
  .wk-tutor-panel.wk-tutor-naming .wk-tutor-onboard-coach{display:none}
}
@media (prefers-reduced-motion:no-preference){
  .wk-tutor-panel{animation:wk-tutor-in .18s ease-out}
  @keyframes wk-tutor-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
}
@media (prefers-contrast:more){
  .wk-tutor-panel{border:2px solid var(--navy,#032451)}
  .wk-tutor-chip{border-width:2px}
}
@media print{.wk-tutor-launch,.wk-tutor-panel{display:none!important}}

/* Brand readability v20261125: preserve onboarding/chat state, layout and API behaviour. */
.wk-tutor-panel .wk-tutor-head h2,.wk-tutor-panel .wk-tutor-onboard-title{font-size:16px;line-height:1.5}
.wk-tutor-panel .wk-tutor-head p{font-size:14px;line-height:1.5;color:#fff}
.wk-tutor-panel .wk-tutor-onboard-body,.wk-tutor-panel .wk-tutor-onboard-roles{font-size:16px;line-height:1.6}
.wk-tutor-panel .wk-tutor-onboard-limit{font-size:14px;line-height:1.5}
.wk-tutor-panel :is(.wk-tutor-onboard-coach,.wk-tutor-name-label,.wk-tutor-name-save,.wk-tutor-name-later,.wk-tutor-name-msg,.wk-tutor-name-link,.wk-tutor-name-chip,.wk-tutor-rename,.wk-tutor-mode,.wk-tutor-chip,.wk-tutor-quota,.wk-tutor-invite,.wk-tutor-invite-title,.wk-tutor-delivery-title,.wk-tutor-delivery-send,.wk-tutor-delivery-cancel,.wk-tutor-delivery-result,.wk-tutor-foot){font-size:14px;line-height:1.5}
.wk-tutor-panel :is(.wk-tutor-msg,.wk-tutor-msg.system,.wk-tutor-msg.note){font-size:16px;line-height:1.6}
.wk-tutor-panel :is(.wk-tutor-name-input,.wk-tutor-input){font-size:16px;line-height:1.5}
.wk-tutor-panel :is(.wk-tutor-name-chip,.wk-tutor-chip,.wk-tutor-invite-link,.wk-tutor-delivery-send,.wk-tutor-delivery-cancel,.wk-tutor-name-link){min-height:44px}
.wk-tutor-panel :is(.wk-tutor-name-save,.wk-tutor-delivery-send,.wk-tutor-send){background:#b93901;color:#fff}
.wk-tutor-panel :is(.wk-tutor-name-save,.wk-tutor-delivery-send,.wk-tutor-send):disabled{opacity:1;background:#e2e8f0;color:#475569;cursor:not-allowed}
.wk-tutor-panel :is(button,input,textarea,a):focus-visible,.wk-tutor-launch:focus-visible{outline:3px solid #0047a0;outline-offset:3px}
/* The shared input:not(...) rule has higher specificity than the class-only size. */
#wk-tutor-panel input.wk-tutor-name-input,#wk-tutor-panel textarea.wk-tutor-input{font-size:16px;line-height:1.5}
.wk-tutor-head :is(button,a):focus-visible{outline-color:#fff;outline-offset:2px}
