/* Autocomplete on the 작업 tab (js/worksuggest.js): the grey text after the caret (.ws-ghost),
   the small "Tab ↹ 수락" button beside it (.ws-pill; on a touch screen it is the button that puts
   the text in), and the card offering a change to a part (.ws-card, above the feedback line).
   The grey text is the muted text colour at about 55%, in both themes. */

/* ---------- the grey text ---------- */

.ws-ghost {
  color: var(--muted);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  font-weight: inherit;
  white-space: pre-wrap;
  animation: ws-in 0.16s ease-out;
}
/* (on a slide, the slide's own text colour, which its theme sets) */
.wc-slide .ws-ghost {
  color: currentColor;
  opacity: 0.42;
}
/* (over an input: a line drawn where its caret is, cut at the input's edge) */
.ws-ghost-float {
  position: fixed;
  z-index: 2147482990;
  display: block;
  overflow: hidden;
  white-space: pre;
  text-overflow: clip;
}
.ws-ghost-float[hidden] {
  display: none;
}

/* ---------- the pill: Tab ↹ 수락 ---------- */

.ws-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: 600 11px/1.4 var(--font);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.ws-pill:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}
.ws-pill-ghost {
  position: fixed;
  z-index: 2147482991;
  max-width: min(420px, calc(100vw - 16px));
  animation: ws-in 0.16s ease-out;
}
/* (in a dialog, a guideline being added: placed inside it) */
.ws-ghost-float.ws-in-dialog,
.ws-pill-ghost.ws-in-dialog {
  position: absolute;
}
.ws-pill.touch {
  padding: 5px 11px;
  font-size: 12px;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.ws-kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  font: 600 10px/1.5 var(--font);
}
.ws-pill-hint {
  overflow: hidden;
  max-width: 240px;
  padding-left: 6px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font: 500 11px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
  text-overflow: ellipsis;
}

/* ---------- the card: a change offered for a part ---------- */

.ws-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13px;
  animation: ws-in 0.2s ease-out;
}
.ws-card-icon {
  display: inline-flex;
  flex: none;
  color: var(--accent-text);
}
.ws-card-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ws-card-label {
  overflow-wrap: anywhere;
}
/* (a rewrite or a new part: what will run, in full, and that the AI writes it) */
.ws-card-detail {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12px;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.ws-card-cost {
  color: var(--muted);
  font-size: 11.5px;
}
.ws-card-go .ws-kbd[hidden] {
  display: none;
}
.ws-card-go {
  flex: none;
}
.ws-card-x {
  flex: none;
  width: 26px;
  height: 26px;
  color: var(--muted);
}
.wc-sec .ws-card {
  margin: 4px 0 8px;
}
/* (above a slide's feedback line, in the column that scrolls: never squeezed by a tall slide) */
.wc-main > .ws-card {
  flex-shrink: 0;
}

/* (the line that says a suggestion is there, read by screen readers only) */
.ws-sug-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes ws-in {
  from {
    opacity: 0;
  }
}
/* (.ws-ghost's own opacity stays: the fade above only starts from nothing) */

@media (prefers-reduced-motion: reduce) {
  .ws-ghost,
  .ws-pill-ghost,
  .ws-card {
    animation: none;
  }
}

@media (max-width: 640px) {
  .ws-card {
    flex-wrap: wrap;
  }
  .ws-card-text {
    flex-basis: calc(100% - 60px);
  }
}

/* ---------- autocorrect (spec 20.2, 23.7) ---------- */

/* "고침 · 되돌리기": under a correction just made, for a few seconds */
.ws-fix-pill {
  position: fixed;
  z-index: 2147482991;
  max-width: min(360px, calc(100vw - 16px));
  padding: 2px 8px 2px 6px;
  animation: ws-in 0.16s ease-out;
}
.ws-fix-pill > svg {
  flex: none;
  color: var(--good);
}
.ws-fix-note {
  overflow: hidden;
  color: var(--muted);
  font-weight: 500;
  text-overflow: ellipsis;
}
.ws-fix-undo {
  color: var(--accent-text);
}
/* the AI's correction of a sentence, offered: the sentence underlined, the pill under it */
.ws-fix-line {
  position: fixed;
  z-index: 2147482990;
  height: 0;
  border-bottom: 2px dotted var(--warn);
  pointer-events: none;
}
/* a word put right as it was typed: a soft line under it, flashing as it comes */
.ws-fix-line.ws-fix-soft {
  border-bottom: 2px solid var(--accent);
  opacity: 0.55;
  animation: ws-fix-flash 0.45s ease-out 2;
}
@keyframes ws-fix-flash {
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ws-fix-line.ws-fix-soft {
    animation: none;
  }
}
.ws-fix-offer {
  position: fixed;
  z-index: 2147482991;
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: min(460px, calc(100vw - 16px));
  animation: ws-in 0.16s ease-out;
}
.ws-fix-go {
  min-width: 0;
}
.ws-fix-to {
  overflow: hidden;
  padding-left: 6px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-weight: 500;
  text-overflow: ellipsis;
}
.ws-fix-to b {
  color: var(--good);
  font-weight: 700;
}
.ws-fix-x {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

@media (prefers-reduced-motion: reduce) {
  .ws-fix-pill,
  .ws-fix-offer {
    animation: none;
  }
}
