/* flairsnapmag: nagłówek profilu, siatka kafelków 4:5 (3 kolumny na telefonie, 5 od 768 px), posty w oknie podglądu. */
:root{
  --bg:#fbfbfa; --surface:#ffffff; --ink:#16181a; --muted:#6b7075; --line:#e2e3e1;
  --accent:#d9482b; --accent-ink:#ffffff; --stage:#0e0f10;
  --display:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --body:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color-scheme:light;
}
@media (prefers-color-scheme:dark){
  :root{
    --bg:#0f1011; --surface:#191b1d; --ink:#f1f1ef; --muted:#9a9ea3; --line:#2b2e31;
    --accent:#ff6b4a; --accent-ink:#1c0d07; --stage:#000000;
    color-scheme:dark;
  }
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg);color:var(--ink);font-family:var(--body);font-size:16px;line-height:1.45;-webkit-font-smoothing:antialiased}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
[hidden]{display:none !important}

.ownerbar{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;justify-content:space-between;padding:8px 16px;border-bottom:1px solid var(--line);font-size:13px;color:var(--muted);background:var(--surface)}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--bg)}
.seg button{border:0;background:transparent;padding:6px 12px;font-size:13px;color:var(--muted)}
.seg button[aria-pressed="true"]{background:var(--ink);color:var(--bg)}

.wrap{max-width:1100px;margin:0 auto;padding:0 0 48px}
.profile{display:grid;grid-template-columns:auto 1fr;gap:16px 20px;align-items:center;padding:24px 16px 20px}
.avatar{width:84px;height:84px;border-radius:50%;overflow:hidden;background:#fff;border:1px solid var(--line)}
.avatar img,.mini img{width:100%;height:100%;object-fit:cover;display:block}
.who{display:flex;flex-direction:column;gap:8px;min-width:0}
.who h1{font-family:var(--display);font-weight:700;font-size:22px;letter-spacing:-.01em;margin:0;line-height:1.1;overflow-wrap:anywhere}
.fullname{font-size:16px}
.stats{font-size:16px}
.stats b{font-weight:700}
.bio{grid-column:1 / -1;max-width:60ch;overflow-wrap:anywhere}
.bio:empty{display:none}
.bio a,.bio .link{color:var(--accent);font-weight:500;text-decoration:none}
.bio a:hover{text-decoration:underline}
.actions{grid-column:1 / -1;display:flex;flex-wrap:wrap;gap:8px}
.btn{border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:8px 14px;font-weight:600;font-size:14px}
.btn:hover{border-color:var(--muted)}
.btn:disabled{opacity:.55;cursor:default}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn.danger{color:var(--accent)}
.btn.plain{border-color:transparent;background:transparent}
.btn.small{padding:5px 10px;font-size:13px}
.btn.flush{padding-left:0}
.row{display:flex;gap:8px;margin-top:8px}
.row.wrapline{flex-wrap:wrap;gap:8px 12px;align-items:center;margin:0 0 10px}
.gapabove{margin-top:14px}
@media (min-width:768px){
  .profile{grid-template-columns:auto 1fr auto;gap:10px 40px;padding:44px 24px 36px}
  .avatar{width:150px;height:150px;grid-row:1 / span 2}
  .who h1{font-size:28px}
  .actions{grid-column:3;grid-row:1;align-self:start;justify-content:flex-end}
  .bio{grid-column:2 / -1;grid-row:2;align-self:start}
}

.arrangebar{position:sticky;top:0;z-index:5;display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;justify-content:space-between;padding:10px 16px;background:var(--surface);border-block:1px solid var(--line);font-size:14px}
.arrangebar .group{display:flex;gap:8px;align-items:center;flex-wrap:wrap}

.gridframe{border-top:1px solid var(--line);padding-top:4px}
.gridframe[data-cols="3"]{max-width:430px;margin:16px auto 0;border:1px solid var(--line);border-radius:18px;padding:4px;overflow:hidden}
.grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(3,1fr);gap:3px}
@media (min-width:768px){.grid{grid-template-columns:repeat(5,1fr);gap:4px}}
.gridframe[data-cols="3"] .grid{grid-template-columns:repeat(3,1fr);gap:3px}
.gridframe[data-cols="5"] .grid{grid-template-columns:repeat(5,1fr)}
.grid li{position:relative;aspect-ratio:4 / 5;background:var(--line)}
.tile{display:block;width:100%;height:100%}
.tile img{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none;-webkit-user-drag:none;-webkit-touch-callout:none;user-select:none}
.tile:hover img{filter:brightness(.86)}
.arranging .tile{cursor:grab;-webkit-touch-callout:none;user-select:none}
.arranging .tile:hover img{filter:none}
.grid li.lifted{outline:2px dashed var(--accent);outline-offset:-2px}
.grid li.lifted img{opacity:.25}
.ghost{position:fixed;z-index:50;pointer-events:none;box-shadow:0 14px 34px rgba(0,0,0,.4);transform:scale(1.06);border-radius:4px;overflow:hidden}
.ghost img{width:100%;height:100%;object-fit:cover;display:block}
.empty{padding:56px 16px;text-align:center;color:var(--muted)}
.foot{padding:20px 16px 32px;text-align:center;font-size:13px;color:var(--muted)}

dialog{border:0;padding:0;color:var(--ink);background:var(--surface);border-radius:14px;max-width:calc(100vw - 24px)}
dialog::backdrop{background:rgba(0,0,0,.72)}
.sheet{width:460px;max-width:100%;display:flex;flex-direction:column}
.sheet header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-bottom:1px solid var(--line)}
.sheet h2{font-family:var(--display);font-weight:700;font-size:18px;margin:0}
.sheet .body{padding:16px;display:flex;flex-direction:column;gap:14px}
.sheet footer{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid var(--line)}
.drop{border:2px dashed var(--line);border-radius:12px;padding:36px 16px;text-align:center;display:flex;flex-direction:column;gap:12px;align-items:center;color:var(--muted)}
.drop.over{border-color:var(--accent);color:var(--ink)}
.drop strong{color:var(--ink);font-size:17px}
.preview{background:var(--stage);border-radius:10px;overflow:hidden;display:grid;place-items:center}
.cropframe{overflow:hidden;touch-action:none;cursor:grab;max-width:100%}
.cropframe img{width:100%;height:100%;object-fit:cover;display:block;user-select:none;-webkit-user-drag:none}
.cropframe.free{cursor:default;touch-action:auto}
.cropframe.free img{width:auto;height:auto;max-width:100%;max-height:44vh;object-fit:contain}
label{display:flex;flex-direction:column;gap:6px;font-size:14px;font-weight:600}
input[type=text],input[type=password],textarea{border:1px solid var(--line);background:var(--bg);border-radius:8px;padding:10px 12px;font-weight:400;width:100%}
textarea{resize:vertical;min-height:84px}
.hint{font-size:13px;color:var(--muted);font-weight:400}
.error{color:var(--accent);font-size:14px;margin:0}

#viewer{background:transparent;max-width:100vw;max-height:100dvh;width:100vw;height:100dvh;border-radius:0;overflow:hidden}
.stagewrap{width:100%;height:100%;display:grid;place-items:center;padding:12px}
.post{background:var(--surface);border-radius:10px;overflow:hidden;display:flex;flex-direction:column;width:100%;max-width:520px;max-height:100%}
.post .photo{position:relative;background:var(--stage);display:grid;place-items:center;min-height:0;flex:1 1 auto}
.post .photo img{max-width:100%;max-height:68dvh;display:block;object-fit:contain;pointer-events:none;-webkit-user-drag:none;-webkit-touch-callout:none;user-select:none}
.post .photo .shield{position:absolute;inset:0}
.post .side{display:flex;flex-direction:column;min-height:0;flex:0 1 auto;max-height:32dvh}
.post .head{display:flex;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid var(--line)}
.post .head .mini{width:32px;height:32px;border-radius:50%;flex:none;overflow:hidden;background:#fff;border:1px solid var(--line)}
.post .head b{font-weight:600}
.post .text{padding:12px 14px;overflow:auto;display:flex;flex-direction:column;gap:10px}
.post .caption{margin:0;white-space:pre-line;overflow-wrap:anywhere}
.post .date{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}
.post .tools{display:flex;flex-wrap:wrap;gap:8px;padding:10px 14px;border-top:1px solid var(--line)}
.post .tools .ask{align-self:center}
@media (min-width:900px){
  .post{flex-direction:row;max-width:1100px;width:auto;height:min(86dvh,820px)}
  .post .photo{flex:1 1 auto;min-width:420px}
  .post .photo img{max-height:min(86dvh,820px)}
  .post .side{width:340px;flex:none;max-height:none}
  .post .text{flex:1}
}
.nav,.close{position:fixed;z-index:2;border:0;border-radius:50%;width:40px;height:40px;background:rgba(255,255,255,.92);color:#111;font-size:24px;line-height:1;display:grid;place-items:center}
.nav.prev{left:10px;top:50%;translate:0 -50%}
.nav.next{right:10px;top:50%;translate:0 -50%}
.close{right:10px;top:10px;background:transparent;color:#fff;font-size:32px}
@media (max-width:899px){.nav{top:38%}}

.toast{position:fixed;left:50%;bottom:24px;translate:-50% 0;z-index:100;max-width:calc(100vw - 32px);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:10px;font-size:14px;box-shadow:0 8px 24px rgba(0,0,0,.3)}

.loginpage{display:grid;place-items:center;min-height:100dvh;padding:24px 16px}
.login{width:100%;max-width:380px;display:flex;flex-direction:column;gap:14px}
.login img{width:96px;height:96px;border-radius:50%;border:1px solid var(--line);background:#fff}
.login h1{font-family:var(--display);font-weight:700;font-size:24px;margin:0;line-height:1.15}
.login p{margin:0;color:var(--muted)}
.login form{display:flex;flex-direction:column;gap:14px}
.login code{font-size:.92em}
