.kv2-action-bar {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: .45rem;
  width: 100%;
  margin-top: .75rem;
}

.kv2-action-bar__form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

.kv2-action-bar__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: .35rem .4rem;
  border: 0;
  border-radius: .45rem;
  background: transparent;
  color: var(--text-muted, rgba(235, 244, 235, .72));
  font: inherit;
  font-size: .9rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.kv2-action-bar__button:not(:where(.kv2-action-bar:has([data-like-type="profile-status"]) > .kv2-action-bar__comment)):focus-visible {
  color: var(--accent-color, #ff7890);
  background: rgba(255, 255, 255, .06);
  outline: none;
}

/* Touch browsers can retain :hover after navigation/composer taps. */
@media (hover: hover) and (pointer: fine) {
  .kv2-action-bar__button:not(:where(.kv2-action-bar:has([data-like-type="profile-status"]) > .kv2-action-bar__comment)):hover {
    color: var(--accent-color, #ff7890);
    background: rgba(255, 255, 255, .06);
  }
}

/* Status Comment inherits the canonical neutral action paint in every state.
   Keep keyboard focus visible without borrowing selected/Like colors. */
.kv2-action-bar:has([data-like-type="profile-status"]) > .kv2-action-bar__comment:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* All existing engagement controls share the real viewer Like state.
   Root specificity also wins over later surface-specific legacy colors. */
:root [data-like-button][data-liked="true"]:is(.liked, .is-liked, .blog-liked, .kv2-profile-status__like--active, [aria-pressed="true"]) {
  color: var(--kv2-kelibatmu-green);
  background: transparent;
}

/* Song/Blog comment Like counts retain their existing surface paint. */
:root :is([data-like-type="song-comment"], [data-like-type="blog-comment"]) > :is(.like-count, .blog-like-count, [data-like-count]) {
  color: #fff;
}

/* Status and its comment/reply counts match the neutral Comment tone.
   Paint the count explicitly so active button color stays on the heart. */
:root .kv2-action-bar__like:is([data-like-type="profile-status"], [data-like-type="profile-status-comment"]) > .like-count {
  color: var(--text-muted, rgba(235, 244, 235, .72));
}

/* Only action counts participate: hidden zero spans take no layout space. */
[data-kv2-action-count][hidden] { display: none !important; }

/* Song card/detail counts stay neutral while the heart carries Like state. */
:root [data-like-type="song"] > .like-count {
  color: var(--text-muted, rgba(235, 244, 235, .72));
}

/* Artwork rail counts stay readable independently of the active heart color. */
:root .kv2-immersive-rail .song-like-btn .like-count {
  color: #fff;
}

.kv2-action-bar__button--static {
  cursor: default;
}

.kv2-action-bar__button--static:hover {
  color: var(--text-muted, rgba(235, 244, 235, .72));
  background: transparent;
}

.kv2-action-bar__icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kv2-action-bar__like.is-liked .kv2-action-bar__icon,
.kv2-profile-status__like--active .kv2-action-bar__icon,
.blog-liked .kv2-action-bar__icon,
.liked .kv2-action-bar__icon {
  fill: currentColor;
}

.kv2-action-bar__menu {
  grid-column: 4;
  justify-self: end;
}

/*
 * Legacy duplicates: once a comment renders the shared `.kv2-action-bar`, its own
 * old like button, reply button and "..." trigger are redundant.
 *
 * The `:not(.kv2-action-bar *)` guard is LOAD-BEARING and was the real-device bug.
 * The shared action bar builds its own "..." button from `.kv2-action-trigger`,
 * which is a descendant of `.kv2-action-bar` but still a direct child of the
 * container below. Naming `.kv2-action-trigger` on its own therefore matched and
 * hid the REAL trigger too, so Edit / Delete / Hide were rendered but unreachable.
 * Only the standalone legacy trigger may be hidden.
 */
.blog-comment-actions:has(.kv2-action-bar) > .blog-comment-action-btn,
.blog-comment-actions:has(.kv2-action-bar) > .kv2-action-trigger:not(.kv2-action-bar *),
.kv2-song-comments__actions:has(.kv2-action-bar) > form,
.kv2-song-comments__actions:has(.kv2-action-bar) > .kv2-song-comments__reply-toggle,
.kv2-song-comments__actions:has(.kv2-action-bar) > .kv2-action-trigger:not(.kv2-action-bar *) {
  display: none;
}

.kv2-action-trigger {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: .72;
}

.kv2-action-trigger:hover,
.kv2-action-trigger:focus-visible {
  opacity: 1;
  background: rgba(255, 255, 255, .08);
  outline: none;
}

.kv2-action-trigger svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
}

.kv2-action-menu {
  position: absolute;
  z-index: 9200;
  width: min(13.5rem, calc(100vw - 1.5rem));
  padding: .35rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .5rem;
  background: color-mix(in srgb, var(--surface-color, #171d19) 92%, #fff 8%);
  color: var(--text-color, #f6f3ea);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, .36);
}

.kv2-action-sheet::backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(2, 8, 6, .58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.kv2-action-sheet {
  width: 100%;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9300;
  height: auto;
  max-height: min(65vh, calc(100dvh - 1rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .75rem .9rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border: 1px solid rgba(224, 148, 113, .14);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background:
    linear-gradient(180deg, rgba(31, 39, 33, .98), rgba(12, 22, 17, .98)),
    var(--surface-color, #0c1611);
  color: var(--text-color, #f5f1e8);
  box-shadow:
    0 -1.35rem 3.5rem rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 255, 255, .06);
}

.kv2-action-sheet__handle {
  display: block;
  width: 3.25rem;
  height: .25rem;
  margin: .05rem auto .85rem;
  border-radius: 999px;
  background: rgba(235, 244, 235, .32);
}

.kv2-action-item {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  min-height: 3.05rem;
  padding: .72rem .85rem;
  border: 0;
  border-radius: .7rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.kv2-action-menu .kv2-action-item {
  min-height: 2.45rem;
  font-size: .9rem;
}

.kv2-action-item:hover,
.kv2-action-item:focus-visible {
  background: rgba(224, 148, 113, .1);
  outline: none;
}

.kv2-action-item svg {
  width: 1.12rem;
  height: 1.12rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kv2-action-item--danger {
  color: #ff6f78;
}

.kv2-action-sheet__cancel {
  width: 100%;
  margin-top: .65rem;
  min-height: 3rem;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: .85rem;
  background: rgba(255, 255, 255, .055);
  color: var(--text-color, #f5f1e8);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.kv2-action-sheet__cancel:hover,
.kv2-action-sheet__cancel:focus-visible {
  background: rgba(224, 148, 113, .12);
  outline: none;
}

.kv2-action-hold-active {
  background: rgba(132, 91, 244, .12);
  transition: background-color .16s ease;
}

.kv2-comment-edited {
  color: var(--text-muted, #9da59f);
  font-size: .78em;
}

.kv2-comment-edited::before {
  content: "\00a0\00b7\00a0";
}

.kv2-inline-edit {
  display: grid;
  gap: .55rem;
  width: 100%;
  margin-top: .4rem;
}

.kv2-inline-edit textarea {
  width: 100%;
  min-height: 4.25rem;
  resize: vertical;
  padding: .65rem .75rem;
  border: 1px solid rgba(132, 91, 244, .32);
  border-radius: .55rem;
  background: color-mix(in srgb, var(--surface-color, #151a17) 82%, #fff 8%);
  color: inherit;
  font: inherit;
}

.kv2-inline-edit textarea:focus {
  outline: 2px solid rgba(132, 91, 244, .34);
  outline-offset: 2px;
}

.kv2-inline-edit__actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

.kv2-inline-edit__cancel,
.kv2-inline-edit__save {
  min-height: 2.15rem;
  padding: .45rem .8rem;
  border-radius: .55rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.kv2-inline-edit__cancel {
  border: 1px solid rgba(127, 127, 127, .22);
  background: transparent;
  color: inherit;
}

.kv2-inline-edit__save {
  border: 0;
  background: #7654d9;
  color: #fff;
}

@media (prefers-color-scheme: light) {
  .kv2-action-menu {
    background: #fff;
    color: #101113;
    border-color: rgba(0, 0, 0, .12);
  }
}

/* ---------------------------------------------------------------------------
   In-app destructive confirmation.

   Replaces the browser-native window.confirm() alert, so deletion stays inside
   the Kelibatmu UI and can name what is being destroyed. Reuses the action-sheet
   palette; it is a separate node so the menu/sheet lifecycle is untouched.
   --------------------------------------------------------------------------- */

.kv2-confirm {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  z-index: 9400; /* above the action menu (9200) and its backdrop */
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, .55);
}

.kv2-confirm__panel {
  width: min(21rem, 100%);
  padding: 1.15rem 1.1rem 1rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 1rem;
  background: #16181c;
  color: #e9f3e9;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
  text-align: center;
}

.kv2-confirm__title {
  margin: 0 0 .4rem;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.3;
}

.kv2-confirm__message {
  margin: 0 0 1.05rem;
  font-size: .9rem;
  line-height: 1.45;
  color: rgba(233, 243, 233, .78);
}

.kv2-confirm__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem;
}

.kv2-confirm__button {
  min-height: 2.75rem;
  padding: .55rem .9rem;
  border-radius: .7rem;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
}

.kv2-confirm__button:focus-visible {
  outline: 2px solid #9bd697;
  outline-offset: 2px;
}

/* Cancel reads as the safe, plain choice. */
.kv2-confirm__button--cancel {
  border: 1px solid rgba(255, 255, 255, .18);
  background: transparent;
  color: inherit;
}

/* Delete is the distinct, destructive choice. */
.kv2-confirm__button--danger {
  border: 1px solid transparent;
  background: #c0392b;
  color: #fff;
}

.kv2-confirm__button--danger:active {
  background: #a93226;
}

@media (prefers-color-scheme: light) {
  .kv2-confirm__panel {
    background: #fff;
    color: #101113;
    border-color: rgba(0, 0, 0, .12);
  }

  .kv2-confirm__message {
    color: rgba(16, 17, 19, .68);
  }

  .kv2-confirm__button--cancel {
    border-color: rgba(0, 0, 0, .16);
  }
}

/* One active icon paint across canonical and legacy engagement controls. */
:root [data-like-button][data-liked="true"] svg[data-kv2-like-gradient-icon],
:root svg[data-kv2-like-gradient-icon][data-kv2-like-active] {
  fill: var(--kv2-like-paint, var(--kv2-kelibatmu-green));
  stroke: var(--kv2-like-paint, var(--kv2-kelibatmu-green));
}
:root [data-like-button][data-liked="true"] svg[data-kv2-like-gradient-icon] path {
  fill: var(--kv2-like-paint, var(--kv2-kelibatmu-green));
  stroke: var(--kv2-like-paint, var(--kv2-kelibatmu-green));
}
:root [data-like-button][data-liked="true"] [data-kv2-like-gradient-icon]:not(svg) {
  background: linear-gradient(135deg, #F87171, #F87171 45%, #DC2626 80%, #991B1B);
  background-clip: text; -webkit-background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}

/* Closed child dialogs relinquish rendering and native modal ownership. */
.kv2-action-sheet:not([open]), .kv2-confirm:not([open]) { display: none; }
.kv2-confirm::backdrop { background: transparent; }

/* Status-comment reactions: neutral totals; the existing heart stays visible. */
.kv2-comment-reactions { display:flex; flex-wrap:wrap; gap:10px; margin-top:4px; color:var(--text-muted,rgba(235,244,235,.72)); font-size:12px; }
.kv2-comment-reactions > button { color:inherit; background:none; border:0; padding:0; font:inherit; cursor:pointer; }
.kv2-comment-reactions > button:focus-visible { outline:2px solid currentColor; outline-offset:3px; border-radius:3px; }
.kv2-reaction-picker { position:fixed; z-index:2000; display:flex; gap:3px; padding:5px; border:1px solid var(--border-color,rgba(255,255,255,.15)); border-radius:20px; background:var(--surface,#18251e); box-shadow:0 4px 18px #0006; }
.kv2-reaction-picker[hidden] { display:none; }
.kv2-reaction-picker button { background:none; border:0; border-radius:50%; width:36px; height:36px; font-size:23px; cursor:pointer; }
.kv2-reaction-picker button[aria-checked="true"],.kv2-reaction-picker button:focus-visible { outline:2px solid #4F9A73; outline-offset:-2px; }
[data-comment-reaction] { touch-action:pan-y; -webkit-touch-callout:none; }
[data-comment-reaction]:focus-visible [data-like-icon] { outline:2px solid #4F9A73; outline-offset:2px; border-radius:50%; }

/* Reactor-list entry inherits neutral summary paint, independently of viewer Like. */
.kv2-reaction-total-heart { vertical-align: -2px; fill: currentColor; stroke: none; }
