/* Posts: home tabs, feed, a post, the form and the floating "+" button. Built only from the themes'
   tokens (theme-base.css and themes/*.css), so the seven designs dress them without extra rules.
   --accent can be a gradient (Windows XP, Steampunk): it goes only in `background`; borders, outlines
   and color-mix() use the solid --accent-edge, which every style defines. */

/* ---------- home: rankings on the left, main column; the same in every style ---------- */
.home-layout { width: min(1500px, calc(100% - 32px)); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); }
.home-main { min-width: 0; }
.home-main > .home-tabs, .home-main > .chooser-card, .home-main > .daily-strip { width: 100%; max-width: 1240px; margin-left: auto; margin-right: auto; box-sizing: border-box; }
.home-main > .posts-home { width: min(860px, 100%); }
.home-rank { margin-top: 14px; min-width: 0; }
.rank-games { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.rank-game-tab { flex: 1 1 auto; min-height: 40px; padding: 4px 10px; font-size: 13px; }
@media (min-width: 1100px) {
  .home-layout { grid-template-columns: 300px minmax(0, 1fr); column-gap: 24px; align-items: start; }
  .home-rank { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; overscroll-behavior: contain; }
}
@media (max-width: 640px) { .home-layout { width: calc(100% - 24px); } }

/* ---------- home: tabs and sections ---------- */
.home-tabs { width: min(1240px, calc(100% - 32px)); margin: 14px auto 0; display: flex; flex-wrap: wrap; gap: 8px; }
.home-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 16px; border: 1px solid var(--line-on-bg); border-radius: var(--radius-sm); color: var(--on-bg); font-weight: 800; text-decoration: none; background: color-mix(in srgb, var(--on-bg) 6%, transparent); }
.home-tabs a:hover { background: color-mix(in srgb, var(--on-bg) 14%, transparent); }
.home-tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }
.home-tabs a:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.posts-home { width: min(860px, calc(100% - 32px)); margin: 14px auto 0; display: grid; gap: 12px; scroll-margin-top: 12px; }
.posts-home > h2, .posts-head h2 { margin: 0; color: var(--on-bg); font-family: var(--display); font-size: clamp(22px, 7vw, 38px); line-height: 1.05; overflow-wrap: anywhere; }
.posts-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; }
/* Wide display faces (Casino, Arcade) must not push the page sideways on a 320 px phone. */
.posts-head > * { min-width: 0; max-width: 100%; }
.posts-lede, .weekly-dates { margin: 0; color: var(--on-bg-muted, var(--on-bg)); font-size: 15px; line-height: 1.45; }
.weekly-about p { margin: 0; color: var(--on-bg); line-height: 1.5; }
.weekly-dates { font-weight: 700; color: var(--on-bg); }
.weekly-me { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.posts-sort { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.posts-sort-option { min-height: 40px; padding: 4px 12px; border: 1px solid var(--line-on-bg); border-radius: var(--radius-sm); background: transparent; color: var(--on-bg); font-weight: 700; cursor: pointer; }
.posts-sort-option[aria-pressed="true"] { background: var(--on-bg); color: var(--bg, var(--surface)); }
.posts-sort-option:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.post-list { display: grid; gap: 12px; }
.post-state { margin: 0; color: var(--on-bg); font-weight: 700; }
.post-state:empty { display: none; }
.post-more { justify-self: center; min-width: 200px; }
.weekly-archive { display: grid; gap: 12px; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line-on-bg); }
.weekly-archive h3 { margin: 0; color: var(--on-bg); font-size: 22px; }
.weekly-edition { display: grid; gap: 8px; }
.weekly-edition h4 { margin: 0; color: var(--on-bg); font-size: 16px; }
.chooser-card-compact { padding: 12px clamp(14px, 2.4vw, 22px); }
.chooser-card-compact h2 { font-size: clamp(24px, 3.4vw, 34px); }
.chooser-card-compact p { font-size: 16px; }

/* ---------- a post ---------- */
.post { position: relative; display: grid; gap: 8px; padding: 14px 16px; background: var(--surface); color: var(--on-surface); border: var(--panel-border); border-radius: var(--radius-card); box-shadow: var(--panel-frame), var(--shadow); min-width: 0; }
.post.is-winner { outline: 3px solid var(--accent-edge); outline-offset: -3px; }
.post-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.post-author { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; color: inherit; text-decoration: none; min-width: 0; }
.post-author strong { overflow-wrap: anywhere; }
.post-author:hover strong { text-decoration: underline; }
.post-author:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.post-meta { margin: 0; color: var(--on-surface-muted); font-size: 13px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.post-tag { padding: 2px 8px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent-edge) 16%, transparent); color: var(--on-surface); font-size: 12px; font-weight: 800; }
.post-tag-win { background: var(--accent); color: var(--on-accent); }
.post-tag-warn { background: color-mix(in srgb, var(--on-surface) 14%, transparent); }
.post-link { color: inherit; text-decoration: none; }
.post-link:hover { text-decoration: underline; }
.post-link:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.post-title { margin: 0; color: var(--on-surface); font-size: clamp(19px, 2.4vw, 23px); line-height: 1.2; overflow-wrap: anywhere; }
.post-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; font-size: 16px; }
.post-media { display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.post-media.n1 { grid-template-columns: minmax(0, 1fr); }
.post-media.n3 > :first-child { grid-row: span 2; }
.media-thumb, .media-video { position: relative; display: block; width: 100%; min-height: 44px; padding: 0; overflow: hidden; border: 1px solid var(--surface-line); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--on-surface) 8%, transparent); cursor: zoom-in; }
.media-thumb img, .media-video img { display: block; width: 100%; height: 100%; max-height: 520px; object-fit: cover; }
.post-media.n1 .media-thumb img { object-fit: contain; max-height: 70vh; }
.media-video { cursor: pointer; aspect-ratio: 16 / 9; }
.media-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 999px; background: var(--dark); color: var(--on-dark); font-weight: 800; white-space: nowrap; }
.media-thumb:focus-visible, .media-video:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.post-media video { width: 100%; max-height: 70vh; border-radius: var(--radius-sm); background: #000; }
.post-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.post-votes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vote { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 64px; padding: 4px 12px; border: 1px solid var(--surface-line); border-radius: 999px; background: transparent; color: var(--on-surface); font-weight: 800; cursor: pointer; }
.vote[aria-pressed="true"] { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }
.vote:disabled { cursor: default; opacity: 0.75; }
.vote:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.vote-note, .post-status { color: var(--on-surface-muted); font-size: 13px; }
.post-status { margin: 0; }
.post-status:empty { display: none; }
.post-menu { position: relative; }
.post-menu-toggle { min-width: 44px; min-height: 44px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--on-surface); font-size: 22px; line-height: 1; cursor: pointer; }
.post-menu-toggle:hover, .post-menu-toggle[aria-expanded="true"] { border-color: var(--surface-line); }
.post-menu-list { position: absolute; right: 0; bottom: calc(100% + 4px); z-index: 20; display: grid; min-width: 210px; padding: 6px; background: var(--surface); border: var(--panel-border); border-radius: var(--radius-sm); box-shadow: var(--panel-frame), var(--shadow); }
.post-menu-item { min-height: 44px; padding: 6px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--on-surface); text-align: left; font-weight: 700; cursor: pointer; }
.post-menu-item:hover, .post-menu-item:focus-visible { background: color-mix(in srgb, var(--on-surface) 10%, transparent); outline: none; }
.post-panel:empty { display: none; }
.post-confirm, .post-report { display: grid; gap: 8px; padding: 10px; border: 1px dashed var(--surface-line); border-radius: var(--radius-sm); }
.post-confirm p { margin: 0; }
.media-viewer { max-width: min(96vw, 1400px); max-height: 96dvh; padding: 10px; border: 0; border-radius: var(--radius-card); background: var(--surface); color: var(--on-surface); display: none; }
.media-viewer[open] { display: grid; gap: 8px; justify-items: center; }
.media-viewer::backdrop { background: rgba(0, 0, 0, 0.82); }
.media-viewer img { max-width: 100%; max-height: calc(96dvh - 110px); object-fit: contain; }
.media-viewer-alt { margin: 0; max-width: 70ch; }

/* ---------- the floating "+" ---------- */
.post-fab {
  position: fixed; z-index: 800; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  display: grid; place-items: center; width: 60px; height: 60px; padding: 0; border: var(--btn-border, 0); border-radius: 50%;
  background: var(--accent); color: var(--on-accent); box-shadow: var(--btn-shadow, 0 6px 18px rgba(0, 0, 0, 0.35)), 0 8px 24px rgba(0, 0, 0, 0.3); cursor: pointer;
}
/* style.css paints every plain button with `button:not(.btn):not(…)…` (specificity 0,6,1), which beats
   any rule of this file: the two background changes below need !important to apply at all.
   Windows XP's green gradient is too light at the top for a white "+" (2.3:1): the same green, darker. */
:root[data-theme="xp"] .post-fab { background: linear-gradient(180deg, #3c9c33 0, #2b8a24 50%, #1f6b19 100%) !important; }
.post-fab .fab-plus { font: 800 34px/1 var(--text); margin-top: -2px; }
.post-fab:hover { background: var(--accent-hover, var(--accent)) !important; }
:root[data-theme="xp"] .post-fab:hover { background: linear-gradient(180deg, #46ad3c 0, #2f9628 50%, #1f6b19 100%) !important; }
.post-fab:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 3px; }
body.has-post-fab { padding-bottom: 88px; } /* The end of the page is never under the button. */
/* Out of the way: during a game, while the form is open, and while a notice sits at the bottom. */
html[data-playing] .post-fab, body.classic-focus .post-fab, html[data-composing] .post-fab, body:has(.day-toast) .post-fab { display: none; }

/* ---------- the form ---------- */
.composer { width: min(680px, calc(100% - 16px)); max-height: calc(100dvh - 16px); padding: 0; border: var(--panel-border); border-radius: var(--radius-card); background: var(--surface); color: var(--on-surface); box-shadow: var(--panel-frame), 0 30px 80px rgba(0, 0, 0, 0.5); --focus: var(--focus-surface, var(--focus)); }
.composer::backdrop { background: var(--backdrop, rgba(0, 0, 0, 0.6)); }
.composer-form { display: grid; grid-template-rows: auto auto 1fr auto; max-height: calc(100dvh - 18px); }
.composer-head { position: relative; padding: 16px 60px 4px 20px; }
.composer-head h2 { margin: 0; font-size: clamp(24px, 4.6vw, 32px); color: var(--on-surface); }
.composer-close { position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--on-surface); font-size: 28px; cursor: pointer; }
.composer-main { display: grid; gap: 12px; padding: 8px 20px 12px; overflow: auto; overscroll-behavior: contain; }
.composer-dest { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.composer-dest legend { padding: 0; margin-bottom: 4px; font-weight: 800; }
.composer-option { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 8px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--surface-line); border-radius: var(--radius-sm); cursor: pointer; }
.composer-option input { width: 20px; height: 20px; margin: 0; }
.composer-option span { font-weight: 700; }
.composer-option small { grid-column: 2; color: var(--on-surface-muted); }
.composer-option:has(input:disabled) { opacity: 0.7; cursor: not-allowed; }
.composer-field { display: grid; gap: 4px; }
.composer-label { font-weight: 800; }
.composer-field input, .composer-field textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; }
.composer-field textarea { min-height: 180px; resize: vertical; line-height: 1.5; }
.composer-under { display: flex; justify-content: flex-end; }
.composer-counter { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--on-surface-muted); }
.composer-meter { display: inline-block; width: 72px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--on-surface) 14%, transparent); overflow: hidden; }
.composer-meter span { display: block; height: 100%; background: var(--on-surface-muted); }
.composer-counter[data-level="near"] { color: var(--on-surface); }
.composer-counter[data-level="near"] .composer-meter span { background: var(--accent); }
.composer-counter[data-level="over"] { color: var(--danger, #b00020); }
.composer-counter[data-level="over"] .composer-meter span { background: var(--danger, #b00020); }
.composer-hint { color: var(--on-surface-muted); font-size: 13px; }
.composer-error { margin: 0; color: var(--danger, #b00020); font-weight: 700; }
.composer-error:empty { display: none; }
.composer-files { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.composer-file { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px; border: 1px solid var(--surface-line); border-radius: var(--radius-sm); }
.composer-file img, .composer-file .file-icon { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--on-surface) 8%, transparent); }
.composer-file.is-failed { border-color: var(--danger, #b00020); }
.file-info { display: grid; gap: 4px; min-width: 0; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-state { font-size: 13px; color: var(--on-surface-muted); }
.is-failed .file-state { color: var(--danger, #b00020); font-weight: 700; }
.file-info progress { width: 100%; height: 8px; }
.file-info input { font: inherit; font-size: 14px; }
.file-actions { display: grid; gap: 6px; }
.file-actions .btn { min-height: 40px; padding: 4px 10px; font-size: 14px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 20px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--surface-line); }
.composer-attach { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 14px; border: 1px solid var(--surface-line); border-radius: var(--radius-sm); background: transparent; color: var(--on-surface); font-weight: 700; cursor: pointer; }
.composer-attach:disabled { opacity: 0.55; cursor: not-allowed; }
.attach-icon { font-size: 22px; }
.composer-send { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 56px; min-height: 56px; padding: 6px 16px; border: var(--btn-border, 0); border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); box-shadow: var(--btn-shadow, none); font-weight: 800; cursor: pointer; }
.composer-send:disabled { opacity: 0.7; cursor: progress; }
.send-icon { font-size: 28px; line-height: 1; }
/* With a mouse: the label is a tooltip on hover and on keyboard focus. On touch screens it is always written next to the icon. */
@media (hover: hover) and (pointer: fine) {
  .composer-send .send-label { position: absolute; right: 0; bottom: calc(100% + 8px); padding: 6px 10px; border-radius: var(--radius-sm); background: var(--dark); color: var(--on-dark); font-size: 14px; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s; }
  .composer-send:hover .send-label, .composer-send:focus-visible .send-label { opacity: 1; transform: none; }
}
.composer-send:focus-visible, .composer-attach:focus-visible, .composer-close:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.composer-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 20px; padding: 10px; border: 2px solid var(--accent-edge); border-radius: var(--radius-sm); }
.composer-confirm p { margin: 0; flex: 1 1 100%; font-weight: 700; }
.composer-review { display: grid; gap: 10px; padding: 8px 20px 16px; overflow: auto; }
.composer-review h3 { margin: 0; font-size: 22px; }
.composer-review p { margin: 0; }
.composer-review-card { display: grid; gap: 6px; padding: 12px; border: 1px dashed var(--surface-line); border-radius: var(--radius-sm); }
.composer-review-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
@media (max-width: 640px) {
  .home-main > .home-tabs, .home-main > .posts-home { width: 100%; }
  .home-tabs a { flex: 1 1 auto; justify-content: center; text-align: center; }
  .post { padding: 12px; }
  .composer { width: calc(100% - 8px); max-height: calc(100dvh - 8px); }
  .composer-form { max-height: calc(100dvh - 10px); }
  .composer-main, .composer-review { padding-left: 14px; padding-right: 14px; }
  .composer-foot { padding-left: 14px; padding-right: 14px; }
  .attach-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .composer-send .send-label { transition: none; } }

/* ---------- profile: posts, badges; moderation ---------- */
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 14px; }
.mod-item { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--surface-line); }
.mod-item .post { box-shadow: none; }
.mod-reports { margin: 0; padding-left: 1.2em; font-size: 14px; }
.post-single { display: grid; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--line-on-bg); }
.post-back { color: var(--on-bg); font-weight: 700; display: inline-flex; min-height: 40px; align-items: center; }
.profile-posts > h2 + * + h2, .profile-posts > div + h2 { margin-top: 18px; }
