:root{
 color-scheme:dark;
 --bg:#17181c;--panel:#202227;--panel-2:#2a2c33;--line:#363840;--text:#f4f1ea;--muted:#a3a6ad;
 --accent:#ffdf7f;--accent-ink:#1b1b1b;--danger:#ff8a80;--focus:#7fbfff;
 --poster-w:64px;--radius:10px;
 font-family:system-ui,-apple-system,"Hiragino Sans","Noto Sans JP","Yu Gothic UI",sans-serif;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--text);line-height:1.6;min-height:100vh;display:flex;flex-direction:column}
a{color:var(--accent)}
h1,h2{line-height:1.3;margin:0 0 .5em}
h1{font-size:clamp(1.5rem,4vw,2.1rem)}
h2{font-size:1.1rem}
p{margin:0 0 .75em}
img{display:block;max-width:100%}
button,input{font:inherit;color:inherit}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.muted{color:var(--muted)}
.small{font-size:.85rem}
.hint{color:var(--muted);font-size:.85rem;margin:.4em 0 0}
.error{color:var(--danger);min-height:1em}
.status{color:var(--muted)}

/* header / footer */
.site{position:sticky;top:0;z-index:20;display:flex;flex-wrap:wrap;gap:.5rem 1.5rem;align-items:center;justify-content:space-between;padding:.6rem 16px;background:rgba(23,24,28,.94);border-bottom:1px solid var(--line);backdrop-filter:blur(6px)}
.brand{display:flex;align-items:center;gap:.5rem;font-weight:700;color:var(--text);text-decoration:none}
.brand-mark{display:grid;gap:2px;width:22px}
.brand-mark i{display:block;height:5px;border-radius:2px;background:#ff7f7f}
.brand-mark i:nth-child(2){background:#ffbf7f;width:75%}
.brand-mark i:nth-child(3){background:#ffdf7f;width:50%}
.site nav{display:flex;gap:.25rem;overflow-x:auto}
.site nav a{color:var(--muted);text-decoration:none;padding:.35rem .7rem;border-radius:999px;white-space:nowrap;font-size:.95rem}
.site nav a[aria-current]{background:var(--panel-2);color:var(--text)}
.page{flex:1;width:100%;max-width:1080px;margin:0 auto;padding:1.25rem 16px 3rem}
.page:focus{outline:none}
.site-footer{padding:0 16px 2rem;border-top:1px solid var(--line);color:var(--muted);font-size:.8rem;line-height:1.8}
.footer-inner{max-width:680px;margin:0 auto}
.footer-inner>*{margin:0;padding:1.2rem 0;border-bottom:1px solid var(--line)}
.footer-inner>:last-child{border-bottom:0}
.site-footer a{color:var(--text)}
.footer-support{display:flex;align-items:center;justify-content:space-between;gap:16px}
.footer-support h2{margin:0;font-size:.85rem;color:var(--text)}
.footer-support p{margin:.3em 0 0}
.footer-support>a{flex:none;color:var(--accent);font-weight:600;white-space:nowrap}
.footer-maker,.footer-maker-links{display:flex;flex-wrap:wrap;align-items:center;gap:10px 18px}
.footer-support>a,.footer-maker-links a{font-weight:600;text-decoration:none}
.footer-support>a,.footer-maker-links a{min-height:44px;display:inline-flex;align-items:center}
.footer-support>a:hover,.footer-maker-links a:hover{text-decoration:underline}
.footer-x{gap:6px}
.footer-x svg{flex:none}
.footer-credit{font-size:.72rem}
@media (max-width:460px){.footer-support{flex-direction:column;align-items:flex-start;gap:6px}}
.reading{max-width:640px}

/* controls */
.button{display:inline-flex;align-items:center;justify-content:center;gap:.3rem;min-height:44px;padding:.5rem 1.1rem;border:1px solid var(--line);border-radius:999px;background:var(--panel-2);color:var(--text);text-decoration:none;cursor:pointer;font-weight:600}
.button:hover{border-color:#50535c}
.button:disabled{opacity:.45;cursor:not-allowed}
.button.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.button.ghost{background:transparent}
.button.small{min-height:36px;padding:.3rem .8rem;font-size:.85rem}
.button.danger{background:var(--danger);border-color:var(--danger);color:#1b1b1b}
.danger-text{color:var(--danger)}
.actions{display:flex;flex-wrap:wrap;gap:.5rem;justify-content:flex-end;margin-top:1rem}
.row-actions{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.75rem}
.field{display:block;margin-bottom:1rem}
.field>span:first-child,.label{display:block;font-weight:600;margin-bottom:.35rem}
input[type=text],input[type=search]{width:100%;min-height:44px;padding:.55rem .8rem;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--text)}
input::placeholder{color:#6f727a}
.segmented{display:flex;flex-wrap:wrap;gap:.4rem;align-items:center}
.segmented button{min-height:38px;padding:.35rem .9rem;border:1px solid var(--line);border-radius:999px;background:transparent;cursor:pointer}
.segmented button[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font-weight:700}
.chip{padding:.2rem .7rem;border-radius:999px;border:1px dashed var(--muted);color:var(--muted);font-size:.85rem}

/* layout */
.intro{margin-bottom:1rem}
.lead{color:var(--muted)}
.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:1rem;margin-bottom:1rem}
.board-card{padding:.5rem}
.board-tools{display:flex;justify-content:space-between;gap:.5rem;padding:.5rem .25rem 0}

/* tier board */
.board{display:grid;gap:4px}
.tier-row{display:grid;grid-template-columns:clamp(64px,14vw,110px) 1fr auto;min-height:calc(var(--poster-w)*1.5 + 10px);background:var(--bg);border-radius:6px;overflow:hidden}
.board.readonly .tier-row{grid-template-columns:clamp(64px,14vw,110px) 1fr}
.tier-label{display:flex;align-items:center;justify-content:center;padding:.4rem;border:0;color:#1b1b1b;font-weight:800;font-size:clamp(.85rem,2.4vw,1.25rem);text-align:center;word-break:break-word;line-height:1.2}
button.tier-label{cursor:pointer}
.row-menu{width:36px;border:0;background:var(--panel-2);color:var(--muted);font-size:1.2rem;cursor:pointer}
.zone{display:flex;flex-wrap:wrap;align-content:flex-start;gap:5px;padding:5px;min-height:calc(var(--poster-w)*1.5 + 10px)}
.pool-zone{background:var(--bg);border:1px dashed var(--line);border-radius:8px;min-height:calc(var(--poster-w)*1.5 + 12px)}
.pool-zone.empty::before{content:"まだ映画がありません。下の検索から追加してください。";color:var(--muted);font-size:.85rem;padding:.5rem}
.poster{padding:0;border:0;background:none;cursor:grab;border-radius:4px;touch-action:manipulation;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.poster:active{cursor:grabbing}
.thumb{display:block;width:var(--poster-w);aspect-ratio:2/3;border-radius:4px;overflow:hidden;background:var(--panel-2);flex:none}
.thumb img{width:100%;height:100%;object-fit:cover;pointer-events:none}
.no-poster{display:flex;align-items:center;justify-content:center;height:100%;padding:3px;font-size:.62rem;line-height:1.25;color:var(--muted);text-align:center;overflow:hidden;word-break:break-all}
.poster.dragging{opacity:.25}
.placeholder{width:var(--poster-w);aspect-ratio:2/3;border:2px dashed var(--accent);border-radius:4px;flex:none}
.ghost-poster{position:fixed;left:0;top:0;z-index:100;pointer-events:none;opacity:.92;box-shadow:0 10px 30px rgba(0,0,0,.6);transform-origin:center}
body.is-dragging{-webkit-user-select:none;user-select:none;cursor:grabbing}

/* search */
.search{display:flex;gap:.5rem;margin-bottom:.5rem}
.search input{flex:1}
.results{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:.5rem}
.result{display:flex;align-items:center;gap:.75rem;padding:.4rem;border-radius:8px;background:var(--bg)}
.result .thumb{--poster-w:44px}
.result-text{flex:1;min-width:0;display:flex;flex-direction:column}
.result-text strong{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:.95rem}
.pager{display:flex;align-items:center;justify-content:center;gap:1rem;margin-top:1rem}
.counter{color:var(--muted);font-size:.9rem}

/* dialog */
.sheet{width:min(520px,calc(100vw - 32px));max-height:calc(100vh - 32px);border:1px solid var(--line);border-radius:14px;background:var(--panel);color:var(--text);padding:1.25rem}
.sheet::backdrop{background:rgba(0,0,0,.6)}
.sheet-head{display:flex;gap:1rem;align-items:flex-start;margin-bottom:.75rem}
.sheet-head .thumb{--poster-w:72px}
.move-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:.4rem}
.move-target{min-height:48px;border:0;border-radius:8px;color:#1b1b1b;font-weight:700;cursor:pointer;padding:.3rem;word-break:break-word}
.move-target.pool{background:var(--panel-2);color:var(--text);border:1px dashed var(--muted)}
.move-target:disabled{opacity:.35;cursor:default;outline:2px solid var(--text);outline-offset:-4px}
.swatches{display:flex;flex-wrap:wrap;gap:.5rem}
.swatch{width:40px;height:40px;border-radius:50%;border:3px solid transparent;cursor:pointer}
.swatch[aria-checked=true]{border-color:var(--text);box-shadow:0 0 0 2px var(--bg) inset}
.stack>*:last-child{margin-bottom:0}
.share-image{width:100%;border-radius:8px;margin:.5rem 0;background:var(--bg);min-height:120px}

/* detail */
.detail-head{margin-bottom:1rem}
.eyebrow{font-size:.85rem;margin-bottom:.25rem}
.detail .poster{cursor:pointer}
.share,.owner-actions{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:1.25rem}
.cta{margin-top:2rem;text-align:center}
.cta p{margin:.6rem 0 0}

/* lists */
.list-head{margin-bottom:1rem}
.cards{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:.75rem}
.list-card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.card-link{display:flex;flex-direction:column;gap:.5rem;padding:1rem;color:var(--text);text-decoration:none}
.card-link:hover .card-title{text-decoration:underline}
.card-title{font-weight:700;font-size:1.05rem}
.card-preview{display:grid;gap:3px}
.mini-row{display:flex;gap:3px;align-items:stretch;background:var(--bg);border-radius:4px;overflow:hidden;--poster-w:34px}
.mini-label{display:flex;align-items:center;justify-content:center;min-width:44px;max-width:72px;padding:0 4px;color:#1b1b1b;font-size:.7rem;font-weight:800;text-align:center;line-height:1.1;overflow:hidden}
.card-actions{display:flex;flex-wrap:wrap;gap:.4rem;padding:0 1rem 1rem}
.empty-state{text-align:center;padding:2rem 0}

.toast{position:fixed;left:50%;bottom:24px;transform:translate(-50%,20px);opacity:0;z-index:200;background:var(--text);color:var(--bg);padding:.6rem 1.1rem;border-radius:999px;font-weight:600;transition:.2s;pointer-events:none;max-width:calc(100vw - 32px)}
.toast.show{opacity:1;transform:translate(-50%,0)}

@media (max-width:600px){
 :root{--poster-w:52px}
 .card{padding:.8rem}
 .site{padding:.5rem 16px}
 .site nav{width:100%;justify-content:space-between}
 .cards{grid-template-columns:1fr}
 .results{grid-template-columns:1fr}
}
@media (prefers-reduced-motion:reduce){.toast{transition:none}}
/* search: decade filter, people, person filmography */
[hidden]{display:none!important}
.person-head .segmented{flex-wrap:nowrap}
.decades{flex-wrap:nowrap;overflow-x:auto;margin:.25rem 0 .5rem;padding-bottom:.25rem;scrollbar-width:none}
.decades::-webkit-scrollbar{display:none}
.decades button{flex:none;min-height:34px;padding:.25rem .75rem;font-size:.85rem}
.people{list-style:none;margin:.25rem 0 .75rem;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:.5rem}
.people-note{grid-column:1/-1;color:var(--muted);font-size:.85rem}
.person{display:flex;align-items:center;gap:.75rem;width:100%;padding:.45rem .6rem;border:1px solid var(--line);border-radius:10px;background:var(--bg);color:inherit;text-align:left;cursor:pointer;font:inherit}
.face{width:44px;height:44px;border-radius:50%;overflow:hidden;background:var(--panel-2);flex:none}
.face img{width:100%;height:100%;object-fit:cover}
.person-text{flex:1;min-width:0;display:flex;flex-direction:column}
.person-text strong{font-size:.95rem}
.person-text .muted{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.person-head{display:flex;flex-direction:column;align-items:flex-start;gap:.5rem;margin:.25rem 0 .75rem}
.person-head h3{margin:0;font-size:1.15rem}
.check{display:flex;gap:.5rem;align-items:flex-start;cursor:pointer;margin:.25rem 0}
.check input{width:1.1rem;height:1.1rem;margin:.25rem 0 0;flex:none;accent-color:var(--accent)}
.check .hint{display:inline;margin:0}
/* movie dialog: director line is always two lines tall; longer lists end with … */
.director-line{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden;height:3.2em;line-height:1.6;margin-bottom:0;overflow-wrap:anywhere}
