/* Captions, the pen and stickers on the preview (textstyles.js, doodle.js). */

/* ------------------------------------------------------------- caption editor */
.tx-editor { position: absolute; inset: 0; z-index: 12; background: rgba(0,0,0,.4); }
/* while typing, only the picture and the editor show (as on Snapchat) */
.screen:has(> .tx-editor) > :not(.tx-editor):not(.pv-stage) { visibility: hidden; }
.tx-top {
  position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--safe-t, 0px) + 12px) 12px 0;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 6px;
}
.tx-done { order: -1; margin-left: auto; }
.tx-styles { flex: 1 0 100%; min-width: 0; display: flex; justify-content: center; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 6px 2px; margin: -4px 0; }
.tx-styles::-webkit-scrollbar { display: none; }
.tx-style {
  flex: none; height: 32px; padding: 0 11px; border: 0; border-radius: 16px; background: rgba(255,255,255,.18); color: #fff;
  font-weight: 700; font-size: 13.5px; white-space: nowrap; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tx-style[aria-pressed="true"] { background: #fff; color: #000; }
.tx-s-big { font-weight: 900; font-size: 14.5px; }
.tx-s-outline { font-weight: 900; color: #fff; -webkit-text-stroke: 1px #000; paint-order: stroke fill; }
.tx-s-outline[aria-pressed="true"] { color: #fff; }
.tx-s-color[aria-pressed="false"] { background: rgba(255,207,36,.85); color: #111; }
.tx-s-script { font-family: "Snell Roundhand", "Savoye LET", "Segoe Script", "Dancing Script", cursive; font-size: 15px; }
.tx-done {
  flex: none; height: 34px; padding: 0 16px; border: 0; border-radius: 17px; background: var(--accent, #ffcf24); color: #111;
  font-weight: 800; font-size: 14px;
}
.tx-field {
  position: absolute; margin: 0; border: 0; outline: 0; resize: none; overflow: hidden; display: block;
  text-align: center; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: border-box; caret-color: var(--accent, #ffcf24);
  -webkit-appearance: none; appearance: none;
}

/* the style and Done buttons reach 44px for a finger without looking bigger */
.tx-style, .tx-done { position: relative; }
.tx-style::after, .tx-done::after { content: ""; position: absolute; inset: -6px -3px; }

/* the tall sliders: size on the left, color on the right */
.tx-slider { position: absolute; top: calc(var(--safe-t, 0px) + 112px); height: min(40vh, 300px); width: 36px; touch-action: none; outline: 0; }
.tx-size { left: 8px; }
.tx-color { right: 8px; }
.tx-track { position: absolute; left: 50%; top: 0; bottom: 0; width: 10px; transform: translateX(-50%); border-radius: 5px; box-shadow: 0 0 0 1.5px rgba(255,255,255,.75), 0 1px 6px rgba(0,0,0,.35); }
.tx-size .tx-track { width: 22px; border-radius: 0; background: rgba(255,255,255,.55); clip-path: polygon(0 0, 100% 0, 50% 100%); box-shadow: none; }
.tx-knob {
  position: absolute; left: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  background: #fff; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.45); transition: transform .1s; pointer-events: none;
}
.tx-slider.active .tx-knob { transform: scale(1.3); }
.tx-slider:focus-visible .tx-knob { outline: 2px solid var(--accent, #ffcf24); outline-offset: 2px; }

/* ------------------------------------------------------------- pen tools */
.pv-pentools {
  position: absolute; left: 50%; bottom: calc(var(--safe-b, 0px) + 84px); transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-radius: 26px; max-width: calc(100% - 24px);
  background: rgba(0,0,0,.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.pv-tool { width: 40px; height: 40px; border: 0; border-radius: 50%; padding: 9px; background: transparent; color: #fff; display: grid; place-items: center; flex: none; }
.pv-tool svg { width: 100%; height: 100%; display: block; }
.pv-tool.on { background: #fff; color: #000; }
.pv-sep { width: 1px; height: 24px; background: rgba(255,255,255,.3); margin: 0 5px; flex: none; }
.pv-size { width: 34px; height: 40px; border: 0; padding: 0; background: transparent; display: grid; place-items: center; flex: none; }
.pv-size i { display: block; border-radius: 50%; box-shadow: 0 0 0 1.5px rgba(255,255,255,.8); }
.pv-size.on i { box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px rgba(0,0,0,.35); }

/* ------------------------------------------------------------- sticker drawer */
.st-wrap { display: flex; flex-direction: column; }
.st-wrap > h2 { order: 0; }
.st-search { order: 1; }
.st-places { order: 2; }
.st-words { order: 3; }
.st-cats { order: 4; }
.st-wrap > .emoji-grid { order: 5; }
.st-empty { order: 6; }
.st-search {
  width: 100%; height: 42px; box-sizing: border-box; margin: 8px 0 2px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--chip); color: var(--fg); font-size: 16px;
}
.st-label { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 12px 2px 6px; }
.st-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.st-row::-webkit-scrollbar { display: none; }
.st-word {
  flex: none; border: 0; padding: 3px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6f86b8, #a07fb6 55%, #d08a8a);
}
.st-word:active { transform: scale(.95); }
.st-canvas { display: block; }
.st-cats { display: flex; gap: 2px; overflow-x: auto; margin: 12px 0 4px; scrollbar-width: none; }
.st-cats::-webkit-scrollbar { display: none; }
.st-cat { flex: none; width: 42px; height: 40px; border: 0; border-radius: 12px; background: transparent; font-size: 22px; padding: 0; }
.st-cat[aria-pressed="true"] { background: var(--chip); }
.st-sheet .emoji-grid { max-height: 38vh; }
.st-empty { color: var(--muted); text-align: center; padding: 18px 0; margin: 0; }
