/* =========================================================
   Comments (ringtone pages) — uses the site's tokens
   ========================================================= */

.cm { margin-top: 28px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
@media (max-width: 480px) { .cm { padding: 16px; } }
.cm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.cm-head h2 { font-size: 1.2rem; }
.cm-sort { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.cm-sort > .i { width: 16px; height: 16px; margin: 0 4px 0 8px; }
.cm-sort button { padding: 6px 12px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: .85rem; font-weight: 650; }
.cm-sort button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Avatars */
.cm-avatar {
	--hue: 262;
	display: grid; place-items: center; flex: none;
	width: 40px; height: 40px; overflow: hidden;
	border-radius: 50%;
	background: linear-gradient(140deg, hsl(var(--hue) 70% 55%), hsl(calc(var(--hue) + 35) 70% 40%));
	color: #fff; font-weight: 700;
}
.cm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cm-item--reply .cm-avatar, .cm-compose--reply .cm-avatar { width: 28px; height: 28px; font-size: .8rem; }

/* Composer */
.cm-compose { display: flex; gap: 12px; margin-bottom: 22px; }
.cm-compose--reply { margin: 10px 0 6px; }
.cm-compose__main { flex: 1; min-width: 0; }
.cm-compose textarea, .cm-edit textarea {
	display: block; width: 100%; min-height: 36px; padding: 8px 0; resize: none;
	border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
	background: transparent; color: var(--text); font: inherit; line-height: 1.45; outline: none;
	transition: border-color .15s ease;
}
.cm-compose textarea:focus, .cm-edit textarea:focus { border-bottom: 2px solid var(--text); padding-bottom: 7px; }
.cm-compose__bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.cm-compose__bar[hidden] { display: none; }
.cm-compose__count { margin-right: auto; font-size: .78rem; font-variant-numeric: tabular-nums; }
.cm-gifbtn {
	padding: 3px 8px; border: 1.5px solid var(--muted); border-radius: 6px; background: none;
	color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .04em;
}
.cm-gifbtn:hover { border-color: var(--accent); color: var(--accent); }
.cm-gifbtn[hidden] { display: none; }
.cm-compose__gif { position: relative; display: inline-block; margin-top: 10px; }
.cm-compose__gif[hidden] { display: none; }
.cm-compose__gif img { display: block; max-width: 200px; max-height: 160px; border-radius: 10px; }
.cm-compose__gif-x { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; }
.cm-compose__gif-x .i { width: 14px; height: 14px; }

/* Comment */
.cm-list { display: grid; gap: 4px; }
.cm-item { display: flex; gap: 12px; padding: 8px 0; animation: rise .3s ease both; }
.cm-main { flex: 1; min-width: 0; }
.cm-pinned { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.cm-pinned .i { width: 14px; height: 14px; }
.cm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .8rem; }
.cm-name { font-weight: 700; color: var(--text); }
.cm-name.is-creator { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); }
.cm-name:hover { text-decoration: underline; }
.cm-meta .verified-badge { margin-left: -4px; }
.cm-creator { padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.cm-body { margin-top: 4px; font-size: .925rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.cm-body.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cm-readmore { margin-top: 2px; padding: 0; border: 0; background: none; color: var(--muted); font-size: .8rem; font-weight: 700; }
.cm-gif-img { display: block; width: auto; max-width: min(260px, 100%); height: auto; max-height: 260px; margin-top: 8px; border-radius: 12px; background: var(--surface-2); }

.cm-actions { display: flex; align-items: center; gap: 4px; margin-top: 4px; margin-left: -8px; }
.cm-like, .cm-replybtn, .cm-heart {
	display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px;
	border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: .8rem; font-weight: 650;
}
.cm-like:hover, .cm-replybtn:hover, .cm-heart:not(:disabled):hover { background: var(--surface-2); color: var(--text); }
.cm-like .i, .cm-heart .i { width: 17px; height: 17px; }
.cm-like.is-on { color: var(--accent); }
.cm-like.is-on .i { fill: currentColor; fill-opacity: .25; }
.cm-heart.is-on { color: var(--accent-2); }
.cm-heart.is-on .i { fill: currentColor; }
.cm-heart:disabled { cursor: default; }
.cm-menubtn { width: 32px; height: 32px; margin-left: auto; opacity: .7; }
.cm-item:hover .cm-menubtn, .cm-menubtn:focus-visible { opacity: 1; }
.cm-menubtn .i { width: 18px; height: 18px; }

.cm-toggle { display: inline-flex; align-items: center; margin: 2px 0 0 -8px; padding: 6px 12px; border: 0; border-radius: 999px; background: none; color: var(--accent); font-size: .85rem; font-weight: 700; }
.cm-toggle:hover { background: var(--accent-soft); }
.cm-replies { margin-top: 4px; }
.cm-replies[hidden] { display: none; }
.cm-item--reply { padding: 6px 0; }
.cm-edit { margin-top: 6px; }

.cm-empty, .cm-loading { padding: 24px 0; text-align: center; }
.cm-more { display: flex; justify-content: center; margin-top: 12px; }

/* Overflow menu */
.cm-menu {
	position: absolute; z-index: 85; display: grid; min-width: 160px; padding: 6px;
	border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.cm-menu__item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: .875rem; text-align: left; }
.cm-menu__item:hover, .cm-menu__item:focus-visible { background: var(--surface-2); }
.cm-menu__item .i { width: 17px; height: 17px; color: var(--muted); }
.cm-menu__item.is-danger { color: var(--danger); }
.cm-menu__item.is-danger .i { color: var(--danger); }

/* GIF picker */
.cm-gifs {
	position: absolute; z-index: 86; display: flex; flex-direction: column; height: 380px;
	border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden;
}
.cm-gifs[hidden] { display: none; }
.cm-gifs__top { display: flex; gap: 6px; align-items: center; padding: 10px; border-bottom: 1px solid var(--border); }
.cm-gifs__top input { flex: 1; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); outline: none; }
.cm-gifs__top input:focus { border-color: var(--accent); }
.cm-gifs__grid { flex: 1; overflow-y: auto; columns: 2; column-gap: 6px; padding: 6px; }
.cm-gif { display: block; width: 100%; margin: 0 0 6px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); break-inside: avoid; cursor: pointer; }
.cm-gif img { display: block; width: 100%; height: auto; }
.cm-gif:hover, .cm-gif:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.cm-gifs__empty { padding: 20px; text-align: center; column-span: all; }
.cm-gifs__foot { padding: 6px 12px; border-top: 1px solid var(--border); font-size: .72rem; text-align: right; }

/* Dialogs */
.cm-dialog { width: min(400px, calc(100vw - 24px)); padding: 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.cm-dialog::backdrop { background: rgba(8, 8, 20, .55); }
.cm-dialog h3 { font-size: 1.1rem; margin-bottom: 6px; }
.cm-dialog p { margin-bottom: 12px; font-size: .9rem; }
.cm-radio { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font-size: .9rem; cursor: pointer; }
.cm-radio input { width: 18px; height: 18px; accent-color: var(--accent); }
.cm-dialog__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
