:root {
  --paper: #f6f1e9;
  --card: #fffdf9;
  --ink: #19201d;
  --muted: #6d746f;
  --line: #ded8ce;
  --accent: #f06449;
  --accent-dark: #ca422a;
  --sage: #b9c8b8;
  --shadow: 0 18px 60px rgba(38, 34, 27, .1);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-rounded, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; min-height: 100vh; font-family: var(--sans); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark, .big-mark, .empty-mark {
  display: grid; place-items: center; font-family: var(--serif); font-style: italic;
  background: var(--accent); color: white; transform: rotate(-7deg);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 700; letter-spacing: -.8px; }
.brand-mark { width: 35px; height: 35px; border-radius: 12px 8px 13px 9px; font-size: 22px; box-shadow: 4px 5px 0 #26342d; }
.topbar {
  position: sticky; z-index: 20; top: 0; height: 76px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1120px) / 2)); background: rgba(246, 241, 233, .9);
  border-bottom: 1px solid rgba(25, 32, 29, .08); backdrop-filter: blur(18px);
}
.desktop-nav { display: flex; align-items: center; gap: 8px; }
.nav-link { display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-radius: 14px; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav-link:hover, .nav-link.active { color: var(--ink); background: rgba(255,255,255,.65); }
.upload-pill, .button {
  border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border-radius: 14px; padding: 12px 18px;
  font-weight: 700; cursor: pointer; transition: transform .18s, box-shadow .18s, background .18s;
}
.upload-pill, .button.primary { color: white; background: var(--ink); box-shadow: 0 8px 20px rgba(25,32,29,.16); }
.upload-pill:hover, .button:hover { transform: translateY(-2px); }
.button.primary:hover { background: #2e3833; }
.button.secondary { background: #ebe5db; color: var(--ink); }
.button.full { width: 100%; }
.button:disabled { opacity: .42; pointer-events: none; }
.avatar-link, .mini-avatar, .profile-avatar {
  display: grid; place-items: center; border-radius: 50%; background: var(--sage); color: #25322b; font-weight: 700;
}
.avatar-link { width: 40px; height: 40px; margin-left: 5px; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.mobile-nav { display: none; }
.feed-shell { width: min(100% - 32px, 760px); margin: 0 auto; padding: 68px 0 100px; }
.feed-intro { display: flex; justify-content: space-between; align-items: end; padding: 0 4px 46px; }
.feed-intro h1, .upload-card h1, .invite-card h1, .profile-head h1 {
  margin: 6px 0 0; font-family: var(--serif); font-size: clamp(39px, 6vw, 62px); line-height: .98; letter-spacing: -2.6px;
}
.feed-intro > p { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow { margin: 0; color: var(--accent-dark); text-transform: uppercase; letter-spacing: 1.8px; font-size: 11px; font-weight: 700; }
.feed { display: grid; gap: 28px; }
.photo-card { overflow: hidden; background: var(--card); border: 1px solid rgba(25,32,29,.09); border-radius: 26px; box-shadow: 0 8px 30px rgba(46,40,31,.06); }
.photo-meta { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.person { display: flex; align-items: center; gap: 11px; }
.person span:last-child { display: grid; gap: 1px; }
.person strong { font-size: 14px; }
.person small, .photo-meta time { color: var(--muted); font-size: 12px; }
.mini-avatar { width: 39px; height: 39px; }
.photo-actions { display: flex; align-items: center; gap: 9px; }
.icon-button { display: grid; place-items: center; border: 0; width: 34px; height: 34px; background: transparent; border-radius: 10px; color: var(--muted); cursor: pointer; }
.icon-button:hover { background: #f3ece3; color: var(--accent-dark); }
.icon-button svg { width: 17px; }
.photo-frame { display: block; background: #e9e4db; }
.photo-frame img { display: block; width: 100%; height: auto; max-height: 760px; object-fit: contain; }
.empty-state { padding: 80px 25px; display: grid; justify-items: center; text-align: center; }
.feed-empty { border: 1px dashed #c9c1b6; border-radius: 26px; }
.empty-mark { width: 62px; height: 62px; border-radius: 22px 15px 23px 18px; font-size: 38px; box-shadow: 6px 7px 0 #26342d; }
.empty-state h1, .empty-state h2 { font-family: var(--serif); font-size: 38px; margin: 25px 0 8px; }
.empty-state p { max-width: 420px; color: var(--muted); margin: 0 0 24px; }
.narrow { width: min(100% - 32px, 680px); margin: 0 auto; }
.page-space { padding: 54px 0 100px; }
.back-link { display: inline-block; margin-bottom: 22px; color: var(--muted); font-size: 14px; font-weight: 600; }
.upload-card, .invite-card { background: var(--card); border: 1px solid rgba(25,32,29,.08); border-radius: 28px; padding: clamp(25px, 6vw, 52px); box-shadow: var(--shadow); }
.upload-card h1, .invite-card h1 { font-size: clamp(38px, 8vw, 57px); margin-bottom: 15px; }
.muted { color: var(--muted); line-height: 1.6; }
.upload-form { margin-top: 34px; display: grid; gap: 14px; }
.drop-zone {
  position: relative; overflow: hidden; min-height: 340px; display: grid; align-content: center; justify-items: center; gap: 8px;
  background: #f2ede5; border: 1.5px dashed #bcb5ab; border-radius: 22px; cursor: pointer; transition: border .2s, background .2s;
}
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: #faeee8; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { width: 58px; height: 58px; display: grid; place-items: center; background: var(--ink); color: white; border-radius: 20px; margin-bottom: 8px; }
.drop-icon svg { width: 27px; height: 27px; }
.drop-zone > span:last-of-type { color: var(--muted); font-size: 13px; }
.upload-preview { display: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #eee8df; }
.drop-zone.has-preview .upload-preview { display: block; }
.form-error { padding: 12px 14px; color: #8b2e20; background: #fbe3dc; border-radius: 12px; font-size: 13px; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.auth-brand { position: relative; overflow: hidden; min-height: 100vh; padding: clamp(40px, 7vw, 100px); display: flex; flex-direction: column; justify-content: center; background: #24342c; color: #f8f3ea; }
.auth-brand h1 { position: relative; z-index: 2; margin: 15px 0 24px; font: 700 clamp(54px, 8vw, 106px)/.88 var(--serif); letter-spacing: -5px; }
.auth-brand > p:last-of-type { position: relative; z-index: 2; max-width: 450px; margin: 0; color: #c9d1c8; font-size: 17px; line-height: 1.6; }
.big-mark { position: relative; z-index: 2; width: 76px; height: 76px; border-radius: 25px 18px 28px 20px; font-size: 46px; box-shadow: 8px 9px 0 #f0c76b; margin-bottom: 50px; }
.orbit { position: absolute; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; }
.orbit-one { width: 600px; height: 600px; right: -280px; bottom: -210px; }
.orbit-two { width: 410px; height: 410px; right: -180px; bottom: -110px; border-color: rgba(240,100,73,.38); }
.auth-panel { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(100%, 410px); }
.auth-logo { margin-bottom: 68px; }
.auth-card h2 { margin: 10px 0 7px; font: 700 43px/1 var(--serif); letter-spacing: -1.5px; }
.stack { display: grid; gap: 17px; margin-top: 32px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; }
input { width: 100%; border: 1px solid var(--line); background: #fffefa; border-radius: 13px; padding: 14px 15px; color: var(--ink); outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240,100,73,.12); }
.profile-shell { width: min(100% - 32px, 1020px); margin: 0 auto; padding: 70px 0 110px; }
.profile-head { position: relative; display: flex; align-items: center; gap: 28px; padding: 0 15px 50px; }
.profile-head h1 { font-size: clamp(42px, 7vw, 66px); }
.profile-head p:last-child { color: var(--muted); margin: 9px 0 0; }
.profile-avatar { width: 118px; height: 118px; flex: 0 0 auto; font: 700 50px var(--serif); box-shadow: 0 0 0 7px var(--paper), 0 0 0 8px #c7c0b5; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.profile-tile { aspect-ratio: 1; overflow: hidden; background: #e5dfd5; }
.profile-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.profile-tile:hover img { transform: scale(1.025); }
.profile-empty { grid-column: 1/-1; padding: 80px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 20px; }
.account-menu { margin-left: auto; align-self: flex-start; position: relative; }
.account-menu summary { cursor: pointer; padding: 10px 15px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; font-weight: 700; list-style: none; }
.account-menu[open] { width: 190px; padding: 10px; background: var(--card); border-radius: 15px; box-shadow: var(--shadow); }
.account-menu[open] summary { border: 0; padding: 5px 7px 10px; color: var(--muted); }
.settings-row { width: 100%; display: flex; align-items: center; justify-content: space-between; border: 0; background: transparent; padding: 10px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.settings-row:hover { background: #f2ece3; }
.settings-row svg { width: 17px; }
.invite-card form { margin: 25px 0; }
.invite-card h2 { margin: 45px 0 15px; font: 700 25px var(--serif); }
.invite-reveal { margin-top: 24px; padding: 20px; background: #eef2eb; border: 1px solid #d3ddd0; border-radius: 16px; }
.invite-reveal p { margin: 0 0 10px; font-size: 13px; font-weight: 700; }
.invite-reveal small { display: block; margin-top: 9px; color: var(--muted); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; }
.invite-list { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--line); }
.invite-list li { display: flex; align-items: center; gap: 13px; padding: 16px 3px; border-bottom: 1px solid var(--line); }
.invite-list li div { display: grid; gap: 3px; }
.invite-list strong { font-size: 14px; }
.invite-list small { color: var(--muted); font-size: 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #aaa; }
.status-dot.open { background: #4f9b64; box-shadow: 0 0 0 4px #e2efe4; }
.status-dot.used { background: #aaa; }

@media (max-width: 760px) {
  body { padding-bottom: 76px; }
  .topbar { height: 66px; padding: 0 20px; }
  .desktop-nav { display: none; }
  .mobile-nav {
    position: fixed; z-index: 30; display: grid; grid-template-columns: repeat(3, 1fr); left: 0; right: 0; bottom: 0;
    height: calc(68px + env(safe-area-inset-bottom)); padding: 6px 20px env(safe-area-inset-bottom);
    background: rgba(255,253,249,.94); border-top: 1px solid var(--line); backdrop-filter: blur(18px);
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10px; font-weight: 700; }
  .mobile-nav a.active { color: var(--accent-dark); }
  .mobile-nav .mobile-upload { width: 70px; height: 52px; align-self: center; justify-self: center; border-radius: 18px; background: var(--ink); color: white; }
  .feed-shell { width: 100%; padding-top: 38px; }
  .feed-intro { padding: 0 20px 30px; align-items: start; }
  .feed-intro > p { display: none; }
  .feed-intro h1 { font-size: 43px; }
  .feed { gap: 14px; }
  .photo-card { border-left: 0; border-right: 0; border-radius: 0; }
  .photo-frame img { max-height: none; }
  .page-space { padding-top: 28px; }
  .upload-card, .invite-card { border-radius: 22px; padding: 25px 20px; }
  .drop-zone { min-height: 300px; }
  .auth-shell { display: block; }
  .auth-brand { display: none; }
  .auth-panel { min-height: calc(100vh - 76px); padding: 28px 24px; align-items: center; }
  .auth-logo { margin-bottom: 60px; }
  .profile-shell { width: 100%; padding-top: 40px; }
  .profile-head { gap: 18px; padding: 0 20px 35px; flex-wrap: wrap; }
  .profile-avatar { width: 84px; height: 84px; font-size: 36px; }
  .profile-head h1 { font-size: 40px; letter-spacing: -1.5px; }
  .profile-grid { gap: 2px; }
  .account-menu { width: 100%; margin-left: 102px; }
  .account-menu[open] { margin-left: 0; }
  .copy-row { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
