:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #0d0d0d;
  background: #f6f6f6;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
img { display: block; }
.hidden { display: none !important; }

.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fff;
}
.landing-card { width: min(100%, 480px); text-align: center; }
.landing-mark { width: 54px; height: 54px; margin: 0 auto 28px; border: 2px solid #111; border-radius: 15px; display: grid; place-items: center; }
.landing-mark::before { content: ""; width: 18px; height: 18px; border: 2px solid #111; border-radius: 50%; }
.landing h1 { max-width: 440px; margin: 0 auto 32px; font-size: clamp(2rem, 7vw, 3.4rem); line-height: 1.02; letter-spacing: -.045em; }
.landing-actions { display: grid; gap: 10px; }
.primary, .secondary, .small-button { border: 0; border-radius: 9px; min-height: 48px; padding: 0 18px; font-weight: 650; cursor: pointer; }
.primary { background: #0095f6; color: #fff; }
.primary:hover { background: #1877f2; }
.secondary { background: #efefef; }
.secondary:hover { background: #e5e5e5; }

.setup { min-height: 100vh; padding: 28px 18px 48px; background: #fff; }
.setup-panel { width: min(100%, 680px); margin: 0 auto; }
.setup-head { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; }
.setup-head h1 { font-size: 1.5rem; margin: 0; }
.icon-button { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.icon-button:hover { background: #f2f2f2; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 7px; text-align: left; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .84rem; font-weight: 650; }
.field input, .field textarea { width: 100%; border: 1px solid #dbdbdb; border-radius: 9px; padding: 12px; background: #fafafa; outline: none; }
.field input:focus, .field textarea:focus { border-color: #888; background: #fff; }
.field textarea { min-height: 92px; resize: vertical; }
.hint { margin: 0; color: #737373; font-size: .78rem; }
.setup-submit { width: 100%; margin-top: 24px; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.stage { min-width: 0; display: grid; place-items: center; padding: 24px 84px 24px 24px; }
.phone {
  width: min(100%, 430px);
  height: min(852px, calc(100vh - 48px));
  min-height: 620px;
  background: #fff;
  border: 1px solid #d5d5d5;
  border-radius: 34px;
  box-shadow: 0 14px 45px rgba(0,0,0,.12);
  overflow: hidden;
  display: grid;
  grid-template-rows: 28px minmax(0, 1fr) 56px;
  position: relative;
}
.status-bar { display: flex; justify-content: space-between; align-items: center; padding: 5px 20px 0; font-size: .7rem; font-weight: 700; }
.status-icons { letter-spacing: 2px; }
.screen { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.screen::-webkit-scrollbar { display: none; }
.screen-header { height: 48px; display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid #efefef; background: rgba(255,255,255,.96); position: sticky; top: 0; z-index: 5; }
.screen-header strong { flex: 1; text-align: center; font-size: .95rem; }
.screen-header .header-left, .screen-header .header-right { width: 42px; display: flex; align-items: center; }
.screen-header .header-right { justify-content: flex-end; }
.wordmark { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 1.65rem; font-weight: 700; letter-spacing: -.06em; }
.home-header { justify-content: space-between; }
.home-header .header-actions { display: flex; gap: 16px; }
.nav { border-top: 1px solid #e5e5e5; background: #fff; display: grid; grid-template-columns: repeat(4, 1fr); z-index: 7; }
.nav button { border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; position: relative; }
.nav button.active::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: #111; }
.nav svg, .icon-button svg, .action-row svg, .header-actions svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; }

.stories { height: 98px; border-bottom: 1px solid #efefef; display: flex; gap: 15px; padding: 12px 14px; overflow-x: auto; }
.story { border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 4px; font-size: .68rem; cursor: pointer; }
.story-ring { padding: 2px; border: 2px solid #c13584; border-radius: 50%; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #e9e9e9; }
.avatar.large { width: 78px; height: 78px; }
.story .avatar { width: 58px; height: 58px; border: 2px solid white; }
.story-view { min-height: 100%; background: #111; color: white; display: grid; grid-template-rows: 58px minmax(0, 1fr) 64px; }
.story-header { display: flex; align-items: center; gap: 9px; padding: 8px 10px; }
.story-header .icon-button { color: white; }
.story-header .avatar { width: 32px; height: 32px; }
.story-header strong { font-size: .82rem; }
.story-header > span { color: #aaa; font-size: .72rem; }
.story-content { width: 100%; height: 100%; object-fit: contain; }
.story-empty { display: grid; place-items: center; align-content: center; gap: 8px; }
.story-empty span { color: #aaa; font-size: .8rem; }
.story-reply { display: flex; align-items: center; gap: 13px; padding: 10px 16px; }
.story-reply button { flex: 1; border: 1px solid #777; border-radius: 22px; padding: 9px 13px; font-size: .78rem; color: white; background: transparent; text-align: left; cursor: pointer; }
.story-reply svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.avatar-fallback { display: grid; place-items: center; color: #555; font-weight: 700; text-transform: uppercase; }
.post-card { border-bottom: 1px solid #efefef; }
.post-author { height: 54px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; }
.post-author button { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.post-author strong { display: block; font-size: .83rem; }
.post-author span { display: block; font-size: .7rem; }
.post-image { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #f1f1f1; cursor: pointer; }
.action-row { padding: 10px 12px 6px; display: flex; gap: 16px; }
.action-row button { border: 0; background: none; padding: 0; cursor: pointer; }
.action-row .save { margin-left: auto; }
.post-copy { padding: 0 12px 14px; font-size: .82rem; line-height: 1.4; }
.post-copy p { margin: 0 0 5px; }
.post-copy button { border: 0; background: none; color: #737373; padding: 0; cursor: pointer; font-size: .8rem; }
.header-actions button { border: 0; background: transparent; padding: 0; cursor: pointer; }
.reference-post-placeholder { width: 100%; aspect-ratio: 1; border: 0; background: #ededed; color: #777; display: grid; place-content: center; gap: 8px; cursor: pointer; }
.reference-post-placeholder span { width: 74px; height: 74px; margin: auto; border: 1px solid #bbb; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; }
.reference-post-placeholder small { text-transform: uppercase; letter-spacing: .08em; }
.empty-feed, .empty-grid { min-height: 360px; display: grid; place-items: center; text-align: center; padding: 40px; }
.empty-feed h2, .empty-grid h3 { margin: 16px 0 6px; font-size: 1.18rem; }
.empty-feed p, .empty-grid p { margin: 0 0 18px; color: #737373; font-size: .86rem; line-height: 1.45; }
.empty-icon { width: 70px; height: 70px; border: 2px solid #111; border-radius: 50%; display: grid; place-items: center; }

.search-wrap { padding: 8px 12px; position: sticky; top: 0; background: #fff; z-index: 4; }
.search-input { height: 38px; width: 100%; border: 0; border-radius: 10px; background: #efefef; padding: 0 14px; outline: none; }
.search-label { padding: 14px 16px 8px; font-weight: 700; font-size: .9rem; }
.search-result { width: 100%; border: 0; background: #fff; display: flex; align-items: center; gap: 12px; padding: 10px 16px; text-align: left; cursor: pointer; }
.search-result:hover { background: #fafafa; }
.search-result .avatar { width: 48px; height: 48px; }
.search-result strong, .search-result span { display: block; }
.search-result strong { font-size: .88rem; }
.search-result span { color: #737373; font-size: .82rem; }
.search-result > small { margin-left: auto; color: #0095f6; font-size: .68rem; font-weight: 700; }
.reference-avatar { background: #292929; color: #f5f5f5; }

.profile-head { padding: 18px 16px 14px; }
.profile-top { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; font-size: .78rem; }
.stats strong { display: block; font-size: .95rem; }
.profile-bio { margin-top: 14px; font-size: .82rem; line-height: 1.35; }
.profile-bio strong, .profile-bio span { display: block; }
.profile-bio a { color: #00376b; font-weight: 650; text-decoration: none; }
.profile-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 14px; }
.small-button { min-height: 32px; padding: 0 10px; font-size: .8rem; background: #efefef; }
.small-button.follow { color: white; background: #0095f6; }
.small-button.following { background: #efefef; }
.reference-link { display: grid; place-items: center; text-decoration: none; }
.profile-tabs { height: 44px; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid #efefef; }
.profile-tabs button { border: 0; background: #fff; display: grid; place-items: center; }
.profile-tabs button:first-child { border-bottom: 1px solid #111; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.grid-post { border: 0; padding: 0; background: #eee; cursor: pointer; }
.grid-post img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.create-view { padding: 30px 18px; }
.create-view h2 { margin: 0 0 8px; font-size: 1.3rem; }
.create-view > p { color: #737373; margin: 0 0 24px; font-size: .88rem; }
.upload-box { min-height: 220px; border: 1px dashed #aaa; border-radius: 12px; display: grid; place-items: center; text-align: center; padding: 20px; margin-bottom: 16px; background: #fafafa; }
.upload-preview { width: 100%; max-height: 310px; object-fit: contain; border-radius: 8px; }

.circle-view { padding-bottom: 24px; }
.circle-intro { padding: 22px 18px 16px; }
.circle-intro h2 { margin: 0 0 7px; font-size: 1.28rem; }
.circle-intro p, .circle-callout p { margin: 0; color: #737373; font-size: .84rem; line-height: 1.45; }
.circle-upload { margin: 6px 18px 10px; min-height: 220px; border: 1px dashed #999; border-radius: 14px; background: #fafafa; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; cursor: pointer; }
.circle-upload svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.circle-upload span { color: #737373; font-size: .78rem; }
.privacy-note { margin: 12px 18px 0; color: #737373; font-size: .72rem; line-height: 1.4; text-align: center; }
.circle-loading { min-height: 430px; display: grid; place-items: center; align-content: center; gap: 10px; text-align: center; }
.circle-loading p { margin: 0; color: #737373; font-size: .78rem; }
.spinner { width: 32px; height: 32px; border: 3px solid #ddd; border-top-color: #111; border-radius: 50%; animation: spin .8s linear infinite; }
.fit-score { margin: 0 18px 14px; border: 1px solid #e5e5e5; border-radius: 14px; padding: 14px; display: flex; align-items: center; gap: 14px; }
.score-ring { width: 66px; height: 66px; flex: 0 0 auto; border: 5px solid #111; border-radius: 50%; display: grid; place-content: center; text-align: center; line-height: 1; }
.score-ring strong { font-size: 1.2rem; }
.score-ring span { color: #737373; font-size: .65rem; margin-top: 3px; }
.fit-score h3 { margin: 0 0 4px; font-size: .95rem; }
.fit-score p { margin: 0; color: #737373; font-size: .75rem; }
.fit-metrics { margin: 0 18px 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.fit-metrics span { padding: 9px 4px; border-radius: 9px; background: #f3f3f3; color: #737373; font-size: .66rem; }
.fit-metrics strong { display: block; color: #111; font-size: .86rem; margin-bottom: 2px; }
.circle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: #fff; }
.circle-tile { position: relative; border: 0; padding: 0; background: #eee; overflow: hidden; }
.circle-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; }
button.circle-tile { cursor: pointer; }
.own-tile { outline: 3px solid #0095f6; outline-offset: -3px; }
.own-tile span { position: absolute; left: 6px; bottom: 6px; background: #0095f6; color: white; border-radius: 5px; padding: 3px 5px; font-size: .6rem; font-weight: 700; }
.circle-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 12px 18px 0; }
.circle-actions label { display: grid; place-items: center; cursor: pointer; }
.circle-actions button { border: 0; }
.circle-callout { margin: 0 18px 16px; padding: 16px; border-radius: 12px; background: #f3f3f3; }
.circle-callout strong { display: block; margin-bottom: 5px; }
.circle-callout .primary { width: 100%; margin-top: 12px; }

.comments { padding: 6px 14px 80px; }
.comment { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 10px 0; font-size: .82rem; }
.comment .avatar { width: 34px; height: 34px; }
.comment p { margin: 0; line-height: 1.35; }
.comment-time { color: #737373; font-size: .7rem; margin-top: 4px; }
.comment-form { position: absolute; bottom: 56px; left: 0; right: 0; border-top: 1px solid #efefef; background: white; padding: 8px 10px; display: flex; gap: 8px; z-index: 6; }
.comment-form input { flex: 1; min-width: 0; border: 1px solid #dbdbdb; border-radius: 20px; padding: 9px 12px; outline: none; }
.comment-form button { border: 0; background: none; color: #0095f6; font-weight: 700; }

.messages-view { min-height: 100%; display: grid; grid-template-rows: 56px minmax(0, 1fr) 58px; }
.message-person { flex: 1; display: flex; align-items: center; gap: 8px; }
.message-person .avatar { width: 32px; height: 32px; }
.message-person span, .message-person small { display: block; }
.message-person strong { font-size: .8rem; }
.message-person small { color: #737373; font-size: .65rem; }
.message-thread { min-height: 0; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.message-empty { margin: auto; display: grid; justify-items: center; gap: 5px; text-align: center; }
.message-empty span, .message-empty p { color: #737373; font-size: .76rem; }
.message-empty p { margin: 8px 0 0; }
.message-bubble { max-width: 76%; border-radius: 18px; padding: 9px 12px; font-size: .82rem; line-height: 1.35; }
.from-viewer { align-self: flex-end; background: #3797f0; color: white; }
.from-account { align-self: flex-start; background: #efefef; }
.message-form { border-top: 1px solid #e5e5e5; display: flex; align-items: center; gap: 7px; padding: 8px; }
.message-form input { flex: 1; min-width: 0; border: 1px solid #dbdbdb; border-radius: 20px; padding: 9px 11px; background: transparent; color: inherit; }
.message-form > button:last-child { border: 0; background: transparent; color: #0095f6; font-weight: 700; }
.message-role { border: 0; border-radius: 14px; background: #efefef; padding: 6px 8px; font-size: .65rem; cursor: pointer; }

.edit-toggle { position: fixed; right: 24px; top: 24px; border: 0; background: #111; color: white; min-height: 44px; border-radius: 22px; padding: 0 18px; font-weight: 650; cursor: pointer; z-index: 20; box-shadow: 0 5px 20px rgba(0,0,0,.2); }
.theme-toggle { position: fixed; right: 154px; top: 24px; border: 1px solid #ccc; background: white; color: #111; min-height: 44px; border-radius: 22px; padding: 0 16px; font-weight: 650; cursor: pointer; z-index: 20; }
.dashboard { width: 370px; height: 100vh; position: sticky; top: 0; background: white; border-left: 1px solid #ddd; padding: 24px; overflow-y: auto; box-shadow: -12px 0 35px rgba(0,0,0,.08); z-index: 30; }
.dashboard-head { display: flex; align-items: center; margin-bottom: 24px; }
.dashboard-head h2 { flex: 1; margin: 0; font-size: 1.2rem; }
.dashboard .field { margin-bottom: 14px; }
.dashboard-avatar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.dashboard-avatar .avatar { width: 56px; height: 56px; }
.dashboard-avatar label { color: #0095f6; font-weight: 650; font-size: .85rem; cursor: pointer; }
.dashboard-note { color: #737373; font-size: .75rem; line-height: 1.4; margin: 14px 0 0; }
.dashboard-divider { height: 1px; background: #e5e5e5; margin: 24px 0; }
.dashboard h3 { margin: 0 0 14px; font-size: 1rem; }
.dashboard-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reference-list { display: grid; gap: 8px; margin-top: 12px; }
.reference-list > div { display: grid; grid-template-columns: 36px 1fr 32px; align-items: center; gap: 9px; padding: 8px; border: 1px solid #e5e5e5; border-radius: 9px; }
.reference-list span, .reference-list small { display: block; }
.reference-list strong { font-size: .78rem; }
.reference-list small { color: #737373; font-size: .68rem; }
.reference-list button { border: 0; background: transparent; font-size: 1.2rem; cursor: pointer; }
.dashboard-post-upload { min-height: 120px; border: 1px dashed #aaa; border-radius: 10px; background: #fafafa; display: grid; place-items: center; margin-bottom: 14px; cursor: pointer; overflow: hidden; }
.dashboard-post-upload span { display: flex; align-items: center; gap: 8px; color: #555; font-size: .82rem; font-weight: 650; }
.dashboard-post-upload svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.dashboard-post-upload img { width: 100%; max-height: 220px; object-fit: contain; }

.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #222; color: #fff; border-radius: 8px; padding: 11px 15px; font-size: .82rem; z-index: 100; box-shadow: 0 5px 18px rgba(0,0,0,.25); }

[data-theme="dark"] { color-scheme: dark; color: #f5f5f5; background: #0b0f12; }
[data-theme="dark"] body,
[data-theme="dark"] .workspace,
[data-theme="dark"] .landing,
[data-theme="dark"] .setup,
[data-theme="dark"] .phone,
[data-theme="dark"] .screen-header,
[data-theme="dark"] .nav,
[data-theme="dark"] .profile-tabs button,
[data-theme="dark"] .search-wrap,
[data-theme="dark"] .search-result,
[data-theme="dark"] .dashboard { background: #0b0f12; color: #f5f5f5; }
[data-theme="dark"] .phone,
[data-theme="dark"] .dashboard,
[data-theme="dark"] .screen-header,
[data-theme="dark"] .nav,
[data-theme="dark"] .stories,
[data-theme="dark"] .post-card,
[data-theme="dark"] .profile-tabs,
[data-theme="dark"] .message-form { border-color: #272b30; }
[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .search-input,
[data-theme="dark"] .message-role,
[data-theme="dark"] .from-account,
[data-theme="dark"] .small-button,
[data-theme="dark"] .fit-metrics span,
[data-theme="dark"] .circle-callout { background: #24272b; color: #f5f5f5; border-color: #383c42; }
[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field textarea:focus { background: #16191d; border-color: #777; }
[data-theme="dark"] .circle-upload,
[data-theme="dark"] .dashboard-post-upload,
[data-theme="dark"] .reference-post-placeholder { background: #171a1e; color: #aaa; }
[data-theme="dark"] .theme-toggle { background: #24272b; color: #f5f5f5; border-color: #444; }
[data-theme="dark"] .edit-toggle { background: #f5f5f5; color: #111; }
[data-theme="dark"] .fit-metrics strong { color: #f5f5f5; }
[data-theme="dark"] .circle-grid { background: #0b0f12; }
[data-theme="dark"] .empty-icon { border-color: #f5f5f5; }
[data-theme="dark"] .profile-bio a { color: #8ab4f8; }

@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .workspace { display: block; background: #fff; }
  .stage { display: block; padding: 0; }
  .phone { width: 100%; height: 100vh; min-height: 560px; border: 0; border-radius: 0; box-shadow: none; }
  .edit-toggle { top: auto; right: 14px; bottom: 70px; min-height: 42px; font-size: .82rem; }
  .theme-toggle { top: auto; right: 132px; bottom: 70px; min-height: 42px; font-size: .82rem; }
  .dashboard { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; padding-bottom: 40px; }
}

@media (prefers-reduced-motion: no-preference) {
  .dashboard { animation: slide-in .18s ease-out; }
  .toast { animation: toast-in .16s ease-out; }
  @keyframes slide-in { from { transform: translateX(20px); opacity: 0; } }
  @keyframes toast-in { from { transform: translate(-50%, 8px); opacity: 0; } }
  @keyframes spin { to { transform: rotate(360deg); } }
}
