:root{
 color-scheme:dark;
 --bg:#0c0d10;--surface:#15171c;--surface-2:#1d2027;--line:#2a2e37;
 --text:#f4f1ea;--muted:#9a9ca6;--faint:#5d606b;
 --gold:#f6c453;--gold-ink:#231a04;--gold-soft:#f6c4531f;
 --font-body:'Manrope',system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif;
 --font-display:'Unbounded','Manrope',system-ui,sans-serif;
 --r-md:16px;--r-sm:12px;
}
:root[data-theme=light]{
 color-scheme:light;
 --bg:#f5f2ec;--surface:#fff;--surface-2:#efebe3;--line:#e0dbd0;
 --text:#1b1a17;--muted:#6f6b62;--faint:#a7a196;
 --gold:#e8a917;--gold-soft:#e8a9171f;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text)}
/* A game, not a page: no pinch/double-tap zoom, no text selection or long-press callouts. */
body{font:15px/1.4 var(--font-body);-webkit-font-smoothing:antialiased;touch-action:manipulation;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
input{-webkit-user-select:text;user-select:text}
img{-webkit-user-drag:none}
button,input{font:inherit;color:inherit}
button{cursor:pointer;-webkit-tap-highlight-color:transparent;border:0;background:none;padding:0}
button:disabled{opacity:.38;cursor:default}
:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
img{display:block}
[hidden]{display:none!important}
h1,p{margin:0}
.app{max-width:560px;margin:0 auto;padding:max(16px,env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));min-height:100dvh;display:flex;flex-direction:column}
.notice{margin:0 0 12px;padding:10px 14px;border-radius:var(--r-sm);background:var(--surface-2);font-size:13px}

/* Home */
.logo{font-family:var(--font-display);font-size:28px;font-weight:900;letter-spacing:-.02em;margin:4px 0 16px}
.logo span{color:var(--gold)}
.event-logo{margin-left:10px;font-family:'Dela Gothic One',var(--font-display);font-size:.56em;font-weight:400;color:#ff6fb5;text-shadow:0 0 10px #ff6fb599;vertical-align:middle}
.search{display:flex;align-items:center;gap:10px;height:48px;padding:0 14px;border-radius:var(--r-md);background:var(--surface);border:1px solid var(--line)}
.search:focus-within{border-color:var(--gold)}
.search span{color:var(--muted);font-size:18px}
.search input{flex:1;min-width:0;height:100%;border:0;background:none;outline:none;font-size:15px}
.search input::placeholder{color:var(--faint)}
.groups{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;margin:12px -16px 0;padding:0 16px}
.groups::-webkit-scrollbar{display:none}
.chip{flex:none;height:34px;padding:0 14px;border-radius:999px;background:var(--surface);border:1px solid var(--line);color:var(--muted);font-size:13px;font-weight:600;white-space:nowrap}
.chip.on{background:var(--text);border-color:var(--text);color:var(--bg)}
/* People views: gold, set apart from the category chips. */
.chip.people{background:var(--gold-soft);border-color:#f6c45355;color:var(--gold)}
.chip.people.on{background:var(--gold);border-color:var(--gold);color:var(--gold-ink)}
.chip.people[data-group="public"]{margin-right:8px}
/* Same icons as Pick Club's chips: people for Найзууд, a bookmark for Миний, a globe for Нийтийн. */
.chip.people{display:inline-flex;align-items:center;gap:6px}
.chip.people::before{content:"";flex:none;width:14px;height:14px;background:currentColor;-webkit-mask:var(--icon) center/contain no-repeat;mask:var(--icon) center/contain no-repeat}
.chip[data-group="friends"]{--icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%229%22 cy=%228%22 r=%223.5%22/%3E%3Cpath d=%22M2 20v-1a5 5 0 0 1 5-5h4a5 5 0 0 1 5 5v1M16 4.3a3.5 3.5 0 0 1 0 7.4M22 20v-1a5 5 0 0 0-3.5-4.8%22/%3E%3C/svg%3E")}
.chip[data-group="mine"]{--icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M6 3h12v18l-6-4-6 4z%22/%3E%3C/svg%3E")}
.chip[data-group="public"]{--icon:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%229%22/%3E%3Cpath d=%22M3 12h18M12 3a14 14 0 0 1 0 18M12 3a14 14 0 0 0 0 18%22/%3E%3C/svg%3E")}
.results{font-size:12px;color:var(--muted);margin-top:8px}
.results:empty{display:none}
.themes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:12px}
.theme{display:flex;flex-direction:column;text-align:left;border-radius:var(--r-md);background:var(--surface);border:1px solid var(--line);overflow:hidden}
.theme:active{transform:scale(.98)}
.art{position:relative;height:110px;overflow:hidden;background:radial-gradient(90% 100% at 50% 100%,var(--gold-soft),transparent 75%),var(--surface-2)}
.art>img{position:absolute;bottom:0;height:88%;width:58%;object-fit:contain;object-position:bottom}
.art>img:first-child{left:-10%;height:74%;opacity:.55;transform:rotate(-8deg);transform-origin:bottom}
.art>img:nth-child(2){left:21%;z-index:1;filter:drop-shadow(0 8px 14px #0008)}
.art>img:nth-child(3){right:-10%;height:74%;opacity:.55;transform:rotate(8deg);transform-origin:bottom}
.theme strong{padding:10px 12px 0;font-size:14px;font-weight:700;line-height:1.25}
.theme small{padding:2px 12px 12px;font-size:12px;color:var(--muted)}
.theme small b{color:var(--gold);font-weight:700}
.uses{position:absolute;top:6px;right:6px;z-index:2;padding:2px 7px;border-radius:999px;background:#000b;color:#fff;font-size:11px;font-weight:700;line-height:16px}
.uses:empty{display:none}
.new-tag{position:absolute;top:6px;left:6px;z-index:2;padding:2px 8px;border-radius:999px;background:var(--gold);color:var(--gold-ink);font-size:10px;font-weight:900;letter-spacing:.06em;line-height:16px}
/* Event card (Anime Week): sakura-pink frame that shimmers to violet, a soft pink fade over the photos. */
.theme.event{border-color:#ff6fb5;box-shadow:0 0 0 1px #ff6fb5,0 0 22px -4px #ff6fb5;animation:event-glow 2.6s ease-in-out infinite}
.theme.event .art::after{content:'';position:absolute;inset:0;z-index:1;background:linear-gradient(to top,#3a0f33cc,#3a0f3333 45%,transparent 70%);pointer-events:none}
.theme.event strong{color:#ff8cc6}
.event-tag{background:#ff6fb5;color:#2a0619;box-shadow:0 0 12px #ff6fb599}
@keyframes event-glow{50%{border-color:#8b7bff;box-shadow:0 0 0 1px #8b7bff,0 0 28px 0 #8b7bffaa}}
@media (prefers-reduced-motion:reduce){.theme.event{animation:none}}
/* Event dress-up over every screen: sakura petals drifting down, a pink and violet glow. */
.event-decor{position:fixed;inset:0;z-index:50;pointer-events:none;overflow:hidden;background:radial-gradient(120% 55% at 50% 112%,#ff6fb51f,transparent 62%),radial-gradient(90% 45% at 50% -12%,#8b7bff1c,transparent 62%)}
.event-decor i{position:absolute;top:-30px;font-style:normal;opacity:.8;animation:petal 14s linear infinite}
.event-decor i:nth-child(1){left:3%;font-size:14px;animation-duration:13s;animation-delay:-0s}
.event-decor i:nth-child(2){left:12%;font-size:18px;animation-duration:17s;animation-delay:-5s}
.event-decor i:nth-child(3){left:21%;font-size:12px;animation-duration:11s;animation-delay:-9s}
.event-decor i:nth-child(4){left:30%;font-size:16px;animation-duration:15s;animation-delay:-2s}
.event-decor i:nth-child(5){left:39%;font-size:20px;animation-duration:19s;animation-delay:-12s}
.event-decor i:nth-child(6){left:48%;font-size:13px;animation-duration:12s;animation-delay:-7s}
.event-decor i:nth-child(7){left:57%;font-size:17px;animation-duration:16s;animation-delay:-3s}
.event-decor i:nth-child(8){left:66%;font-size:15px;animation-duration:14s;animation-delay:-10s}
.event-decor i:nth-child(9){left:75%;font-size:19px;animation-duration:18s;animation-delay:-6s}
.event-decor i:nth-child(10){left:84%;font-size:12px;animation-duration:12s;animation-delay:-1s}
.event-decor i:nth-child(11){left:92%;font-size:16px;animation-duration:15s;animation-delay:-8s}
.event-decor i:nth-child(12){left:97%;font-size:14px;animation-duration:17s;animation-delay:-13s}
@keyframes petal{0%{transform:translate(0,0) rotate(0)}50%{transform:translate(40px,55vh) rotate(180deg)}100%{transform:translate(-20px,calc(100vh + 40px)) rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.event-decor i{display:none}}
.logo-art>img{background:#fff;padding:8px;border-radius:10px}

/* Board: tiers on top, the current pick and the pool below, all inside one phone screen. */
/* Exactly one screen tall (flex:none: flex:1 would let the content stretch it). 100vh first for WebViews
   without dvh. */
#board,#friend,#done{flex:none;min-height:0;display:flex;flex-direction:column;gap:8px;height:calc(100vh - max(16px,env(safe-area-inset-top)) - 16px - env(safe-area-inset-bottom));height:calc(100dvh - max(16px,env(safe-area-inset-top)) - 16px - env(safe-area-inset-bottom))}
.bar{display:flex;align-items:center;gap:10px}
.icon{width:38px;height:38px;border-radius:50%;background:var(--surface);border:1px solid var(--line);font-size:18px}
.bar strong{flex:1;min-width:0;font-family:var(--font-display);font-size:17px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#progress{font-size:12px;font-weight:700;color:var(--muted)}
.tiers{flex:1 1 auto;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:3px;border-radius:var(--r-sm);background:#000;padding:3px}
.tier{flex:1 0 auto;display:flex;min-height:calc(var(--s,46px) + 6px);background:var(--surface);border-radius:6px;overflow:hidden;transition:background .15s}
.tier.target{background:var(--surface-2);box-shadow:inset 0 0 0 2px var(--gold)}
.tier>b{flex:none;width:48px;display:grid;place-items:center;background:var(--t);color:#1a1a1a;font-family:var(--font-display);font-size:16px;font-weight:900}
.slot{position:relative;flex:1;display:flex;flex-wrap:wrap;align-content:flex-start;gap:3px;padding:3px}
.item{position:relative;width:46px;height:46px;border-radius:6px;overflow:hidden;background:var(--surface-2);touch-action:none;cursor:grab}
.pool .item{flex:none;width:66px;height:66px;touch-action:pan-x}
/* Pictures in the tiers take the size the app works out (--s): as big as fits on one screen. */
.tiers .item{width:var(--s,46px);height:var(--s,46px)}
.item img{width:100%;height:100%;object-fit:cover;object-position:top;pointer-events:none}
.item.logo-img img{object-fit:contain;background:#fff;padding:3px}
.picked{flex:none;display:flex;align-items:center;gap:12px;min-height:72px;padding:8px;border-radius:var(--r-md);background:var(--surface);border:1px solid var(--line)}
.picked img{width:56px;height:56px;border-radius:10px;object-fit:cover;object-position:top}
.picked strong{flex:1;min-width:0;font-size:15px;font-weight:800;line-height:1.2}
.picked small{display:block;font-size:12px;font-weight:600;color:var(--muted)}
#board.picking .picked{cursor:zoom-in}
#board.picking .picked::after{content:'⤢ Томруулах';flex:none;display:grid;place-items:center;height:34px;padding:0 14px;border-radius:999px;background:var(--gold);color:var(--gold-ink,#231a04);font-size:13px;font-weight:800;box-shadow:0 0 14px var(--gold-soft)}
.zoom-view{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:20px;background:#000e;animation:zoom-in .18s ease-out}
.zoom-view img{max-width:100%;max-height:76vh;border-radius:14px;object-fit:contain}
.zoom-view strong{color:#fff;font-size:18px;font-weight:800;text-align:center}
@keyframes zoom-in{from{opacity:0;transform:scale(.94)}}
/* Phones: one sideways strip, so a sideways swipe scrolls and an upward drag picks an entry up. */
.pool{flex:none;height:84px;overflow-x:auto;overflow-y:hidden;display:flex;flex-wrap:nowrap;align-items:center;gap:6px;padding:8px;border-radius:var(--r-md);background:var(--surface);border:1px dashed var(--line)}
.pool.target{border-color:var(--gold)}
.actions{flex:none;display:grid;grid-template-columns:1fr 1.6fr;gap:8px}
.primary,.ghost{min-height:50px;border-radius:var(--r-md);font-weight:800;font-size:15px}
.primary{background:linear-gradient(45deg,#f9ce34,#ee2a7b,#6228d7);color:#fff}
.ghost{background:var(--surface);border:1px solid var(--line)}
/* Carried above the finger so the drop spot stays visible. */
/* The lifted player: a little bigger, with a deep shadow, just above the fingertip. */
.ghost-drag{position:fixed;z-index:10;width:58px;height:58px;border-radius:10px;object-fit:cover;object-position:top;pointer-events:none;box-shadow:0 16px 32px #000c,0 0 0 2px #fff3;transform:translate(-50%,-80%);animation:lift .14s ease-out}
@keyframes lift{from{transform:translate(-50%,-50%) scale(.8)}}
/* Fallback when the host cannot share: the story picture full screen, savable with a long press. */
.share-view{position:fixed;inset:0;z-index:50;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:20px;background:#000e}
.share-view img{max-width:100%;max-height:76vh;border-radius:14px;-webkit-touch-callout:default;-webkit-user-select:auto;user-select:auto}
.share-view p{margin:0;color:#ddd;font-size:13px}
.share-view button{height:44px;padding:0 26px;border-radius:999px;background:#fff;color:#000;font-weight:800}
.item.active{outline:3px solid var(--gold);outline-offset:-3px}
/* A picked entry: the rows (and the pool, for a ranked entry) glow softly as places to tap. */
#board.picking .tier,#board.picking-pool .pool{cursor:pointer;animation:glow 1.1s ease-in-out infinite alternate}
#board.picking .tier>b{filter:brightness(1.12)}
@keyframes glow{from{box-shadow:inset 0 0 0 1px #f6c45322}to{box-shadow:inset 0 0 0 2px #f6c453aa;background:var(--surface-2)}}
/* Dragging: the player's own tile is the empty gap that travels to where it will land. */
.item.placeholder{background:none;outline:none}
.item.placeholder img{opacity:0}
.item.landed{animation:land .32s cubic-bezier(.2,.9,.3,1.4)}
@keyframes land{from{transform:scale(.6);opacity:.4}to{transform:none;opacity:1}}
.share-loading{position:fixed;inset:0;z-index:49;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;background:#000c}
.share-loading i{width:42px;height:42px;border-radius:50%;border:4px solid #fff3;border-top-color:#ee2a7b;animation:spin .8s linear infinite}
.share-loading p{margin:0;color:#fff;font-weight:800;font-size:15px}
@keyframes spin{to{transform:rotate(360deg)}}

/* Friends: their name on the card, and their list read-only. */
.theme small.who{display:flex;align-items:center;gap:6px}
.who img{width:18px;height:18px;border-radius:50%;object-fit:cover}
.who span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ava{width:34px;height:34px;flex:none;border-radius:50%;object-fit:cover}
.who-title{flex:1;min-width:0;display:flex;flex-direction:column}
.who-title strong{font-family:var(--font-display);font-size:16px;font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.who-title small{font-size:12px;font-weight:600;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.item.static{cursor:pointer;touch-action:manipulation}
.actions.single{grid-template-columns:1fr}
.actions.three{grid-template-columns:1fr 1fr 1.4fr}
/* Save: gold until the list is saved. */
.save{min-height:50px;border-radius:var(--r-md);background:var(--gold);color:var(--gold-ink);font-weight:800;font-size:15px}
.save.done{background:var(--surface);border:1px solid var(--line);color:var(--muted)}
/* Result page: the saved list, pictures as large as fit (--s, set by the app). */
.done-tiers .tier{flex:1 0 auto;min-height:calc(var(--s,46px) + 6px)}
.done-tiers .item{width:var(--s,46px);height:var(--s,46px);cursor:default;touch-action:auto}
.done-tiers .tier>b{width:52px;font-size:18px}
#done{animation:show .22s cubic-bezier(.2,.8,.2,1)}
@keyframes show{from{opacity:0;transform:translateY(12px)}}

/* Packs: the "create" card and the editor. */
.new-pack{border-style:dashed}
.new-pack .art{display:grid;place-items:center}
.new-pack .art span{font-size:44px;font-weight:300;line-height:1;color:var(--gold)}
#editor{display:flex;flex-direction:column;gap:10px}
#ed-count{font-size:12px;font-weight:700;color:var(--muted)}
.field{width:100%;min-width:0;height:44px;padding:0 12px;border-radius:var(--r-sm);background:var(--surface);border:1px solid var(--line);outline:none;font-size:15px}
.field:focus{border-color:var(--gold)}
.field::placeholder{color:var(--faint)}
.field.big{height:50px;font-size:16px;font-weight:700}
.seg{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;border-radius:var(--r-md);background:var(--surface);border:1px solid var(--line)}
.seg button{height:40px;border-radius:var(--r-sm);color:var(--muted);font-size:14px;font-weight:700}
.seg button.on{background:var(--text);color:var(--bg)}
.ed-items{display:flex;flex-direction:column;gap:8px}
.ed-row{display:flex;align-items:center;gap:8px}
.ed-pic{flex:none;width:48px;height:60px;display:grid;place-items:center;overflow:hidden;border-radius:10px;background:var(--surface-2);border:1px dashed var(--line);color:var(--muted);font-size:22px;cursor:pointer}
.ed-pic img{width:100%;height:100%;object-fit:cover}
.ed-x{flex:none;width:36px;height:36px;border-radius:50%;color:var(--muted);font-size:22px}
.ed-add{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.ed-add .ghost{display:grid;place-items:center;cursor:pointer}
.ed-foot{position:sticky;bottom:0;display:grid;grid-template-columns:1fr 1.6fr;gap:8px;padding:8px 0 calc(8px + env(safe-area-inset-bottom));background:var(--bg)}
.ed-foot .ghost[hidden]+.primary{grid-column:1/-1}
.danger{color:#ff6b6b}

@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* Desktop and tablets in landscape: wider catalog; tiers on the left, pick + pool + actions on the right. */
@media (min-width:900px){
 .app{max-width:1200px;padding:28px 32px}
 .logo{font-size:40px;margin:0 0 20px}
 .search{max-width:520px}
 .groups{margin:14px 0 0;padding:0;flex-wrap:wrap}
 .themes{grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px;margin-top:18px}
 .art{height:150px}
 .theme{transition:transform .15s,border-color .15s}
 .theme:hover{transform:translateY(-3px);border-color:var(--gold)}
 #board{flex:none;height:calc(100dvh - 56px);display:grid;grid-template-columns:minmax(0,1fr) 360px;grid-template-rows:auto auto minmax(0,1fr) auto;grid-template-areas:"bar bar" "tiers picked" "tiers pool" "tiers actions";gap:14px}
 .bar{grid-area:bar}
 .bar strong{font-size:22px}
 .tiers{grid-area:tiers;padding:4px;gap:4px}
 .tier{min-height:calc(var(--s,72px) + 8px)}
 .tier>b{width:84px;font-size:26px}
 .slot{gap:4px;padding:4px}
 .item{width:72px;height:72px;border-radius:8px}
 .tiers .item{width:var(--s,72px);height:var(--s,72px)}
 .item:hover{outline:2px solid #fff6;outline-offset:-2px}
 .picked{grid-area:picked}
 .pool{grid-area:pool;height:auto;max-height:none;flex-wrap:wrap;align-items:flex-start;align-content:flex-start;overflow-x:hidden;overflow-y:auto}
 .pool .item{width:64px;height:64px}
 .actions{grid-area:actions}
 #editor{width:100%;max-width:640px;margin:0 auto}
 #friend,#done{flex:none;width:100%;max-width:900px;margin:0 auto;height:calc(100dvh - 56px)}
 .done-tiers .tier>b{width:84px;font-size:26px}
 .who-title strong{font-size:22px}
}
