/* Post detail page. Same tokens as the Studio (genapp/gen.css): neutral greys,
   amber accent, dark mode via html.dark. */
.pd-wrap {
    --pd-bg: #ffffff;
    --pd-surface: #f4f4f5;
    --pd-surface-2: #e4e4e7;
    --pd-border: rgba(0, 0, 0, .08);
    --pd-text: #18181b;
    --pd-muted: #71717a;
    --pd-accent: var(--pt-accent, #ffc107);
    --pd-like: #f43f5e;
    --pd-danger: #ef4444;
    --pd-ok: #16a34a;
    --pd-radius: 1.25rem;
    --pd-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
    max-width: 1120px; margin: 0 auto; padding: 0 1rem 2rem; color: var(--pd-text);
}
html.dark .pd-wrap {
    --pd-bg: #262626;
    --pd-surface: #2f2f2f;
    --pd-surface-2: #3a3a3a;
    --pd-border: rgba(255, 255, 255, .08);
    --pd-text: #f4f4f5;
    --pd-muted: #a1a1aa;
    --pd-ok: #4ade80;
    --pd-shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.25);
}
.pd-wrap .material-icons { font-size: 1.1rem; line-height: 1; vertical-align: middle; }
.pd-spacer { flex: 1; }

/* header */
.pd-head { margin: 2rem 0 1.25rem; }
.pd-title { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 900; line-height: 1.25; margin: 0 0 .7rem; word-break: keep-all; overflow-wrap: anywhere; }
.pd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: var(--pd-muted); font-size: .9rem; }
.pd-author { display: inline-flex; align-items: center; gap: .45rem; padding: .2rem .75rem .2rem .2rem; border-radius: 999px; background: var(--pd-surface); border: 1px solid var(--pd-border); color: var(--pd-text); font-weight: 700; text-decoration: none; }
.pd-author:hover { color: var(--pd-text); border-color: var(--pd-surface-2); }
.pd-author img { width: 1.75rem; height: 1.75rem; border-radius: 50%; object-fit: cover; }

/* layout: media | side, description under the media; stacked on phones */
.pd-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "media" "side" "content"; gap: 1.5rem; align-items: start; }
@media (min-width: 1024px) {
    .pd-grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); grid-template-areas: "media side" "content side"; }
    .pd-side { position: sticky; top: 1rem; }
}
.pd-media { grid-area: media; display: flex; flex-direction: column; gap: 1rem; }
.pd-side { grid-area: side; display: flex; flex-direction: column; gap: 1rem; }
.pd-content { grid-area: content; font-size: 1rem; line-height: 1.75; overflow-wrap: anywhere; padding: 1.1rem 1.3rem; border-radius: var(--pd-radius); background: var(--pd-surface); border: 1px solid var(--pd-border); }
.pd-content img { max-width: 100%; height: auto; border-radius: .75rem; }

.pd-stage { display: flex; align-items: center; justify-content: center; border-radius: var(--pd-radius); overflow: hidden; background: var(--pd-surface); box-shadow: var(--pd-shadow); }
.pd-stage.is-dark { background: #0b0b0c; }
.pd-stage a { display: block; cursor: zoom-in; }
.pd-stage img, .pd-stage video { display: block; max-width: 100%; max-height: 85vh; width: auto; height: auto; margin: 0 auto; border-radius: 0; }
.pd-stage video { width: 100%; }
.pd-music { flex-direction: column; align-items: stretch; background: var(--pt-ink, #161616); }
/* The cover keeps its own ratio (no crop); the player below always shows the waveform. */
.pd-stage.pd-music .pd-cover { display: block; width: auto; max-width: 100%; height: auto; max-height: 70vh; margin: 0 auto; object-fit: contain; }
.pd-music .pt-audio { border-radius: 0; }
/* Graphic posts: the media stays blurred under a notice until "View anyway". */
.pd-media.is-graphic { position: relative; }
.pd-media.is-graphic > :not(.pd-graphic) { pointer-events: none; user-select: none; }
.pd-media.is-graphic img, .pd-media.is-graphic video { filter: blur(32px) saturate(.7); }
.pd-graphic {
    position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .35rem; padding: 1.5rem; border-radius: var(--pd-radius); background: rgba(22, 22, 22, .5); color: #fff; text-align: center; word-break: keep-all;
}
.pd-graphic .material-icons { font-size: 2rem; margin-bottom: .25rem; }
.pd-graphic strong { font-size: 1.05rem; }
.pd-graphic > span:not(.material-icons) { font-size: .9rem; opacity: .85; }
.pd-graphic .pt-btn { margin-top: .6rem; }
.pd-source { display: flex; align-items: center; gap: .9rem; margin: 0; padding: .6rem; border-radius: 1rem; background: var(--pd-surface); border: 1px solid var(--pd-border); }
.pd-source img, .pd-source video { width: 7rem; height: 7rem; object-fit: cover; border-radius: .7rem; }
.pd-source figcaption { color: var(--pd-muted); font-size: .85rem; }

/* actions */
.pd-actions { display: flex; align-items: center; gap: .5rem; }
.pd-like-form { display: contents; }
.pd-like { font: inherit; cursor: pointer; }
.pd-like-msg { margin: .5rem 0 0; color: var(--pd-danger); font-size: .875rem; white-space: pre-line; }
.pd-like { display: inline-flex; align-items: center; padding: .45rem 1.1rem; border-radius: 999px; background: var(--pd-surface); border: 1px solid var(--pd-border); color: var(--pd-text); font-weight: 700; text-decoration: none; transition: transform .1s; }
.pd-like:hover { color: var(--pd-text); border-color: var(--pd-like); }
.pd-like:active { transform: scale(.97); }
.pd-like .upvote_button { display: inline-flex; align-items: center; gap: .4rem; }
.pd-like .material-icons { color: var(--pd-like); font-size: 1.35rem; }
.pd-like.is-on { background: rgba(244, 63, 94, .12); border-color: rgba(244, 63, 94, .45); }
.pd-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 1px solid var(--pd-border); background: var(--pd-surface); color: var(--pd-text); cursor: pointer; }
.pd-icon-btn.is-copied { border-color: var(--pd-ok); color: var(--pd-ok); }
.pd-text-btn { display: inline-flex; align-items: center; gap: .25rem; font-size: .82rem; color: var(--pd-muted); text-decoration: none; padding: .3rem .5rem; border-radius: .6rem; }
.pd-text-btn.is-danger:hover { color: var(--pd-danger); background: rgba(239, 68, 68, .08); }

.pd-badges { display: flex; flex-wrap: wrap; gap: .45rem; }
.pd-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border-radius: 999px; font-size: .82rem; border: 1px solid var(--pd-border); background: var(--pd-surface); color: var(--pd-text); text-decoration: none; }
.pd-badge.is-site { background: var(--pt-accent-soft); border-color: var(--pt-accent); }
.pd-badge.is-site .material-icons { color: var(--pt-accent-text); }
.pd-badge.is-link:hover { border-color: var(--pd-accent); color: var(--pd-text); }
.pd-badge.is-link .material-icons { color: var(--pt-accent-text); }

/* generation data card */
.pd-card { background: var(--pd-surface); border: 1px solid var(--pd-border); border-radius: var(--pd-radius); padding: 1.1rem; }
.pd-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .9rem; }
.pd-card-head h2 { display: flex; align-items: center; gap: .4rem; font-size: 1rem; font-weight: 800; margin: 0; }
.pd-card-head h2 .material-icons { color: var(--pd-muted); }
.pd-warn { font-size: .8rem; color: var(--pd-danger); margin: 0 0 .75rem; }
.pd-label { font-size: .75rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--pd-muted); }

.pd-prompt { background: var(--pd-bg); border: 1px solid var(--pd-border); border-radius: 1rem; padding: .75rem .85rem .5rem; margin-bottom: .7rem; }
.pd-prompt.is-negative .pd-label { color: var(--pd-danger); }
.pd-prompt-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .45rem; }
.pd-prompt-text { font-family: var(--pt-font-mono); font-size: .88rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.pd-expand { display: flex; justify-content: center; }
.pd-expand .expand-btn-wrap { align-items: center; gap: .1rem; border: 0; background: transparent; color: var(--pd-muted); font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; }
.pd-expand .expand-btn-wrap:hover { color: var(--pd-text); background: var(--pd-surface); }

.pd-copy { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.pd-pill { position: relative; border: 1px solid var(--pd-border); background: var(--pd-surface); color: var(--pd-text); border-radius: 999px; padding: .12rem .6rem; font-size: .72rem; font-weight: 700; cursor: pointer; transition: filter .12s; }
.pd-pill:hover { filter: brightness(.96); }
/* copy buttons are outlined; only "Copy all" in the WebUI format, the usual pick, is filled */
.pd-pill.is-nai, .pd-pill.is-webui { background: var(--pd-bg); color: var(--pd-text); border-color: var(--pt-border-strong); }
.pd-card-foot .pd-pill.is-webui { background: var(--pd-accent); color: var(--pt-on-accent); border-color: var(--pd-accent); }
.pd-pill.is-copied { color: transparent; }
.pd-term-toggle { display: inline-flex; align-items: center; padding: .05rem .45rem; color: var(--pd-muted); }
.pd-term-toggle .material-icons { font-size: 1rem; }
.pd-term-toggle.is-on { color: var(--pd-text); border-color: var(--pd-accent); }
.pd-pill.is-copied::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--pd-ok); background: var(--pd-bg); border-radius: inherit; }

.pd-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); grid-auto-flow: dense; gap: .45rem; margin: .2rem 0 0; }
.pd-param { position: relative; padding: .5rem .7rem; border-radius: .8rem; background: var(--pd-bg); border: 1px solid var(--pd-border); cursor: copy; min-width: 0; transition: border-color .12s; }
.pd-param:hover, .pd-param:focus-visible { border-color: var(--pd-accent); outline: none; }
.pd-param.is-wide { grid-column: 1 / -1; }
.pd-param.is-static { cursor: default; }
.pd-param.is-static:hover { border-color: var(--pd-border); }
.pd-param dt { font-size: .7rem; font-weight: 600; color: var(--pd-muted); margin: 0 1.2rem .1rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-param dd { margin: 0; font-family: var(--pt-font-mono); font-size: .84rem; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.pd-param dd a { font-size: .75rem; font-weight: 500; margin-left: .3rem; }
.pd-param-copy { position: absolute; top: .45rem; right: .5rem; font-size: .85rem !important; color: var(--pd-muted); opacity: 0; transition: opacity .12s; }
.pd-param:hover .pd-param-copy { opacity: 1; }
.pd-param.is-copied { border-color: var(--pd-ok); }
.pd-param.is-copied .pd-param-copy { opacity: 1; color: var(--pd-ok); }
.pd-hash { display: inline-flex; align-items: center; gap: .15rem; padding: .05rem .5rem; border-radius: 999px; background: var(--pt-accent-soft); color: var(--pt-accent-text) !important; text-decoration: none; }
.pd-hash .material-icons { font-size: .75rem; }

.pd-card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--pd-border); }
.pd-card-foot .pd-pill { padding: .25rem .9rem; font-size: .78rem; }
.pd-empty { display: flex; align-items: center; justify-content: center; gap: .4rem; padding: 1.5rem 0; color: var(--pd-muted); font-size: .9rem; }

.pd-owner { display: flex; gap: .5rem; }
.pd-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .6rem 1rem; border-radius: 999px; font-weight: 700; font-size: .92rem; text-decoration: none; background: var(--pd-text); color: var(--pd-bg); }
.pd-btn:hover { color: var(--pd-bg); filter: brightness(1.1); }
.pd-btn.is-danger { background: transparent; color: var(--pd-danger); border: 1px solid currentColor; }
.pd-btn.is-danger:hover { color: var(--pd-danger); background: rgba(239, 68, 68, .08); }
.pd-btn.is-ghost { background: var(--pd-surface); color: var(--pd-text); flex: none; }
.pd-btn.is-soft { background: var(--pd-surface); color: var(--pd-text); border: 1px solid var(--pd-border); }
.pd-btn.is-soft:hover { color: var(--pd-text); border-color: var(--pd-accent); }
.pd-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* thumbnail page (articleapp/thumbnail.html) */
.pt-wrap { max-width: 920px; }
.pt-back { margin: 0 0 .6rem -.5rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-lead { color: var(--pd-muted); margin: 0; }
.pt-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (min-width: 768px) { .pt-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pt-tag { font-size: .72rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; background: var(--pd-bg); border: 1px solid var(--pd-border); color: var(--pd-muted); }
.pt-tag.is-custom { background: var(--pd-accent); border-color: var(--pd-accent); color: #1c1917; }
.pt-previews { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.pt-preview { margin: 0; flex: 1 1 10rem; max-width: 15rem; }
.pt-preview[hidden] { display: none; }
.pt-frame { border-radius: 1rem; overflow: hidden; background: var(--pd-bg); border: 1px solid var(--pd-border); box-shadow: var(--pd-shadow); }
.pt-frame img { display: block; width: 100%; height: auto; max-height: 24rem; object-fit: cover; }
.pt-preview.is-new .pt-frame { border: 2px solid var(--pd-accent); }
.pt-preview figcaption { margin-top: .45rem; font-size: .8rem; font-weight: 700; color: var(--pd-muted); text-align: center; }
.pt-placeholder { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; color: var(--pd-muted); }
.pt-placeholder .material-icons { font-size: 2.5rem; }
.pt-note { display: flex; gap: .45rem; align-items: flex-start; margin: .9rem 0 0; font-size: .85rem; color: var(--pd-muted); }
.pt-note.is-block { margin: 0; padding: .9rem 1rem; border-radius: 1rem; background: var(--pd-bg); border: 1px solid var(--pd-border); }
.pt-pick-title { margin: 0 0 .5rem; font-size: .85rem; font-weight: 700; color: var(--pd-muted); }
.tp-grid + .pt-pick-title, .tp-hint + .pt-pick-title { margin-top: 1rem; }
.pt-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.6rem 1rem; border: 2px dashed var(--pd-surface-2); border-radius: 1rem; background: var(--pd-bg); text-align: center; cursor: pointer; transition: border-color .12s, background .12s; }
.pt-drop:hover, .pt-drop.is-over { border-color: var(--pd-accent); }
.pt-drop .material-icons { font-size: 2rem; color: var(--pd-muted); }
.pt-drop strong { font-size: .95rem; overflow-wrap: anywhere; }
.pt-drop span { font-size: .8rem; color: var(--pd-muted); }
.pt-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pt-error { margin: .6rem 0 0; }
.pt-save { width: 100%; margin-top: .9rem; border: 0; }
.pt-reset { display: flex; align-items: center; gap: .8rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--pd-border); }
.pt-reset img { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: .7rem; flex: none; }
.pt-reset div { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pt-reset strong { font-size: .9rem; }
.pt-reset span { font-size: .78rem; color: var(--pd-muted); }
.pt-reset .pd-btn { flex: none; padding: .45rem .9rem; font-size: .85rem; }

/* comments */
/* similar songs / videos (analysisapp.related): a row of small square cards */
.pd-similar { margin: 3rem 0 0; }
.pd-similar-title { display: flex; align-items: center; gap: .45rem; font-size: 1.25rem; font-weight: 800; margin: 0 0 1rem; }
.pd-wrap .pd-similar-title .material-icons { font-size: 1.4rem; color: var(--pd-accent); }
.pd-similar-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.pd-similar-card { min-width: 0; }
.pd-similar-thumb { --pt-ov-play: 2.75rem; position: relative; aspect-ratio: 1 / 1; border-radius: var(--pt-radius-md, 12px); overflow: hidden; background: var(--pd-surface); box-shadow: var(--pd-shadow); }
.pd-similar-thumb > a { display: block; width: 100%; height: 100%; }
.pd-similar-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.pd-similar-thumb > a:hover img { transform: scale(1.04); }
.pd-similar-thumb > a:has(> .pt-card-graphic) img { transform: none; }
.pd-wrap .pd-similar-thumb .pt-card-play .material-icons { font-size: 1.75rem; color: inherit; }
.pd-similar-cap { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .15rem 0; color: var(--pd-text); text-decoration: none; }
.pd-similar-cap:hover { color: var(--pd-text); text-decoration: none; }
.pd-similar-name, .pd-similar-by { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pd-derived-count { font-size: .95rem; font-weight: 600; color: var(--pd-muted); font-variant-numeric: tabular-nums; }
.pd-similar-name { font-weight: 700; font-size: .9rem; }
.pd-similar-cap:hover .pd-similar-name { text-decoration: underline; text-decoration-color: var(--pd-accent); text-underline-offset: 3px; }
.pd-similar-by { color: var(--pd-muted); font-size: .8rem; }
@media (max-width: 480px) {
    .pd-similar-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
}

.pd-comments { max-width: 800px; margin: 3rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--pd-border); }
.pd-comments h3 { font-size: 1.25rem; font-weight: 800; margin-bottom: 1rem; }
.pd-comments-empty { color: var(--pd-muted); font-size: .9rem; margin: 0 0 1rem; }

/* prompt words link to a Prompts tab search (tagapp prompt_links), only after the
   search button turns them on; until then they read and select as plain text */
a.pd-term { color: inherit; text-decoration: none; border-radius: .2rem; pointer-events: none; cursor: text; }
.pd-prompt-text.is-linked a.pd-term { pointer-events: auto; cursor: pointer; text-decoration: underline dotted; text-decoration-color: var(--pd-muted); text-underline-offset: 3px; }
.pd-prompt-text.is-linked a.pd-term:hover { text-decoration: underline; text-decoration-color: var(--pd-accent, #ffc107); text-underline-offset: 3px; }

/* touch sizes on phones (design review: copy pills were about 22px tall) */
@media (max-width: 767.98px) {
    .pd-pill { min-height: 2.25rem; padding: .35rem .8rem; font-size: .78rem; }
    .pd-term-toggle { min-width: 2.25rem; justify-content: center; }
    .pd-expand .expand-btn-wrap { min-height: 2.25rem; }
}
