.prompt-bar {
  --pb-bg: #27272a;
  --pb-ink: #f5f5f5;
  --pb-menu: #323236;
  --pb-w: 400px;
  --pb-radius: 16px;
  --pb-press: 0.96;
  --pb-spark: #b39dff;
  --pb-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --pb-muted: color-mix(in srgb, var(--pb-ink) 55%, transparent);
  --pb-hover: color-mix(in srgb, var(--pb-ink) 8%, transparent);

  position: relative;
  width: min(var(--pb-w), 100%);
  color: var(--pb-ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 22px;
}

.prompt-bar__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 2;
  padding: 4px;
  border-radius: 12px;
  background: var(--pb-menu);
  box-shadow:
    0 10px 30px -10px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.08);
  transform-origin: bottom center;
  animation: prompt-bar-pop 180ms var(--pb-ease-out) both;
}

.prompt-bar__menu[data-kind='model'] {
  right: auto;
  width: 220px;
  transform-origin: bottom left;
}

@keyframes prompt-bar-pop {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
}

.prompt-bar__glow {
  position: absolute;
  right: 4px;
  left: 4px;
  border-radius: 8px;
  background: var(--pb-hover);
  opacity: 0;
  pointer-events: none;
  transition:
    top 220ms var(--pb-ease-out),
    height 220ms var(--pb-ease-out),
    opacity 150ms ease;
}

.prompt-bar__row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.prompt-bar__row-icon {
  display: inline-flex;
  flex: none;
  justify-content: center;
  width: 20px;
  color: color-mix(in srgb, var(--pb-ink) 70%, transparent);
}

.prompt-bar__row-name {
  flex: none;
  font-size: 13px;
  font-weight: 500;
}

.prompt-bar__row-desc {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--pb-muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.prompt-bar__row-tag {
  flex: none;
  margin-left: auto;
  color: var(--pb-muted);
  font-size: 11px;
}

.prompt-bar__row-check {
  display: inline-flex;
  flex: none;
  justify-content: center;
  width: 16px;
  opacity: 0;
}

.prompt-bar__row-check[data-on] {
  opacity: 1;
}

.prompt-bar__empty {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 8px;
  color: var(--pb-muted);
  font-size: 12px;
}

.prompt-bar__field {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--pb-radius);
  background: var(--pb-bg);
  cursor: text;
}

.prompt-bar__field::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(
    140% 120% at 0% 100%,
    color-mix(in srgb, var(--pb-spark) 26%, transparent),
    transparent 62%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}

.prompt-bar__field[data-max]::before {
  opacity: 1;
}

.prompt-bar__sparks {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

.prompt-bar__input {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 22px;
  resize: none;
  outline: none;
  overflow-wrap: anywhere;
}

.prompt-bar__input::placeholder {
  color: color-mix(in srgb, var(--pb-ink) 45%, transparent);
}

@media (pointer: coarse) {
  .prompt-bar__input {
    font-size: 16px;
  }
}

.prompt-bar__bar {
  display: flex;
  align-items: center;
  gap: 4px;
}

.prompt-bar__spacer {
  flex: 1 1 auto;
}

.prompt-bar__tool,
.prompt-bar__pick,
.prompt-bar__send {
  flex: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.prompt-bar__tool {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  color: color-mix(in srgb, var(--pb-ink) 60%, transparent);
  transition:
    background-color 150ms ease,
    color 150ms ease,
    transform 160ms var(--pb-ease-out);
}

.prompt-bar__tool:active {
  transform: scale(0.94);
}

.prompt-bar__pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  background: transparent;
  color: color-mix(in srgb, var(--pb-ink) 70%, transparent);
  font-size: 12px;
  font-weight: 500;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.prompt-bar__tool[data-on],
.prompt-bar__pick[data-on] {
  background: var(--pb-hover);
  color: var(--pb-ink);
}

@media (hover: hover) and (pointer: fine) {
  .prompt-bar__tool:hover,
  .prompt-bar__pick:hover {
    background: var(--pb-hover);
    color: var(--pb-ink);
  }
}

.prompt-bar__pick[data-max] {
  color: var(--pb-spark);
}

.prompt-bar__menu[data-kind='effort'] {
  right: auto;
  width: 248px;
  padding: 12px 14px 14px;
  transform-origin: bottom left;
}

.prompt-bar__effort-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 18px;
}

.prompt-bar__effort-title {
  color: var(--pb-muted);
}

.prompt-bar__effort-level {
  font-weight: 500;
}

.prompt-bar__effort-help {
  display: inline-flex;
  margin-left: auto;
  color: var(--pb-muted);
}

.prompt-bar__effort-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--pb-muted);
  font-size: 12px;
  line-height: 16px;
}

.prompt-bar__effort-track {
  position: relative;
  height: 22px;
  margin-top: 8px;
  border-radius: 11px;
  background: var(--pb-hover);
  cursor: pointer;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.prompt-bar__effort-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--pb-effort-fill);
  border-radius: 11px;
  background: color-mix(in srgb, var(--pb-ink) 18%, transparent);
  transition:
    width 220ms var(--pb-ease-out),
    background-color 300ms ease;
}

.prompt-bar__effort-dot {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--pb-ink) 30%, transparent);
}

.prompt-bar__effort-thumb {
  position: absolute;
  top: -3px;
  left: var(--pb-effort-x);
  width: 14px;
  height: 28px;
  margin-left: -7px;
  border-radius: 7px;
  background: var(--pb-ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition:
    left 220ms var(--pb-ease-out),
    background-color 300ms ease;
}

.prompt-bar[data-max] .prompt-bar__effort-fill {
  background: color-mix(in srgb, var(--pb-spark) 35%, transparent);
}

.prompt-bar[data-max] .prompt-bar__effort-thumb {
  background: var(--pb-spark);
}

.prompt-bar__eq {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 14px;
}

.prompt-bar__eq i {
  display: block;
  width: 2.5px;
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  animation: prompt-bar-eq 900ms ease-in-out infinite;
}

.prompt-bar__eq i:nth-child(2) {
  animation-delay: 150ms;
}

.prompt-bar__eq i:nth-child(3) {
  animation-delay: 300ms;
}

@keyframes prompt-bar-eq {
  0%,
  100% {
    transform: scaleY(0.35);
  }

  50% {
    transform: scaleY(1);
  }
}

.prompt-bar__send {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--pb-ink) 12%, var(--pb-bg));
  color: color-mix(in srgb, var(--pb-ink) 55%, var(--pb-bg));
  transition:
    background-color 200ms ease,
    color 200ms ease,
    transform 160ms var(--pb-ease-out);
}

.prompt-bar__send:disabled {
  cursor: default;
}

.prompt-bar__send[data-armed] {
  background: var(--pb-ink);
  color: var(--pb-bg);
}

.prompt-bar__send[data-pressed] {
  transform: scale(var(--pb-press));
}

.prompt-bar__glyph {
  display: block;
  width: 16px;
  height: 16px;
  transform-origin: 50% 50%;
}

@media (prefers-reduced-motion: reduce) {
  .prompt-bar__menu {
    animation: none;
  }

  .prompt-bar__glow {
    transition: opacity 150ms ease;
  }

  .prompt-bar__effort-fill,
  .prompt-bar__effort-thumb {
    transition: background-color 300ms ease;
  }

  .prompt-bar__tool:active,
  .prompt-bar__send[data-pressed] {
    transform: none;
  }
}

/* =====================================================================
   PENYESUAIAN UNTUK HALAMAN AIGA (ikut tema terang/gelap situs)
   Kelas pembungkus .aiga-composer sengaja BUKAN .aiga-input-row, supaya
   aturan lama "button { 46px bulat emas }" tidak ikut menimpa tombol bar.
   ===================================================================== */
.aiga-composer {
  position: relative;
  z-index: 1001; /* di atas tombol melayang (cari / kembali ke atas) */
  padding: 14px 24px 8px;
  background: var(--surface);
}

.aiga-composer .prompt-bar {
  --pb-w: 100%;
  --pb-bg: var(--surface-alt);
  --pb-ink: var(--ink);
  --pb-menu: var(--surface);
  --pb-spark: #7c5cff;
  width: 100%;
  font-family: var(--font-body);
}

:root[data-theme='dark'] .aiga-composer .prompt-bar {
  --pb-spark: #b39dff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .aiga-composer .prompt-bar {
    --pb-spark: #b39dff;
  }
}

.aiga-composer .prompt-bar__field {
  border: 1px solid var(--card-border);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.aiga-composer .prompt-bar__field:focus-within {
  border-color: var(--navy-steel);
  box-shadow: 0 0 0 3px rgba(30, 95, 204, 0.12);
}

.aiga-composer .prompt-bar__menu {
  border: 1px solid var(--card-border);
  box-shadow:
    0 14px 34px -12px rgba(11, 37, 69, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.08);
}

.aiga-composer .prompt-bar__input {
  min-height: 22px;
}

/* Label status di bubble "mengetik" untuk model Berpikir / Deep Research */
.aiga-typing-label {
  margin-left: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .aiga-composer {
    padding: 12px 14px 6px;
  }
}

/* =====================================================================
   Versi HP: kolom tulis Aiga & tombol kirim dirapikan.
   - Tombol kirim tidak lagi mepet/keluar dari kotak (sebelumnya 28x44px
     karena aturan min-height 44px untuk layar sentuh)
   - Area sentuh 40px, bentuk konsisten, jarak antar tombol lega
   - Kotak chat memakai lebar layar lebih penuh
   ===================================================================== */
@media (max-width: 640px) {
  html body main section.page[data-page="aiga"] .page-body .container.narrow.aiga-stage {
    padding: 16px 8px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  html body main section.page[data-page="aiga"] .aiga-shell {
    width: 100%;
    max-width: 100%;
  }
  html body main section.page[data-page="aiga"] .aiga-composer {
    padding: 14px 12px 8px;
  }
  html body main section.page[data-page="aiga"] .aiga-disclaimer {
    padding: 8px 18px 18px;
    line-height: 1.5;
  }

  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__field {
    padding: 12px 12px 12px 14px;
    gap: 10px;
    border-radius: 18px;
  }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__bar {
    gap: 6px;
    min-width: 0;
  }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__tool {
    width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 10px;
  }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__pick {
    height: 36px;
    min-height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    min-width: 0;
  }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__send {
    width: 40px;
    height: 40px;
    min-height: 40px;
    margin-left: 6px;
    border-radius: 12px;
  }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__glyph {
    width: 18px;
    height: 18px;
  }
}

/* HP sangat kecil: sembunyikan panah kecil di pilihan model agar muat */
@media (max-width: 380px) {
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__pick svg { display: none; }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__pick { padding: 0 9px; }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__bar { gap: 4px; }
  html body main section.page[data-page="aiga"] .aiga-composer .prompt-bar__send { margin-left: 4px; }
}
