:root {
  --silver: #ece9d8;
  --silver-dark: #d8d3c2;
  --silver-darker: #b8b49f;
  --border-dark: #7f7c6a;
  --blue-deep: #0d3fae;
  --blue: #2a66c8;
  --blue-light: #5b9bff;
  --ink: #131313;
  --ink-dim: #52504a;
  --ink-dimmer: #83806e;
  --like: #c8264a;
  --repost: #0d7a2f;
  --danger: #c1352a;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 90% at 30% -10%, #6ba8f0 0%, #2f6fd6 45%, #1449ad 100%);
  color: var(--ink);
  font-family: Tahoma, "Segoe UI", Verdana, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  padding: 22px 14px 40px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
code { font-family: "Courier New", monospace; background: #fff; padding: 1px 4px; border: 1px solid var(--silver-darker); }

/* ---------- window chrome ---------- */
.xp-desktop { max-width: 1180px; margin: 0 auto; }
.xp-window {
  display: flex;
  flex-direction: column;
  min-height: 78vh;
  background: var(--silver);
  border: 1px solid #0a2f80;
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 10, 40, .45), 0 0 0 1px rgba(255, 255, 255, .08) inset;
}
.xp-titlebar {
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px 0 10px;
  background: linear-gradient(180deg, #4c8df0 0%, #1f5fd6 10%, #1a56cc 45%, #0d3fae 70%, #123f9e 100%);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: .01em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
  user-select: none;
}
.xp-title { display: flex; align-items: center; gap: 7px; }
.xp-app-icon { font-size: 15px; }
.xp-winbtns { display: flex; gap: 3px; }
.xp-winbtn {
  width: 23px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #6fabf6, #1c5bc4);
  border: 1px solid #0a3a91;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
}
.xp-winbtn:hover { filter: brightness(1.15); }
.xp-winbtn:active { filter: brightness(.8); }
.xp-winbtn-close { background: linear-gradient(180deg, #f6968a, #d13f2e); border-color: #8a1f14; }

.xp-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 5px 8px;
  background: linear-gradient(180deg, #f6f4ec, #dcd7c6);
  border-bottom: 1px solid var(--border-dark);
}
.xp-tool-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  color: #17171a;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 3px;
  white-space: nowrap;
}
.xp-tool-btn:hover { background: #fff2bf; border-color: #cba24f; }
.xp-tool-btn.active { background: #dde8fb; border-color: #8fa9d6; }
.xp-toolbar-spacer { flex: 1; min-width: 8px; }
.xp-avatar { width: 18px; height: 18px; border-radius: 2px; object-fit: cover; border: 1px solid #999; }
.xp-auth span { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-login { background: linear-gradient(180deg, #5b9bff, #1f5fd6); color: #fff; border-color: #123f9e; border-radius: 3px; }
.xp-login:hover { background: linear-gradient(180deg, #79b0ff, #2a66c8); }

.xp-body {
  flex: 1;
  background: var(--silver);
  padding: 14px 18px 24px;
  font-size: 13.5px;
  overflow: visible;
}
.xp-statusbar {
  flex-shrink: 0;
  background: linear-gradient(180deg, #ece9d8, #d8d3c2);
  border-top: 1px solid #fff;
  padding: 4px 10px;
  font-size: 11px;
  color: #4a4838;
}
.xp-statusbar a { text-decoration: underline; }

.xp-window.minimized .xp-toolbar,
.xp-window.minimized .xp-body,
.xp-window.minimized .xp-statusbar { display: none; }
.xp-window.minimized .xp-titlebar { cursor: pointer; border-radius: 8px; }
.xp-window.maxed { max-width: none; }

/* ---------- launcher (home screen) ---------- */
.xp-launcher { display: grid; grid-template-columns: 148px 1fr 148px; align-items: start; }
.xp-launcher .col { padding: 10px 12px; }
.col-explore { border-right: 2px groove #c4c0ab; }
.col-notif { border-left: 2px groove #c4c0ab; }

.section-title {
  font-style: italic;
  font-weight: 800;
  font-size: 14.5px;
  color: #1a7a1a;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title.c-discover { color: #8a1a9e; }
.section-title .nav-badge { position: static; }

.launcher-section { margin-bottom: 6px; }
.section-rule { border: none; border-top: 1px solid var(--silver-darker); border-bottom: 1px solid #fff; margin: 16px 4px; }

.icon-grid { display: grid; grid-template-columns: repeat(3, 88px); gap: 20px 18px; }
.icon-rail { display: flex; flex-direction: column; align-items: center; gap: 26px; }

.icon-tile { width: 88px; display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer; }
.icon-tile .glyph {
  width: 64px; height: 64px;
  background: #fff;
  border: 2px solid #6b6b6b;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .22), inset 1px 1px 0 #fff;
}
.icon-tile:hover .glyph { border-color: var(--blue); box-shadow: 3px 3px 0 rgba(0, 0, 0, .22), inset 1px 1px 0 #fff, 0 0 0 2px rgba(42, 102, 200, .35); }
.icon-tile:active .glyph { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0, 0, 0, .22), inset 1px 1px 0 #fff; }
.icon-tile .caption { font-weight: 700; font-size: 11.5px; color: #111; text-align: center; line-height: 1.25; }

/* ---------- headers / tabs ---------- */
.main-header { padding: 2px 2px 10px; margin-bottom: 12px; border-bottom: 2px groove #c4c0ab; }
.main-header h1 { margin: 0; font-size: 17px; font-weight: 800; color: var(--blue-deep); }
.main-header .sub { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }
.back-row { display: flex; align-items: center; gap: 12px; }
.back-btn {
  cursor: pointer; font-weight: 800; font-size: 13px;
  padding: 3px 9px;
  background: linear-gradient(180deg, #fdfdfb, #e2ded0);
  border: 1px solid var(--border-dark); border-radius: 3px;
  box-shadow: inset 1px 1px 0 #fff;
}
.back-btn:hover { background: #fff2bf; }

.tabs { display: flex; border-bottom: 2px solid var(--silver-darker); margin-bottom: 4px; }
.tab { padding: 8px 14px; font-weight: 700; font-size: 12.5px; color: var(--ink-dim); cursor: pointer; border-bottom: 3px solid transparent; }
.tab:hover { background: #fff2bf; }
.tab.active { color: var(--blue-deep); border-bottom-color: var(--blue); }

.feed-tabs { display: flex; gap: 3px; flex-wrap: wrap; margin-bottom: 10px; }
.feed-tab {
  padding: 5px 13px; font-size: 12px; font-weight: 700; cursor: pointer;
  background: linear-gradient(180deg, #f0ecdd, #d8d3c2);
  border: 1px solid var(--border-dark); border-bottom: none;
  border-radius: 3px 3px 0 0;
}
.feed-tab:hover { background: #fff2bf; }
.feed-tab.active { background: #fff; color: var(--blue-deep); }

/* ---------- post card ---------- */
.post {
  display: flex; gap: 10px;
  padding: 10px; margin-bottom: 6px;
  background: #fff;
  border: 1px solid #cfcab4;
  cursor: pointer;
}
.post:hover { background: #fdfaea; border-color: #c8a95a; }
.post-avatar img, .avatar-img { width: 40px; height: 40px; object-fit: cover; border: 1px solid #999; background: var(--silver); }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.post-name { font-weight: 800; }
.post-name:hover { text-decoration: underline; }
.post-handle, .post-time, .post-dot { color: var(--ink-dim); }
.verify-badge { color: var(--blue); font-size: 12px; }
.post-text { margin-top: 3px; white-space: pre-wrap; word-wrap: break-word; font-size: 13.5px; }
.rt-link, .rt-mention, .rt-tag { color: var(--blue-deep); text-decoration: underline; }
.reply-context { color: var(--ink-dim); font-size: 12px; margin-bottom: 3px; }
.reply-context a { color: var(--blue-deep); }

.post-actions { display: flex; gap: 16px; flex-wrap: wrap; max-width: 460px; margin-top: 8px; color: var(--ink-dim); font-size: 12px; }
.act { display: flex; align-items: center; gap: 5px; padding: 3px 5px; border-radius: 3px; cursor: pointer; }
.act:hover { background: #eee6c4; }
.act.reply:hover { color: var(--blue-deep); }
.act.repost:hover { color: var(--repost); }
.act.repost.reposted { color: var(--repost); font-weight: 800; }
.act.like:hover { color: var(--like); }
.act.like.liked { color: var(--like); font-weight: 800; }
.act.save .save-icon { padding: 1px 4px; border-radius: 2px; }
.act.save.saved .save-icon { background: #ffe08a; outline: 1px solid #c8960c; }
.act.share { font-size: 13px; }

/* ---------- embeds ---------- */
.embed { margin-top: 8px; }
.imgs { display: grid; gap: 2px; border: 1px solid #cfcab4; overflow: hidden; }
.imgs img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.imgs.n1 { grid-template-columns: 1fr; max-height: 460px; }
.imgs.n1 img { max-height: 460px; }
.imgs.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2/1.1; }
.imgs.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 2/1.3; }
.imgs.n3 img:first-child { grid-row: 1/3; }
.imgs.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 2/1.3; }
.imgs .sensitive-cover { position: relative; }
.imgs .sensitive-cover::after {
  content: "Sensitive content — tap to view";
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 20, 20, .75); color: #fff; font-size: 12px; font-weight: 700; text-align: center; padding: 8px;
}
.imgs .sensitive-cover img { filter: blur(28px); }

.ext-card { border: 1px solid #cfcab4; overflow: hidden; display: block; background: #fff; }
.ext-card img { width: 100%; max-height: 250px; object-fit: cover; background: var(--silver); }
.ext-card .ext-body { padding: 9px 11px; }
.ext-card .ext-domain { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; }
.ext-card .ext-title { font-weight: 800; margin-top: 2px; font-size: 13px; }
.ext-card .ext-desc { color: var(--ink-dim); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.quote { border: 1px solid #cfcab4; background: #fbfaf3; padding: 8px 10px; margin-top: 6px; cursor: pointer; }
.quote:hover { background: #fdfaea; }
.quote-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.quote-head img { width: 18px; height: 18px; border: 1px solid #999; }
.quote-text { margin-top: 4px; font-size: 13px; white-space: pre-wrap; }
.quote-missing { color: var(--ink-dim); font-size: 12px; font-style: italic; }

.video-embed { position: relative; overflow: hidden; border: 1px solid #cfcab4; background: #000; }
.video-embed[data-action] { cursor: pointer; }
.video-embed img { width: 100%; max-height: 460px; object-fit: cover; opacity: .85; }
.video-embed .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 44px; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.video-embed video { width: 100%; max-height: 460px; background: #000; }

/* ---------- profile ---------- */
.profile-banner { height: 130px; background: linear-gradient(135deg, #9db8e8, #2a66c8); background-size: cover; background-position: center; border: 1px solid #99927a; }
.profile-head { padding: 10px 4px; position: relative; }
.profile-avatar { width: 82px; height: 82px; border: 3px solid var(--silver); box-shadow: 0 0 0 1px #888; object-fit: cover; margin-top: -50px; background: #fff; }
.profile-name { font-size: 19px; font-weight: 800; margin-top: 8px; display: flex; align-items: center; gap: 6px; color: var(--blue-deep); }
.profile-handle { color: var(--ink-dim); font-size: 13px; }
.profile-follow-badge { display: inline-block; font-size: 11px; color: var(--ink-dim); background: #e2ded0; border: 1px solid var(--silver-darker); padding: 1px 6px; margin-top: 4px; }
.profile-bio { margin-top: 8px; white-space: pre-wrap; font-size: 13px; }
.profile-stats { display: flex; gap: 16px; margin-top: 8px; font-size: 12.5px; color: var(--ink-dim); }
.profile-stats b { color: var(--ink); }
.profile-stats a:hover { text-decoration: underline; }

/* ---------- thread ---------- */
.thread-parent { opacity: .92; }
.thread-parent .post { border-bottom: none; }
.thread-group { position: relative; }
.thread-focus { padding: 10px; margin-bottom: 8px; background: #fff; border: 1px solid #cfcab4; }
.thread-focus .post-head-full { display: flex; align-items: center; gap: 10px; }
.thread-focus .post-head-full img { width: 44px; height: 44px; border: 1px solid #999; }
.thread-focus .post-text { font-size: 17px; margin-top: 10px; }
.thread-focus .thread-time { color: var(--ink-dim); font-size: 12.5px; margin-top: 10px; }
.thread-focus .post-actions { max-width: 100%; border-top: 1px solid var(--silver-darker); border-bottom: 1px solid var(--silver-darker); padding: 8px 0; margin-top: 10px; }
.reply-indent { padding-left: 18px; border-left: 2px solid var(--silver-darker); margin-left: 24px; }

/* ---------- lists (feeds/search/notifications) ---------- */
.card-row { display: flex; gap: 10px; padding: 8px; margin-bottom: 5px; background: #fff; border: 1px solid #cfcab4; align-items: flex-start; cursor: pointer; }
.card-row:hover { background: #fdfaea; }
.card-row img { width: 38px; height: 38px; object-fit: cover; border: 1px solid #999; background: var(--silver); }
.card-row.actor img { border-radius: 50%; }
.card-row .cr-body { flex: 1; min-width: 0; }
.card-row .cr-title { font-weight: 800; font-size: 13px; }
.card-row .cr-sub { color: var(--ink-dim); font-size: 11.5px; }
.card-row .cr-desc { font-size: 12.5px; margin-top: 3px; }
.card-row.notif.unread { background: #e9f0fd; border-color: #9db8e8; }
.card-row.notif .cr-title a { font-weight: 800; }

.search-box { margin-bottom: 12px; }
.search-input-wrap { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px inset #9c9989; padding: 6px 10px; }
.search-input-wrap input { border: none; background: transparent; outline: none; flex: 1; font-size: 13.5px; color: var(--ink); font-family: inherit; }

.section-label { padding: 10px 0 4px; font-size: 11px; font-weight: 800; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- buttons / auth / modals ---------- */
.xp-btn-3d {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: #111;
  background: linear-gradient(180deg, #fdfdfb, #e2ded0);
  border: 1px solid var(--border-dark);
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 #fff;
  cursor: pointer;
}
.xp-btn-3d:hover { background: linear-gradient(180deg, #fff2bf, #ecdba0); border-color: #cba24f; }
.xp-btn-3d:active { box-shadow: inset 1px 1px 4px rgba(0, 0, 0, .3); }
.xp-btn-3d.primary { background: linear-gradient(180deg, #5b9bff, #1f5fd6); color: #fff; border-color: #123f9e; }
.xp-btn-3d.primary:hover { background: linear-gradient(180deg, #79b0ff, #2a66c8); }
.xp-btn-3d.danger { background: linear-gradient(180deg, #f6968a, #d13f2e); color: #fff; border-color: #8a1f14; }
.xp-btn-3d.danger.blocking { background: linear-gradient(180deg, #fdfdfb, #e2ded0); color: var(--danger); }
.xp-btn-3d.danger.blocking:hover { background: linear-gradient(180deg, #f6968a, #d13f2e); color: #fff; }

.modal-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(10, 20, 40, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--silver); border: 2px solid var(--blue-deep); border-radius: 4px; padding: 16px; width: 100%; max-width: 380px; box-shadow: 0 16px 44px rgba(0, 0, 0, .4); }
.modal h2 { margin: 0 0 8px; font-size: 15px; color: var(--blue-deep); }
.modal p { margin: 0 0 12px; font-size: 12px; color: var(--ink-dim); line-height: 1.5; }
.modal input, .modal textarea { width: 100%; padding: 8px 10px; border: 2px inset #9c9989; background: #fff; color: var(--ink); font-size: 13.5px; outline: none; font-family: inherit; }
.modal textarea { resize: vertical; min-height: 90px; line-height: 1.4; }
.reply-count-hint { text-align: right; font-size: 11px; color: var(--ink-dimmer); margin-top: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal-status { margin-top: 8px; font-size: 11.5px; color: var(--danger); min-height: 1em; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 12px); z-index: 70;
  background: #2a2a2a; color: #fff; padding: 9px 16px; border-radius: 4px;
  font-size: 12.5px; font-weight: 700; opacity: 0; transition: opacity .2s, transform .2s;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .4); max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }
.toast.ok { background: #1f7a3d; }

/* ---------- misc states ---------- */
.center-msg { padding: 50px 20px; text-align: center; color: var(--ink-dim); }
.center-msg h2 { color: var(--ink); font-size: 16px; }
.load-more { display: block; width: 100%; padding: 12px; text-align: center; color: var(--blue-deep); font-weight: 700; cursor: pointer; background: #fff; border: 1px solid #cfcab4; }
.load-more:hover { background: #fff2bf; }
.err-box { margin: 10px 0; padding: 12px; border: 1px solid var(--danger); background: #fdeceb; border-radius: 3px; color: var(--danger); font-size: 13px; }
.skel { background: linear-gradient(90deg, #e6e2d2 25%, #f6f3e8 37%, #e6e2d2 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.lightbox {
  display: none; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .9);
  align-items: center; justify-content: center; cursor: zoom-out; padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-close { position: absolute; top: 16px; right: 20px; color: #fff; font-size: 26px; cursor: pointer; z-index: 2; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #fff; font-size: 40px; cursor: pointer; padding: 0 18px; user-select: none; z-index: 2; }
.lb-prev { left: 6px; }
.lb-next { right: 6px; }

/* ---------- nav badge ---------- */
.nav-badge {
  display: none;
  margin-left: 2px;
  min-width: 15px; height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
}
.nav-badge.show { display: inline-block; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  body { padding: 0; }
  .xp-desktop { max-width: none; }
  .xp-window { border-radius: 0; min-height: 100vh; }
  .xp-launcher { display: block; }
  .col-explore, .col-notif { border: none; border-top: 2px groove #c4c0ab; }
  .icon-rail { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 16px; }
  .icon-grid { grid-template-columns: repeat(3, 1fr); justify-items: center; }
  .xp-tool-btn .label { display: none; }
}
