/* Themed add-card dialog (assets/personal-add.js). One layout, dressed per
   category through CSS variables on [data-theme]. */
.ad-dlg { --bg: #16161c; --panel: rgba(255,255,255,0.05); --line: rgba(255,255,255,0.14); --ink: #f3f3f5; --sub: #a3a3b2; --acc: #8b5cf6; --acc-ink: #fff;
    --head: 'Outfit', 'Mitr', sans-serif; --font: 'Outfit', 'Mitr', var(--font-body, 'Plus Jakarta Sans', 'Sarabun'), sans-serif; --radius: 18px; --in-bg: rgba(0,0,0,0.3); --star: #ffc93c;
    position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 16px; background: rgba(5,4,10,0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ad-box { width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-sizing: border-box; padding: 20px 22px 18px; border-radius: var(--radius);
    background: var(--bg); color: var(--ink); font-family: var(--font); box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px var(--line); animation: adIn .28s cubic-bezier(.2,.8,.2,1); }
@keyframes adIn { from { transform: translateY(16px) scale(.98); opacity: 0; } }
.ad-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.ad-brand { display: block; font-family: var(--head); font-size: .8rem; letter-spacing: .14em; color: var(--acc); }
.ad-head h3 { margin: 2px 0 0; font-family: var(--head); font-size: 1.55rem; line-height: 1.15; }
.ad-x { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font-size: 1rem; }
.ad-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; }
.ad-cover-col { display: flex; flex-direction: column; gap: 8px; }
.ad-cover { position: relative; overflow: hidden; border-radius: 12px; background: var(--panel); border: 2px dashed var(--line); display: grid; place-items: center; width: 100%; }
.ad-cover.is-poster { aspect-ratio: 2 / 3; } .ad-cover.is-card { aspect-ratio: 3 / 4; } .ad-cover.is-wide { aspect-ratio: 4 / 3; } .ad-cover.is-round { aspect-ratio: 1; border-radius: 50%; }
.ad-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: grab; touch-action: none; user-select: none; -webkit-user-drag: none; }
.ad-cover img[hidden] { display: none; }
.ad-cover-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 2rem; color: var(--sub); text-align: center; padding: 10px; }
.ad-cover-empty small { font-size: .82rem; }
.ad-cover-empty[hidden] { display: none; }
.ad-cover-tools { display: flex; gap: 6px; }
.ad-cover-tools .ad-btn:first-child { flex: 1; justify-content: center; }
.ad-hint { color: var(--sub); font-size: .72rem; line-height: 1.4; }
.ad-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ad-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ad-f > span { font-size: .85rem; font-weight: 600; color: var(--sub); }
.ad-row { display: flex; flex-wrap: wrap; gap: 14px; }
.ad-row > .ad-f { flex: 1 1 160px; }
.ad-row > .ad-year { flex: 0 1 130px; }
.ad-in { box-sizing: border-box; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--in-bg); color: var(--ink); font: inherit; font-size: .95rem; color-scheme: dark; }
.ad-in:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 28%, transparent); }
textarea.ad-in { resize: vertical; min-height: 84px; line-height: 1.5; }
.ad-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ad-chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: .86rem; transition: background .15s ease, border-color .15s ease; }
.ad-chip:hover { border-color: var(--acc); }
.ad-chip.is-on { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); font-weight: 600; }
.ad-newtag { width: auto; flex: 1 1 140px; padding: 6px 12px; border-radius: 999px; font-size: .86rem; }
.ad-stars { display: flex; align-items: center; gap: 2px; }
.ad-star { border: 0; background: none; cursor: pointer; font-size: 1.9rem; line-height: 1; color: color-mix(in srgb, var(--ink) 22%, transparent); padding: 0 1px; transition: transform .12s ease, color .12s ease; }
.ad-star:hover { transform: scale(1.15); }
.ad-star.is-on { color: var(--star); text-shadow: 0 0 10px color-mix(in srgb, var(--star) 55%, transparent); }
.ad-rate-lab { font-style: normal; margin-left: 8px; font-size: .85rem; color: var(--sub); }
.ad-err { min-height: 1.2em; margin: 10px 0 0; color: #ff8a8a; font-size: .88rem; }
.ad-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.ad-btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 10px 20px; cursor: pointer; font: inherit; font-size: .95rem; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--ink); transition: transform .15s ease, filter .15s ease; }
.ad-btn:hover { transform: translateY(-1px); }
.ad-btn.is-main { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); box-shadow: 0 8px 20px color-mix(in srgb, var(--acc) 35%, transparent); }
.ad-btn.is-ghost { padding: 8px 14px; font-size: .85rem; }
.ad-btn:disabled { opacity: .6; cursor: default; transform: none; }
.ad-box button:focus-visible, .ad-box input:focus-visible, .ad-box select:focus-visible, .ad-box textarea:focus-visible, .ad-btn:focus-within { outline: 2px solid var(--acc); outline-offset: 2px; }
.ad-toast { position: fixed; left: 50%; bottom: 28px; z-index: 5100; transform: translateX(-50%); padding: 12px 20px; border-radius: 999px; background: #111; color: #fff; font-family: 'Outfit', 'Mitr', sans-serif; box-shadow: 0 12px 30px rgba(0,0,0,0.5); animation: adIn .25s ease; transition: opacity .4s ease; }
.ad-toast.is-out { opacity: 0; }

/* category picker (landing) */
.ad-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; }
.ad-pick button { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; color: var(--ink); cursor: pointer; font: inherit; font-size: .85rem; }
.ad-pick span { display: block; width: 72px; height: 72px; border-radius: 18px; overflow: hidden; background: #222; box-shadow: 0 8px 18px rgba(0,0,0,0.4); transition: transform .15s ease; }
.ad-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-pick button:hover span { transform: translateY(-3px) scale(1.05); }
.ad-dlg[data-theme="os"] .ad-box { background: linear-gradient(160deg, #2a1650, #120b2a); }

/* ---------- themes ---------- */
.ad-dlg[data-theme="flix"] { --bg: #141414; --acc: #e50914; --head: 'Bebas Neue', 'Outfit', 'Mitr', sans-serif; --radius: 8px; }
.ad-dlg[data-theme="flix"] .ad-head h3 { font-size: 1.9rem; letter-spacing: .03em; }
.ad-dlg[data-theme="plus"] { --bg: linear-gradient(180deg, #1a1d29, #0e1022); --acc: #0063e5; --star: #f9c74f; }
.ad-dlg[data-theme="plus"] .ad-box { background: radial-gradient(ellipse at 50% 0%, #1f3a78 0%, #0e1022 60%); }
.ad-dlg[data-theme="roll"] { --bg: #000; --panel: #141519; --acc: #f47521; --acc-ink: #000; --radius: 6px; }
.ad-dlg[data-theme="toons"] { --bg: #fff8d6; --panel: #fff; --line: #111; --ink: #111; --sub: #5a4a1f; --acc: #e11d2a; --in-bg: #fff; --head: 'Bangers', 'Outfit', 'Mitr', sans-serif; --star: #ffb300; --radius: 12px; }
.ad-dlg[data-theme="toons"] .ad-box { border: 4px solid #111; box-shadow: 10px 10px 0 #111; background-image: radial-gradient(rgba(0,0,0,0.07) 1.5px, transparent 1.6px); background-size: 12px 12px; }
.ad-dlg[data-theme="toons"] .ad-head h3 { font-size: 2.1rem; letter-spacing: .04em; color: #e11d2a; -webkit-text-stroke: 1px #111; }
.ad-dlg[data-theme="toons"] .ad-in { color-scheme: light; border-width: 2px; }
.ad-dlg[data-theme="toons"] .ad-btn.is-main { box-shadow: 4px 4px 0 #111; border: 2px solid #111; }
.ad-dlg[data-theme="holo"] { --bg: #0f1020; --acc: #b36bff; --star: #ffd86b; }
.ad-dlg[data-theme="holo"] .ad-box { box-shadow: 0 0 0 2px transparent, 0 30px 80px rgba(0,0,0,0.6); border: 2px solid transparent;
    background: linear-gradient(#0f1020, #0f1020) padding-box, linear-gradient(135deg, #ff7ad9, #7afcff, #fff67a, #b36bff) border-box; }
.ad-dlg[data-theme="ig"] { --bg: #000; --panel: #121212; --line: #363636; --acc: #0095f6; --sub: #a8a8a8; --radius: 14px; }
.ad-dlg[data-theme="ig"] .ad-brand { background: linear-gradient(90deg, #feda75, #fa7e1e, #d62976, #962fbf); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ad-dlg[data-theme="lib"] { --bg: #241810; --panel: rgba(255,236,200,0.06); --line: rgba(217,179,108,0.35); --ink: #f6ecd8; --sub: #c9b391; --acc: #d9b36c; --acc-ink: #2a1a0e; --in-bg: rgba(0,0,0,0.25); --head: 'Cormorant Garamond', 'Trirong', Georgia, serif; --star: #f0c86a; --radius: 6px; }
.ad-dlg[data-theme="lib"] .ad-head h3 { font-style: italic; font-size: 2rem; }
.ad-dlg[data-theme="quote"] { --bg: #f6f1e6; --panel: #fff; --line: #cfc5b5; --ink: #111; --sub: #6b6152; --acc: #111; --acc-ink: #f6f1e6; --in-bg: #fff; --head: 'Cormorant Garamond', Georgia, serif; --star: #c79a2e; --radius: 4px; }
.ad-dlg[data-theme="quote"] .ad-in { color-scheme: light; }
.ad-dlg[data-theme="quote"] textarea[name="quote"] { font-family: 'Cormorant Garamond', 'Trirong', Georgia, serif; font-size: 1.3rem; font-style: italic; }
.ad-dlg[data-theme="air"] { --bg: #0c1422; --panel: #111b2e; --line: #22314d; --acc: #ffc53d; --acc-ink: #0a1120; --head: 'Bebas Neue', 'Outfit', 'Mitr', sans-serif; --star: #ffc53d; }
.ad-dlg[data-theme="air"] .ad-box { border-top: 6px solid #ffc53d; }
.ad-dlg[data-theme="air"] .ad-head h3 { font-size: 1.9rem; letter-spacing: .06em; }
.ad-dlg[data-theme="guide"] { --bg: #fbf6ec; --panel: #fff; --line: #e2d6c2; --ink: #231a14; --sub: #7a6552; --acc: #c8102e; --in-bg: #fff; --head: 'Cormorant Garamond', Georgia, serif; --star: #e0a100; --radius: 6px; }
.ad-dlg[data-theme="guide"] .ad-box { border-top: 10px solid #c8102e; }
.ad-dlg[data-theme="guide"] .ad-head h3 { font-size: 2rem; font-weight: 700; }
.ad-dlg[data-theme="guide"] .ad-in { color-scheme: light; }
.ad-dlg[data-theme="lux"] { --bg: #0b0b0c; --panel: rgba(255,255,255,0.04); --line: rgba(217,181,106,0.3); --ink: #f4efe4; --sub: #a59b88; --acc: #d9b56a; --acc-ink: #1a1406; --head: 'Cormorant Garamond', Georgia, serif; --star: #d9b56a; --radius: 4px; }
.ad-dlg[data-theme="lux"] .ad-head h3 { font-style: italic; font-size: 2rem; }

@media (prefers-reduced-motion: reduce) { .ad-box, .ad-toast { animation: none; } }
@media (max-width: 680px) {
    .ad-body { grid-template-columns: 1fr; }
    .ad-cover-col { max-width: 220px; margin: 0 auto; width: 100%; }
    .ad-cover.is-wide { aspect-ratio: 16 / 10; }
    .ad-box { padding: 16px 14px; }
    .ad-head h3 { font-size: 1.3rem; }
}
