/* The "AI 상담" panel shared by every product (shared/chat.js; 2026-10-18). White and ink like the WhereWise pages; the input
   follows the Claude app — one rounded box with the send key inside, and under it the questions left, the answer type (a menu
   that opens upward) and a ring of the questions left. It brings its own colours (from brand.css when the page loads it, these
   values otherwise), so it looks the same on a page that still has an older design. Load it after the page's own stylesheet. */
.chat-launch, .chat-panel {
  --cw-bg: var(--ww-bg, #FFFFFF); --cw-soft: var(--ww-soft, #F7F7F7); --cw-strong: var(--ww-strong, #F2F2F2);
  --cw-ink: var(--ww-ink, #222222); --cw-body: var(--ww-body, #3F3F3F); --cw-muted: var(--ww-muted, #6A6A6A); --cw-faint: var(--ww-faint, #929292);
  --cw-line: var(--ww-line, #DDDDDD); --cw-line-soft: var(--ww-line-soft, #EBEBEB); --cw-line-strong: var(--ww-line-strong, #C1C1C1);
  --cw-here: var(--ww-here, #FF385C); --cw-action: var(--ww-action, #E00B41); --cw-error: var(--ww-error, #C13515); --cw-marker: var(--ww-marker, #FFE45C);
  --cw-shadow: var(--ww-shadow, 0 0 0 1px rgba(0, 0, 0, .02), 0 2px 6px rgba(0, 0, 0, .04), 0 4px 8px rgba(0, 0, 0, .10));
  --cw-ease: var(--ww-ease, cubic-bezier(.2, .8, .2, 1));
  --cw-sans: var(--ww-sans, "Pretendard", "Apple SD Gothic Neo", system-ui, -apple-system, "Segoe UI", sans-serif);
  font-family: var(--cw-sans);
}
:root { --chat-w: 400px; --chat-rail: 52px; }

/* ---------- the button that opens it: a floating button on phones, a rail on the window's right edge on wider screens ---------- */
.chat-launch { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 1150;
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 1px solid var(--cw-line); border-radius: 999px;
  background: var(--cw-bg); color: var(--cw-ink); font-size: 15px; font-weight: 600; cursor: pointer; box-shadow: var(--cw-shadow); transition: background 0.15s, border-color 0.15s; }
.chat-launch:hover { background: var(--cw-soft); border-color: var(--cw-ink); }
.chat-rail-label { color: var(--cw-action); font-weight: 700; }   /* "후에게 물어보기" in the key red #E00B41 (4.9:1 on white, readable as text; coral #FF385C is for the dot only) */
.chat-launch[aria-expanded="true"] { display: none; }
.chat-launch:focus-visible { outline: 2px solid var(--cw-ink); outline-offset: 2px; }

/* ---------- the panel ---------- */
.chat-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1200; display: flex; flex-direction: column; width: min(460px, 100vw);
  background: var(--cw-bg); color: var(--cw-ink); border-left: 1px solid var(--cw-line); box-shadow: var(--cw-shadow); container-type: inline-size; }
.chat-panel[hidden] { display: none !important; }
.chat-panel :focus-visible { outline: 2px solid var(--cw-ink); outline-offset: 2px; }
.chat-panel button { font-family: inherit; }
.chat-panel h2, .chat-panel h3 { font-family: inherit; }
.chat-panel h2::before, .chat-panel h3::before { content: none !important; }
.chat-panel .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* head: name, the hand-written Beta, then new chat and close */
.chat-head { display: flex; align-items: center; gap: 6px; flex: none; height: 56px; padding: 0 8px 0 18px; border-bottom: 1px solid var(--cw-line-soft); }
.chat-name { display: flex; align-items: baseline; gap: 6px; margin: 0 4px 0 2px; font-size: 17px; font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.chat-name small { color: var(--cw-muted); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.chat-beta { display: inline-block; padding: 0 6px; transform: rotate(-4deg); color: var(--cw-ink); font: 700 19px/1 "Caveat", "Nanum Pen Script", cursive; letter-spacing: 0; white-space: nowrap;
  background: linear-gradient(transparent 38%, var(--cw-marker) 38%, var(--cw-marker) 88%, transparent 88%); }
.chat-head-gap { flex: 1; }
.chat-icon { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--cw-ink); cursor: pointer; transition: background 0.15s; }
.chat-icon:hover { background: var(--cw-strong); }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 18px 12px; overscroll-behavior: contain; }
/* before the first question: one line, suggested questions, and the fine print in a grey box */
.chat-hello { padding: 28px 0 8px; }
.chat-hello-owl { display: block; width: 60px; height: 60px; margin-bottom: 12px; }
.chat-hoo { flex: none; display: block; }
.chat-hello h3 { margin: 0 0 6px; font-size: 21px; font-weight: 700; line-height: 1.35; letter-spacing: -0.015em; }
.chat-hello > p { margin: 0 0 18px; color: var(--cw-muted); font-size: 14px; line-height: 1.6; }
.chat-suggest { display: grid; gap: 8px; }
.chat-sugg { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--cw-line); border-radius: 12px;
  background: var(--cw-bg); color: var(--cw-ink); font-size: 14px; font-weight: 500; line-height: 1.45; text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.chat-sugg:hover { border-color: var(--cw-ink); background: var(--cw-soft); }
.chat-sugg svg { flex: none; color: var(--cw-muted); }
.chat-fine { margin: 20px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--cw-soft); color: var(--cw-muted); font-size: 12.5px; line-height: 1.6; }
.chat-fine p { margin: 0; }
.chat-fine p + p { margin-top: 6px; }
.chat-fine a { color: var(--cw-muted); }
.chat-fine a:hover { color: var(--cw-ink); }
.chat-fine mark, .chat-body mark.unverified { padding: 0 1px; background: linear-gradient(transparent 40%, var(--cw-marker) 40%, var(--cw-marker) 92%, transparent 92%); color: var(--cw-ink); }
/* the conversation: questions in a grey bubble on the right, answers full width */
.chat-q { display: flex; justify-content: flex-end; margin: 18px 0 6px; }
.chat-q p { max-width: 86%; margin: 0; padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: var(--cw-soft); color: var(--cw-ink); font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.chat-a { margin: 10px 0 6px; }
.chat-who { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; color: var(--cw-muted); font-size: 12.5px; font-weight: 600; }
.chat-who .chat-hoo { margin-left: -2px; }
.chat-body { color: var(--cw-body); font-size: 15px; line-height: 1.7; }
.chat-body p { margin: 0 0 10px; }
.chat-body ul, .chat-body ol { margin: 0 0 10px; padding-left: 20px; }
.chat-body li { margin: 2px 0; }
.chat-body h4 { margin: 12px 0 4px; color: var(--cw-ink); font-size: 15px; }
.chat-body .advice { padding-left: 10px; border-left: 2px solid var(--cw-line-strong); color: var(--cw-body); }
.chat-body .fact { font-weight: 700; color: var(--cw-ink); font-variant-numeric: tabular-nums; }
.chat-body sup { margin-left: 1px; color: var(--cw-muted); font-size: 10px; font-weight: 700; }
.chat-body .est { margin-left: 2px; padding: 0 4px; border: 1px solid var(--cw-line); border-radius: 4px; color: var(--cw-muted); font-size: 10.5px; vertical-align: 1px; }
.chat-warn { margin: 4px 0 8px; padding: 6px 10px; border-left: 3px solid var(--cw-marker); background: var(--cw-soft); color: var(--cw-ink); font-size: 13px; }
.chat-src { margin: 4px 0 0; color: var(--cw-muted); font-size: 12.5px; }
.chat-src summary { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid var(--cw-line-soft); border-radius: 999px; font-weight: 600; cursor: pointer; list-style: none; }
.chat-src summary::-webkit-details-marker { display: none; }
.chat-src summary:hover { background: var(--cw-soft); }
.chat-src summary svg { transition: transform 0.15s; }
.chat-src[open] summary svg { transform: rotate(180deg); }
.chat-cites { margin: 8px 0 0; padding-left: 20px; line-height: 1.55; }
.chat-cites li::marker { color: var(--cw-muted); }
.chat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chat-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--cw-line); border-radius: 999px; color: var(--cw-ink); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.chat-chip:hover { border-color: var(--cw-ink); }
.chat-error { margin: 10px 0 6px; padding-left: 12px; border-left: 3px solid var(--cw-error); }
.chat-error p { margin: 0; color: var(--cw-error); font-size: 14px; font-weight: 600; }
.chat-used-up { margin: 14px 0 4px; padding: 12px 14px; border: 1px solid var(--cw-line); border-radius: 12px; color: var(--cw-body); font-size: 13.5px; line-height: 1.6; }
.chat-wait { display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; color: var(--cw-muted); font-size: 14px; }
.chat-wait small { display: block; color: var(--cw-muted); font-size: 12.5px; }
.chat-dots { display: inline-flex; gap: 4px; }
.chat-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cw-muted); animation: chat-dot 1s ease-in-out infinite; }
.chat-dots i:nth-child(2) { animation-delay: 0.15s; }
.chat-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
/* the input: one rounded box, the send key (↵) inside on the right, light grey until there is something to send */
.chat-form { flex: none; margin: 0; padding: 6px 14px max(10px, env(safe-area-inset-bottom)); background: var(--cw-bg); }
.chat-box { display: flex; align-items: flex-end; gap: 6px; min-height: 58px; padding: 7px 8px 7px 18px; border: 1px solid var(--cw-line-strong); border-radius: 22px; background: var(--cw-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.06); transition: border-color 0.15s; }
.chat-box:focus-within { border-color: var(--cw-ink); }
.chat-box textarea { flex: 1; min-width: 0; height: 42px; max-height: 150px; margin: 0; padding: 10px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  color: var(--cw-ink); font: 16px/22px var(--cw-sans); resize: none; outline: none; }
.chat-box textarea::placeholder { color: var(--cw-faint); }
.chat-box textarea:disabled { cursor: not-allowed; }
.chat-send { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border: 0; border-radius: 12px; background: none; color: var(--cw-ink); cursor: pointer; transition: background 0.15s, color 0.15s; }
.chat-send:hover { background: var(--cw-strong); }
.chat-send:disabled { background: none; color: var(--cw-line-strong); cursor: default; }
.chat-under { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 36px; margin: 4px 2px 0 10px; color: var(--cw-muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.chat-under-right { display: inline-flex; align-items: center; gap: 4px; }
.chat-model { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 10px; border: 0; border-radius: 8px; background: none; color: var(--cw-muted); font-size: 13.5px; cursor: pointer; transition: background 0.15s; }
.chat-model b { color: var(--cw-ink); font-weight: 600; }
.chat-model:hover, .chat-model[aria-expanded="true"] { background: var(--cw-strong); }
.chat-ring { display: inline-grid; place-items: center; width: 32px; height: 32px; }
.chat-ring[hidden] { display: none; }
.chat-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 10; width: min(300px, 100%); padding: 6px; border: 1px solid var(--cw-line); border-radius: 14px; background: var(--cw-bg);
  box-shadow: var(--cw-shadow), 0 12px 28px rgba(0, 0, 0, 0.1); opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity 0.16s var(--cw-ease), transform 0.16s var(--cw-ease), visibility 0s 0.16s; }
.chat-menu.open { opacity: 1; visibility: visible; transform: none; transition: opacity 0.16s var(--cw-ease), transform 0.16s var(--cw-ease); }
.chat-menu button { display: grid; grid-template-columns: 1fr 20px; align-items: center; gap: 2px 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--cw-ink); text-align: left; cursor: pointer; }
.chat-menu button:hover { background: var(--cw-soft); }
.chat-menu b { font-size: 14px; font-weight: 700; }
.chat-menu b em { margin-left: 4px; color: var(--cw-muted); font-size: 12.5px; font-style: normal; font-weight: 500; }
.chat-menu span { grid-column: 1; color: var(--cw-muted); font-size: 12.5px; line-height: 1.45; }
.chat-check { grid-row: 1 / 3; grid-column: 2; opacity: 0; }
.chat-menu button[aria-checked="true"] .chat-check { opacity: 1; }
.chat-menu-foot { margin: 4px 6px 2px; padding-top: 8px; border-top: 1px solid var(--cw-line-soft); color: var(--cw-muted); font-size: 12px; }
/* the English labels are long: a narrow panel keeps the answer type and drops the model name beside it
   (it stays in the menu and above each answer); the Korean row fits down to the narrowest panel */

/* ---------- docked on the right on wider screens: the page narrows beside the panel and the panel's left edge drags ---------- */
.chat-grip { position: absolute; top: 0; bottom: 0; left: -6px; width: 12px; cursor: col-resize; touch-action: none; }
.chat-grip::after { content: ""; position: absolute; top: 50%; left: 4px; width: 4px; height: 44px; margin-top: -22px; border-left: 1px solid var(--cw-line-strong); border-right: 1px solid var(--cw-line-strong); background: var(--cw-bg); }
.chat-grip:hover::after, .chat-grip:focus-visible::after, .chat-dragging .chat-grip::after { border-color: var(--cw-ink); }
.chat-grip:focus-visible { outline: 2px solid var(--cw-ink); outline-offset: -2px; }
.chat-dragging, .chat-dragging * { cursor: col-resize !important; user-select: none; }
@keyframes chat-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@media (min-width: 761px) {
  body { padding-right: var(--chat-rail); }
  body.chat-open { padding-right: var(--chat-w); }
  .chat-panel { width: var(--chat-w); animation: chat-in 0.2s var(--cw-ease); }
  /* the rail starts below the page's top bar: a page sets --chat-rail-top to its bar's height */
  .chat-rail { top: 0; right: 0; bottom: 0; flex-direction: column; justify-content: flex-start; gap: 12px; width: var(--chat-rail); min-height: 0; padding: var(--chat-rail-top, 84px) 0 0;
    border: 0; border-left: 1px solid var(--cw-line-soft); border-radius: 0; background: var(--cw-bg); color: var(--cw-ink); box-shadow: none; }
  .chat-rail:hover { background: var(--cw-soft); border-color: var(--cw-line-soft); }
  .chat-rail-label { writing-mode: vertical-rl; letter-spacing: 0.14em; font-size: 15px; }
  /* the sideways "Ask AI" needs less letter spacing than the upright Korean */
  html[lang="en"] .chat-rail-label { letter-spacing: 0.04em; }
}
@media (max-width: 760px) {
  .chat-panel { width: 100vw; border-left: 0; }
  .chat-grip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel { animation: none !important; }
  .chat-menu, .chat-menu.open, .chat-src summary svg { transition: none; }
  .chat-dots i { animation: none; opacity: 0.6; }
}
@media print { body, body.chat-open { padding-right: 0; } .chat-launch, .chat-panel { display: none !important; } }

/* "의견 보내기" under the fine print: a link-looking button that opens shared/feedback.js */
.chat-fb { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* "새 대화": the words beside the plus, so the button says what it does */
.chat-new { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px 0 10px; border: 1px solid var(--cw-line); border-radius: 999px; background: var(--cw-bg); color: var(--cw-ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.chat-new:hover { border-color: var(--cw-ink); }
/* the AI notice under the input, as AI apps put it */
.chat-disclaim { flex: 1 1 100%; order: 3; margin: 2px 0 0; color: var(--cw-muted); font-size: 12px; line-height: 1.45; text-align: center; }
.chat-under { flex-wrap: wrap; row-gap: 2px; }
