:root {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: #16263a;
  background: #f3f5f9;
  --muted: #536172;
  --line: #dde3ea;
  --teal: #286775;
  --teal-light: #e3eff2;
  --white: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid #408898; outline-offset: 3px; }
svg { width: 20px; height: 20px; flex-shrink: 0; vertical-align: middle; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 2.55rem); line-height: 1.22; letter-spacing: -.07em; }
h2 { font-size: 1.24rem; letter-spacing: -.045em; }
p { line-height: 1.6; }
.layout { display: grid; min-height: 100dvh; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { background: var(--white); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 25px 18px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.05em; font-size: 1.29rem; }
.brand-mark { width: 39px; height: 39px; border-radius: 11px; display: grid; place-items: center; background: var(--teal); color: #fff; }
.brand-mark svg { width: 23px; height: 23px; }
.sidebar .brand { margin: 9px 9px 33px; }
nav { display: grid; gap: 5px; }
nav a { display: flex; gap: 11px; align-items: center; min-height: 44px; border-radius: 10px; padding: 8px 12px; font-size: .87rem; font-weight: 650; text-decoration: none; color: var(--muted); white-space: nowrap; }
nav a:hover { background: #f0f4f7; }
nav a[aria-current="page"] { color: #184f5b; background: var(--teal-light); }
.sidebar-footer { margin-top: auto; padding: 16px 9px 0; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .8rem; }
.topbar { height: 76px; background: var(--white); border-bottom: 1px solid var(--line); padding: 0 clamp(22px, 4vw, 48px); display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.crumb { color: var(--muted); font-size: .86rem; font-weight: 700; }
main { max-width: 1420px; margin: auto; padding: 38px clamp(22px, 4vw, 48px) 56px; }
.page-head { display:flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 29px; }
.page-head p { color: var(--muted); margin-top: 9px; }
.back { display: inline-block; margin-bottom: 13px; font-weight: 700; text-decoration: none; }
.primary, .secondary { justify-content: center; align-items: center; display: inline-flex; min-height: 43px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: #243449; font-size: .9rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.primary:hover { background: #1d5260; }
.secondary:hover { background: #f0f4f7; }
.section-head { margin: 0 0 13px; display: flex; align-items: center; gap: 10px; }
.section-head span { font-size: .76rem; border-radius: 20px; padding: 3px 8px; background: var(--teal-light); color: #214f5a; }
.folders { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.folder { overflow: hidden; text-decoration: none; display: block; border: 1px solid var(--line); border-radius: 15px; background: var(--white); color: inherit; }
.folder:hover { border-color: #6595a0; box-shadow: 0 4px 15px #24475814; }
.cover { width: 100%; height: 110px; display: grid; place-items: center; background: #e5f0f2; color: #286775; }
.folder:nth-child(2) .cover { background: #f4ebdf; color: #865d2c; }
.folder:nth-child(3) .cover { background: #e9e9f5; color: #625789; }
.folder:nth-child(4) .cover { background: #e6efe7; color: #3a6950; }
.cover svg { width: 37px; height: 37px; }
.cover img { width: 100%; height: 110px; object-fit: cover; }
.folder-info { padding: 15px 14px 14px; }
.folder-info h3 { font-size: .96rem; letter-spacing: -.035em; overflow-wrap: anywhere; }
.folder-info p { font-size: .78rem; color: var(--muted); margin-top: 5px; }
.recent { margin-top: 33px; }
.folder-section + .folder-section { margin-top: 28px; }
.invite-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 15px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.invite-row h3 { font-size: .97rem; }
.invite-row p { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.invite-row > .status { flex-basis: 100%; margin: 0; }
.empty { border: 1px dashed #b9c7d2; background: var(--white); border-radius: 13px; text-align: center; padding: 38px 18px; display: grid; gap: 9px; justify-items: center; }
.empty > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; color: var(--teal); background: var(--teal-light); }
.empty p { color: var(--muted); font-size: .89rem; }
.empty h3 { font-size: 1.05rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.day { margin-top: 24px; }
.day:first-child { margin-top: 0; }
.day h2 { font-size: 1rem; margin: 0 0 10px; }
.photo { border: 1px solid var(--line); background: var(--white); border-radius: 12px; overflow: hidden; padding: 0; text-align: left; color: inherit; }
.photo img { width: 100%; aspect-ratio: 1.2; display: block; object-fit: cover; background: var(--teal-light); }
.photo span { padding: 8px 10px; font-size: .8rem; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.photo-card-title { display: block; padding: 9px 10px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-card-title:last-child { padding-bottom: 9px; }
.more { margin: 20px auto 0; display: flex; }
.gate { min-height: 100dvh; display: grid; align-items: center; justify-items: center; padding: 22px; }
.gate-card { width: min(100%, 425px); background: var(--white); border: 1px solid var(--line); border-radius: 19px; padding: clamp(24px, 6vw, 38px); box-shadow: 0 12px 34px #273a5010; }
.gate-card h1 { margin-top: 24px; font-size: 2rem; }
.gate-card > p { color: var(--muted); margin: 8px 0 22px; }
.gate-card .primary { width: 100%; margin-top: 16px; }
form label { display: block; font-size: .89rem; font-weight: 700; margin-bottom: 6px; }
input, select, textarea { width: 100%; min-height: 43px; border: 1px solid #becad5; border-radius: 9px; padding: 9px 10px; background: var(--white); color: inherit; }
textarea { resize: vertical; }
input[type="file"] { font-size: .87rem; }
small { color: var(--muted); }
.error, .status { font-size: .86rem; margin: 10px 0 0; }
.error { color: #9a302a; }
.error:empty, .status:empty { display: none; }
#page-error { margin: 0 0 16px; }
dialog { width: min(calc(100vw - 28px), 480px); max-height: calc(100dvh - 36px); border: 1px solid var(--line); border-radius: 16px; padding: 22px; color: inherit; background: var(--white); }
dialog::backdrop { background: #14243abb; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.icon-button { border: 0; border-radius: 8px; display: grid; place-items: center; background: #edf2f6; color: inherit; width: 40px; height: 40px; font-size: 1.4rem; }
dialog form label:not(:first-child) { margin-top: 14px; }
dialog form > .primary { width: 100%; margin-top: 16px; }
#lightbox { width: min(calc(100vw - 28px), 820px); }
#lightbox img { display: block; width: 100%; max-height: 67dvh; object-fit: contain; border-radius: 8px; background: #edf2f6; }
.photo-detail { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.photo-detail p { overflow-wrap: anywhere; white-space: pre-wrap; }
.photo-date { color: var(--muted); font-size: .85rem; margin-top: 4px; }
#photo-title { overflow-wrap: anywhere; }
.photo-draft { min-width: 0; padding: 0 11px 12px; margin: 12px 0 0; border: 1px solid var(--line); border-radius: 10px; }
.photo-draft legend { padding: 0 5px; max-width: 100%; overflow-wrap: anywhere; font-size: .84rem; font-weight: 700; }
.photo-draft small { display: block; margin-top: 4px; }
.comment-section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.comment-section form { display: flex; align-items: end; gap: 8px; margin-top: 9px; }
.comment-section form > .primary { width: auto; margin-top: 0; }
.comment-section #comment-list { list-style: none; margin: 0; padding: 0; }
.comment { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.comment-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.comment time { color: var(--muted); font-size: .78rem; }
.comment p { white-space: pre-wrap; overflow-wrap: anywhere; }
#more-comments { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1040px) {
  .folders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .layout { display: flex; flex-direction: column; }
  .sidebar { position: static; height: auto; padding: 13px 0 8px; border-right: 0; }
  .sidebar .brand { margin: 0 16px 12px; }
  .sidebar-footer { display: none; }
  nav { display: flex; overflow-x: auto; padding: 0 13px 4px; }
  nav a { min-height: 40px; padding: 8px; gap: 4px; font-size: .8rem; }
  nav svg { width: 16px; height: 16px; }
  .topbar { height: 57px; padding: 0 16px; border-top: 1px solid var(--line); }
  main { padding: 24px 16px 40px; }
  .page-head { align-items: start; flex-direction: column; gap: 12px; margin-bottom: 21px; }
  .folders { gap: 10px; }
  .folder-info { padding: 11px; }
  .cover, .cover img { height: 84px; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
