/* CoreOpinion forum. Standalone styles, separate from style.css. */
:root {
  --bg: #EEF2F6; --card: #FFFFFF; --line: #DCE2E8; --line-soft: #E6EBF0;
  --ink: #14171A; --ink-2: #33404C; --muted: #5B6672;
  --blue: #1D6FD8; --blue-dark: #1557AA; --blue-soft: #E8F0FC; --compose: #F2F7FD;
  --down: #C2410C; --down-soft: #FDEDE4; --danger: #B42318;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; }
a { color: var(--blue); text-decoration: none; } a:hover { color: var(--blue-dark); text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 0 16px; min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 14px 10px; font-weight: 500; color: #4A5560; border-bottom: 3px solid transparent; }
.top nav a.on { color: var(--blue); font-weight: 600; border-bottom-color: var(--blue); }
.logo { flex: 1 1 120px; text-align: center; font-weight: 700; font-size: 19px; letter-spacing: -.3px; color: var(--ink); }
.logo span { color: var(--blue); }
.pill { height: 36px; padding: 0 16px; border: 0; border-radius: 18px; background: var(--blue); color: #FFF; font-weight: 600; font-size: 14px; }
.pill.ghost { background: var(--card); color: var(--blue); border: 1px solid var(--blue); }
.pill.plain { background: var(--card); color: var(--ink); border: 1px solid #CFD7DF; }
.pill.danger { background: var(--danger); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.side { flex: 1 1 260px; max-width: 290px; min-width: 240px; display: flex; flex-direction: column; gap: 12px; }
.main { flex: 999 1 520px; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.pad { padding: 14px; }
.card h2 { margin: 0 0 10px; font-size: 17px; }

.av { flex: 0 0 auto; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ink); text-transform: uppercase; }
.av-44 { width: 44px; height: 44px; } .av-40 { width: 40px; height: 40px; }
.prof-banner { height: 64px; background: var(--blue); border-radius: 6px 6px 0 0; }
.prof .av { width: 64px; height: 64px; border: 3px solid #FFF; margin-top: -32px; font-size: 24px; }
.prof-name { font-weight: 700; font-size: 17px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--bg); color: #4A5560; }
.badge.blue { background: var(--blue-soft); color: var(--blue-dark); font-size: 12px; padding: 3px 9px; margin-top: 8px; }

.compose { padding: 14px; background: var(--compose); border-bottom: 1px solid var(--line); display: flex; gap: 10px; border-radius: 6px 6px 0 0; }
.compose textarea, .reply-box textarea { width: 100%; border: 1px solid #BFD3EC; border-radius: 6px; padding: 10px; font-size: 15px; font-family: inherit; resize: vertical; min-height: 64px; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 8px; }
.count.over { color: var(--down); font-weight: 700; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; height: 44px; border: 0; background: var(--card); font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }

.post { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.post.reply { padding-left: 40px; background: #FAFBFC; }
.post-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 14px; }
.post-body { margin: 4px 0 8px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.acts { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }
.vote { display: flex; align-items: center; gap: 2px; }
.ib { width: 32px; height: 32px; border: 0; border-radius: 16px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.ib:hover { background: var(--bg); }
.ib.up.on { background: var(--blue-soft); color: var(--blue); }
.ib.down.on { background: var(--down-soft); color: var(--down); }
.score { min-width: 30px; text-align: center; font-weight: 700; color: var(--ink); }
.score.up { color: var(--blue); } .score.down { color: var(--down); }
.tb { border: 0; background: none; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; font-size: 13px; height: 32px; padding: 0 4px; }
.tb:hover { color: var(--blue); }
.right { margin-left: auto; }
.empty { padding: 32px 14px; text-align: center; color: var(--muted); }
.notice { padding: 10px 14px; font-size: 14px; border-bottom: 1px solid var(--line); }
.notice.err { background: var(--down-soft); color: #7C2D12; }
.notice.ok { background: var(--blue-soft); color: var(--blue-dark); }
.reply-box { padding: 10px 14px 12px 40px; border-bottom: 1px solid var(--line-soft); background: #FAFBFC; }
/* replies to replies step in further, up to 4 levels */
.post.reply.d2, .reply-box.d2 { padding-left: 64px; }
.post.reply.d3, .reply-box.d3 { padding-left: 88px; }
.post.reply.d4, .reply-box.d4 { padding-left: 112px; }
.post.reply.d2, .post.reply.d3, .post.reply.d4 { background: #F5F7FA; }
.ph-to { font-size: 12px; }

.dark-card { background: var(--ink); color: #FFF; border-radius: 6px; padding: 16px; }
.dark-card p { margin: 6px 0 12px; font-size: 13px; line-height: 1.45; color: #C9D1D9; }
.dark-card a { display: inline-block; padding: 9px 16px; border-radius: 18px; background: #FFF; color: var(--ink); font-weight: 600; font-size: 13px; }
.foot { font-size: 12px; color: var(--muted); line-height: 1.8; }

/* auth */
.auth { max-width: 380px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.auth h1 { margin: 0 0 4px; font-size: 20px; }
.auth label { font-size: 13px; font-weight: 600; }
.auth input, .field { height: 40px; border: 1px solid #CFD7DF; border-radius: 6px; padding: 0 12px; font-size: 15px; font-family: inherit; width: 100%; }
.or { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.links { display: flex; justify-content: space-between; font-size: 13px; }
.links button { border: 0; background: none; color: var(--blue); font-size: 13px; padding: 0; }

dialog { border: 1px solid var(--line); border-radius: 8px; padding: 20px; max-width: 360px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(20,23,26,.4); }
dialog h2 { margin: 0 0 12px; font-size: 17px; }
dialog select, dialog textarea { width: 100%; margin-bottom: 10px; font-family: inherit; font-size: 14px; padding: 8px; border: 1px solid #CFD7DF; border-radius: 6px; }

/* mod panel */
.top.dark { background: var(--ink); border-color: var(--ink); }
.top.dark .logo, .top.dark nav a { color: #C9D1D9; } .top.dark .logo span { color: #7FB2F0; }
.q-item { display: flex; flex-wrap: wrap; gap: 14px; padding: 14px; border-bottom: 1px solid var(--line-soft); }
.q-text { flex: 999 1 420px; min-width: 0; }
.q-acts { flex: 1 1 280px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; justify-content: flex-end; }
.q-acts .pill { height: 34px; font-size: 13px; padding: 0 14px; }
.tag-auto { background: var(--down-soft); color: #9A3412; }
.tag-held { background: #FEF3C7; color: #854D0E; }
.tag-rep { background: var(--blue-soft); color: var(--blue-dark); }

/* attachments, polls, images */
.attach { position: relative; margin-top: 8px; display: inline-block; }
.attach img { max-width: 100%; max-height: 240px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.attach-x { position: absolute; top: 6px; right: 6px; background: rgba(20,23,26,.75); color: #FFF; }
.attach-x:hover { background: var(--ink); }
.poll-edit { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 8px 0 0; background: var(--card); }
.poll-edit .field { margin-bottom: 6px; }
.poll-edit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-end .ib { color: var(--blue); }
.post-img { display: block; margin: 0 0 8px; max-width: 100%; max-height: 420px; border-radius: 10px; border: 1px solid var(--line); }
.poll { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; max-width: 440px; }
.poll-opt { position: relative; height: 36px; border: 1px solid var(--blue); border-radius: 18px; background: var(--card); color: var(--blue); font-weight: 600; font-size: 14px; text-align: center; }
.poll-opt:hover { background: var(--blue-soft); }
.poll-bar { position: relative; height: 32px; border-radius: 6px; background: var(--bg); overflow: hidden; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; font-size: 14px; }
.poll-bar .fill { position: absolute; inset: 0 auto 0 0; background: #CFE0F7; }
.poll-bar.mine .fill { background: #A9C8F0; }
.poll-bar span { position: relative; }
.poll-bar .lab { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px; }
.post-body a { overflow-wrap: anywhere; }

img.av { object-fit: cover; background: var(--bg); }
.who { color: inherit; } .who:hover { text-decoration: none; } .who:hover strong { text-decoration: underline; }
.prof-links { display: flex; gap: 14px; margin-top: 10px; font-size: 13px; }
.user-head { padding: 0 14px 14px; border-bottom: 1px solid var(--line); }
.user-head .av { width: 88px; height: 88px; border: 4px solid #FFF; margin-top: -44px; font-size: 32px; border-radius: 10px; }
.user-head .bio { margin: 8px 0 0; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.user-stats { display: flex; gap: 18px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.user-stats b { color: var(--ink); }
.set-row { display: flex; flex-direction: column; gap: 6px; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.set-row:last-child { border-bottom: 0; }
.set-row h2 { margin: 0; font-size: 15px; }
.set-av { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.set-av .av { width: 72px; height: 72px; font-size: 28px; }
.danger-zone { border: 1px solid #F3C7BE; border-radius: 8px; padding: 14px; }

/* pull to refresh */
.ptr { height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; color: var(--muted); font-size: 13px; transition: height .2s ease; }
.ptr.dragging { transition: none; }
.ptr span { padding-bottom: 10px; }
.ptr.loading span::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
.mobile-foot { display: none; }

.tabbar, .sheet-head, .m-me { display: none; }
.heart-burst { position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; pointer-events: none; color: #1D6FD8; animation: burst .7s ease-out forwards; z-index: 2; }
@keyframes burst { 0% { transform: scale(.3); opacity: 0; } 25% { transform: scale(1.1); opacity: .95; } 60% { transform: scale(1); opacity: .95; } 100% { transform: scale(1.15); opacity: 0; } }
.post { position: relative; touch-action: manipulation; }

/* phones: app-style feed (Instagram-like) */
@media (max-width: 760px) {
  html, body { overscroll-behavior-y: contain; background: var(--card); }
  body { font-size: 15px; -webkit-text-size-adjust: 100%; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .top { border-bottom: 1px solid var(--line-soft); }
  .top-in { padding: 0 14px; gap: 8px; min-height: 50px; flex-wrap: nowrap; }
  .top nav { display: none; }
  .logo { flex: 1; text-align: left; font-size: 20px; letter-spacing: -.4px; }
  .top .pill { height: 32px; padding: 0 14px; font-size: 13px; }
  #btn-signout { display: none !important; }
  .m-me { display: inline-flex; } .m-me[hidden] { display: none; }
  .m-me .av { width: 32px; height: 32px; border-radius: 50%; font-size: 14px; }

  .wrap { padding: 0; gap: 0; display: block; }
  .side { display: none; }
  .main { border: 0; border-radius: 0; background: var(--card); }
  #signin-cta { border-radius: 0; font-size: 14px; padding: 10px 14px; }

  /* feed tabs: slim segmented control under the header */
  .tabs { position: sticky; top: 50px; z-index: 4; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); }
  .tabs button { height: 42px; font-size: 14px; background: transparent; }

  /* posts: header row, then full-width content, then action bar */
  .post { display: grid; grid-template-columns: 38px 1fr; column-gap: 10px; padding: 14px 14px 6px; border-bottom: 8px solid var(--bg); }
  .post > div { display: contents; }
  .post > .who { grid-row: 1; align-self: center; display: flex; line-height: 0; }
  .post .av-44 { width: 38px; height: 38px; border-radius: 50%; font-size: 15px; line-height: 38px; }
  /* Two-line header next to the avatar, Instagram-style:
     line 1 = name, line 2 = @handle · time + compass badge, Follow on the right. */
  .post-head { grid-column: 2; grid-row: 1; align-self: center; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 6px; row-gap: 1px; align-items: center; min-width: 0; line-height: 1.25; }
  .ph-name { grid-column: 1 / 3; grid-row: 1; justify-self: start; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
  .ph-badge { grid-column: 2; grid-row: 2; justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ph-meta { grid-column: 1; grid-row: 2; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ph-follow { grid-column: 3; grid-row: 1 / 3; align-self: center; height: 32px !important; padding: 0 12px !important; border: 1px solid var(--line) !important; border-radius: 16px; color: var(--ink) !important; font-weight: 600; font-size: 13px !important; }
  .post-body { grid-column: 1 / -1; margin: 10px 0 8px; font-size: 16px; line-height: 1.45; }
  .post-media { grid-column: 1 / -1; margin: 4px -14px 6px; display: block; }
  .post-img { width: 100%; max-height: 70vh; object-fit: cover; border-radius: 0; border: 0; margin: 0; }
  .poll { grid-column: 1 / -1; margin: 4px 0 8px; max-width: none; }
  .poll-opt { height: 44px; font-size: 15px; }
  .poll-bar { height: 40px; border-radius: 10px; }
  .acts { grid-column: 1 / -1; gap: 2px; margin: 0 -8px; }
  .ib { width: 44px; height: 44px; border-radius: 22px; }
  .ib svg { width: 22px; height: 22px; }
  .score { min-width: 26px; font-size: 15px; }
  .tb { height: 44px; padding: 0 10px; font-size: 14px; }
  .tb svg { width: 21px; height: 21px; }
  .post.reply { border-bottom: 1px solid var(--line-soft); padding-left: 28px; background: #FAFBFC; }
  .reply-box { padding: 10px 14px 14px 28px; }
  .post.reply.d2, .reply-box.d2 { padding-left: 42px; }
  .post.reply.d3, .reply-box.d3 { padding-left: 56px; }
  .post.reply.d4, .reply-box.d4 { padding-left: 70px; }
  .ph-to { grid-column: 1 / -1; grid-row: 3; font-size: 12px; }
  .reply-box textarea, .compose textarea, .field, .auth input { font-size: 16px; }

  /* composer becomes a full-screen sheet opened from the + button */
  .compose { display: none; }
  body.sheet-open { overflow: hidden; }
  body.sheet-open .compose:not([hidden]) { display: flex; flex-wrap: wrap; position: fixed; inset: 0; z-index: 30; background: var(--card); padding: 0 14px 14px; align-content: flex-start; border: 0; }
  .sheet-head { display: flex; width: 100%; align-items: center; justify-content: space-between; height: 50px; border-bottom: 1px solid var(--line-soft); margin: 0 -14px 12px; padding: 0 6px; box-sizing: content-box; }
  body.sheet-open .compose textarea { min-height: 160px; border: 0; padding: 8px 0; resize: none; outline: none; box-shadow: none; font-size: 18px; }
  body.sheet-open .compose .av { border-radius: 50%; }
  .sheet-head { margin: 0 -14px 12px !important; width: calc(100% + 28px) !important; padding: 0 8px !important; box-sizing: border-box !important; }

  /* bottom tab bar */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line-soft); padding-bottom: env(safe-area-inset-bottom); justify-content: space-around; }
  .tabbar > * { flex: 1; height: 56px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--ink); }
  .tabbar > [hidden] { display: none; }
  .tabbar .tb-post svg { background: var(--blue); color: #FFF; border-radius: 12px; padding: 6px; width: 36px; height: 36px; box-sizing: border-box; }

  .mobile-foot { display: block; padding: 18px 14px 24px; font-size: 12px; line-height: 1.9; color: var(--muted); text-align: center; }
  .notice { border-radius: 0 !important; }
  .user-head .av { width: 80px; height: 80px; margin-top: -40px; border-radius: 50%; }
  .prof-banner { height: 72px; }
  .auth.card { margin: 16px 12px !important; }
  dialog { padding: 16px; }
  .q-acts { justify-content: flex-start; }
  main[style*="max-width:640px"] { padding: 0 !important; }
  .card.pad { border-radius: 0; border-left: 0; border-right: 0; }
}

/* notifications */
.bell { position: relative; width: 40px; height: 40px; border: 0; border-radius: 20px; background: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; margin-left: auto; }
.bell:hover { background: var(--bg); }
.bell[hidden] { display: none; }
.bell + .m-me, .bell + #btn-signout { margin-left: 0; }
.bell-dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 9px; background: #E0245E; color: #FFF; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell-dot[hidden] { display: none; }
dialog.notif-dlg { max-width: 460px; padding: 0; max-height: min(640px, 85vh); overflow: auto; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--card); }
.notif-head h2 { margin: 0; }
.notif { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; align-items: flex-start; }
.notif:hover { background: var(--bg); }
.notif.unread { background: var(--blue-soft); }
.notif-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.4; }
.notif-snip { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { display: block; font-size: 12px; }
.post-back { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; font-weight: 600; }
.post.hl { box-shadow: inset 3px 0 0 var(--blue); }
@media (max-width: 760px) {
  dialog.notif-dlg { max-width: none; width: 100%; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .notif-head { padding-top: calc(10px + env(safe-area-inset-top)); }
}
