:root {
  --primary: #294d3e;
  --accent: #c9765c;
  --background: #f7f3e9;
  --surface: #fff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #00000012;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.topbar {
  height: 68px;
  padding: 0 max(28px, calc((100vw - 1120px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 9;
  background: color-mix(in srgb, var(--background) 80%, white);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.identity img { width: 34px; height: 34px; object-fit: contain; border-radius: 9px; }
.identity strong { font-size: 16px; font-weight: 650; letter-spacing: -.035em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-button { border: 0; background: transparent; color: var(--primary); font-size: 14px; font-weight: 650; padding: 10px 0; }
.text-button:hover { opacity: .7; }
.demo-banner { padding: 7px 20px; text-align: center; background: var(--primary); color: white; font-size: 12px; }
main { max-width: 1120px; margin: auto; padding: 38px 28px 120px; }

h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(38px, 5vw, 60px); line-height: 1.05; letter-spacing: -.065em; font-weight: 700; margin-bottom: 10px; }
h2 { font-size: 21px; line-height: 1.2; letter-spacing: -.04em; font-weight: 680; }
.subtle, .auth-card p, .upload-prompt p, .sheet p { color: var(--muted); }
.eyebrow { margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .025em; color: var(--accent); }

.button {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 18px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  transition: transform .16s, background .16s, box-shadow .16s;
}
.button:not(:disabled):active { transform: scale(.97); }
.primary { background: var(--primary); color: #fff; box-shadow: 0 5px 14px color-mix(in srgb, var(--primary) 20%, transparent); }
.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 85%, black); }
.outline { background: color-mix(in srgb, var(--primary) 7%, white); color: var(--primary); }
.outline:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 13%, white); }
.quiet { background: transparent; color: var(--primary); }
.quiet:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 7%, white); }
.full { width: 100%; display: block; }
.error { color: #b42318 !important; }

.tabs { display: flex; align-items: center; gap: 30px; margin-bottom: 54px; border-bottom: 1px solid var(--line); }
.tab { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 0 2px 16px; color: var(--muted); font-size: 14px; font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }
.home-heading, .section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-head { margin-bottom: 30px; }
.quota-badge { flex: none; padding: 9px 14px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 9%, white); color: var(--primary); font-size: 13px; font-weight: 650; white-space: nowrap; }
.upload-prompt {
  margin: 34px 0 52px;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 8px 35px #0000000a;
}
.upload-prompt strong { display: block; margin-bottom: 2px; font-size: 21px; font-weight: 670; letter-spacing: -.045em; }
.upload-prompt p { margin: 0; font-size: 14px; }
.section-title { margin: 0 0 20px; font-size: 22px; }
.see-all { display: block; margin: 25px auto 0; }
.empty { margin: 0; padding: 75px 20px; border-radius: 22px; text-align: center; color: var(--muted); background: var(--surface); }

.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.photo-card { display: block; min-width: 0; padding: 0; overflow: hidden; border: 1px solid #00000008; border-radius: 18px; background: var(--surface); text-align: left; box-shadow: 0 5px 18px #0000000a; transition: transform .2s, box-shadow .2s; }
.photo-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px #00000015; }
.photo-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-caption { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px 14px; }
.photo-caption strong, .photo-caption time { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-caption strong { font-size: 13px; font-weight: 650; }
.photo-caption time { font-size: 12px; color: var(--muted); }

.filters { display: flex; align-items: center; gap: 9px; margin: 0 0 28px; }
.filter { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; }
.filter.active { border-color: var(--primary); background: var(--primary); color: white; }
.date-filter { margin-left: auto; color: var(--muted); font-size: 13px; }
.date-filter input { margin-left: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
#gallery-more { display: block; margin: 25px auto; }

.auth-screen { min-height: calc(100dvh - 180px); display: grid; place-items: center; }
.auth-card { width: min(100%, 430px); padding: 42px; border-radius: 28px; background: var(--surface); text-align: center; box-shadow: 0 24px 70px #00000010; }
.auth-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 26px; border-radius: 20px; background: color-mix(in srgb, var(--primary) 9%, white); color: var(--primary); font-size: 32px; }
.auth-card h1 { font-size: 36px; }
.auth-card p { font-size: 14px; }
.auth-card form { margin-top: 25px; text-align: left; }
.auth-card label, .panel label { display: block; margin: 16px 0; font-size: 13px; font-weight: 650; }
.auth-card input, .panel input:not([type=color]):not([type=file]), .panel select {
  display: block;
  width: 100%;
  height: 48px;
  margin-top: 7px;
  padding: 10px 14px;
  border: 1px solid #00000020;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.auth-card input:focus, .panel input:focus, .panel select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 13%, transparent); }
.auth-card .button { margin-top: 14px; }
#join-form { margin: 24px 0 8px; text-align: left; }
#join-form details { margin: 17px 0; color: var(--muted); font-size: 13px; }
#join-form summary { cursor: pointer; }
#admin-entry { margin-top: 15px; }

.admin-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0 0 20px; }
.panel { min-width: 0; padding: 30px; border-radius: 24px; background: var(--surface); box-shadow: 0 8px 30px #0000000a; }
.panel h2 { margin: 0 0 14px; }
.panel .subtle { font-size: 14px; }
.invite-panel .qr-image { display: block; width: 205px; max-width: 100%; margin: 24px auto; border: 12px solid white; border-radius: 18px; box-shadow: 0 8px 30px #00000012; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-actions .button { font-size: 12px; }
.color-fields { display: flex; gap: 18px; flex-wrap: wrap; }
.color-fields input { display: block; width: 58px; height: 39px; margin-top: 6px; padding: 0; border: 0; background: transparent; }
.logo-label { margin-top: 22px !important; }
.logo-label input { display: block; width: 100%; margin-top: 8px; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info small { color: var(--muted); }
.user-actions { display: flex; gap: 7px; }
.user-row .button { white-space: nowrap; }
.user-row input { width: 65px !important; margin: 0 !important; }
.user-row .inactive { opacity: .5; }

.sheet, .viewer { width: min(430px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 28px; overflow: auto; border: 0; border-radius: 25px; background: var(--surface); color: var(--text); box-shadow: 0 28px 80px #0004; }
.sheet::backdrop, .viewer::backdrop { background: #13171ab0; backdrop-filter: blur(8px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.dialog-header h2 { margin: 0; }
.close, .viewer-close { border: 0; background: transparent; font-size: 30px; line-height: 1; }
.choice { display: flex; justify-content: space-between; width: 100%; margin-top: 10px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.choice:hover { background: color-mix(in srgb, var(--primary) 5%, white); }
.review-frame { display: grid; place-items: center; max-height: 50dvh; margin: 19px 0; overflow: hidden; border-radius: 14px; background: var(--background); }
.review-frame img { max-width: 100%; max-height: 50dvh; object-fit: contain; }
.review-sheet .button { margin-top: 9px; }
.viewer { width: min(900px, calc(100% - 24px)); padding: 14px; background: #171717; overflow: hidden; }
.viewer img { display: block; max-width: 100%; max-height: calc(100dvh - 100px); margin: auto; border-radius: 8px; }
.viewer-close { display: block; margin-left: auto; color: white; }
.viewer-caption { display: flex; justify-content: space-between; gap: 12px; padding: 14px 6px 3px; color: white; font-size: 14px; }
.viewer-caption time { color: #ccc; white-space: nowrap; }
.qr-image { display: block; width: min(250px, 100%); margin: 14px auto; }
.admin-code { display: block; margin: 20px 0; padding: 17px; border-radius: 12px; background: var(--background); word-break: break-all; text-align: center; font-size: 16px; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 20; max-width: calc(100% - 24px); padding: 12px 18px; transform: translateX(-50%); border-radius: 12px; background: #252529; color: white; box-shadow: 0 10px 30px #0003; }
.mobile-nav { display: none; }

@media (max-width: 700px) {
  .topbar { height: 60px; padding: 0 20px; }
  main { padding: 34px 20px 115px; }
  h1 { font-size: 42px; }
  .tabs { display: none; }
  .home-heading, .section-head { align-items: start; flex-direction: column; gap: 13px; }
  .section-head { margin-bottom: 25px; }
  .upload-prompt { align-items: start; flex-direction: column; gap: 18px; margin: 30px 0 42px; padding: 24px; }
  .upload-prompt strong { font-size: 20px; }
  .upload-prompt .button { width: 100%; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .photo-card { border-radius: 15px; }
  .photo-caption { padding: 10px 11px 12px; }
  .photo-caption strong { font-size: 12px; }
  .photo-caption time { font-size: 10px; }
  .admin-layout { grid-template-columns: 1fr; }
  .panel { padding: 24px; }
  .user-row { align-items: start; flex-wrap: wrap; }
  .user-actions { width: 100%; flex-wrap: wrap; }
  .filters { flex-wrap: wrap; }
  .date-filter { width: 100%; margin: 8px 0 0; }
  .auth-screen { min-height: calc(100dvh - 150px); }
  .auth-card { padding: 30px 25px; }
  .mobile-nav:not([hidden]) { display: flex; position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; z-index: 10; align-items: center; justify-content: space-around; min-height: 64px; padding: 7px; border: 1px solid #ffffff80; border-radius: 22px; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 10px 35px #00000025; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
  .mobile-nav button { min-width: 0; padding: 10px 11px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
  .mobile-nav button.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, white); }
  .mobile-nav .upload-trigger { padding: 11px 16px; border-radius: 15px; background: var(--primary); color: white; box-shadow: 0 5px 14px color-mix(in srgb, var(--primary) 20%, transparent); }
}
@media (max-width: 370px) {
  .photo-caption time { font-size: 9px; }
  .mobile-nav button { font-size: 12px; padding: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
