:root {
  color-scheme: light;
  font-family: "DM Sans", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color: #252d29;
  background: #fcfaf5;
  --pine: #245344;
  --clay: #a6472b;
  --muted: #5b645b;
  --border: #dcded3;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #b76746;
  outline-offset: 3px;
}
h1, h2, p { margin: 0; }
h1, h2 { letter-spacing: -.05em; word-break: keep-all; }
h1 { font-size: clamp(1.9rem, 6vw, 2.7rem); line-height: 1.2; }
.masthead, main { width: min(100% - 2rem, 64rem); margin: auto; }
.masthead {
  min-height: 4.6rem; display: flex; justify-content: space-between;
  align-items: center; gap: .6rem; border-bottom: 1px solid var(--border);
}
.brand, #account { display: flex; align-items: center; gap: .55rem; }
.brand { font-size: 1.15rem; font-weight: 750; letter-spacing: -.05em; white-space: nowrap; }
.brand-mark {
  display: grid; place-items: center; width: 1.85rem; height: 2.1rem;
  border: 1px solid var(--pine); border-left-width: 4px;
  background: #e1e9d9; color: var(--pine); border-radius: 3px 6px 6px 3px;
}
#account-name { font-size: .875rem; overflow: hidden; text-overflow: ellipsis; max-width: 13rem; white-space: nowrap; }
.small-button, .primary, .tab {
  border: 1px solid transparent; border-radius: .7rem; font-weight: 650; min-height: 44px;
}
.small-button { padding: .45rem .8rem; border-color: var(--border); background: transparent; color: var(--pine); font-size: .875rem; }
.primary { padding: .6rem 1.1rem; color: #fff; background: var(--pine); white-space: nowrap; }
.primary:hover { background: #193f33; }
.small-button:hover, .tab:hover { background: #e9ede2; }
.hint, .notice, .optional, .intro, .empty p { color: var(--muted); line-height: 1.65; }
.hint, .notice, .optional { font-size: .9rem; }
.notice:empty { display: none; }
.notice:not(:empty) { margin: .8rem 0; }
.error { color: #9f3424; }
#welcome {
  min-height: calc(88svh - 4.6rem); display: flex; justify-content: center;
  align-items: center; gap: clamp(3rem, 9vw, 7.5rem); padding: 4rem 0;
}
.album-cover {
  position: relative; width: clamp(11rem, 24vw, 17rem); aspect-ratio: .8;
  background: repeating-linear-gradient(90deg, #e6a982 0 1px, #e3a47f 1px 3px);
  border-radius: .3rem .9rem .9rem .3rem; transform: rotate(-7deg);
  box-shadow: 4px 4px 0 #f7eddb, 6px 6px 0 #7a5742, 12px 22px 30px #50391c21;
  display: grid; place-items: center;
}
.cover-binding { position: absolute; inset: 0 auto 0 0; width: 12%; background: #36574a; border-radius: .3rem 0 0 .3rem; }
.cover-frame { width: 51%; aspect-ratio: 1; display: grid; place-items: center; border: .22rem double #6f4033; color: #6f4033; font: 3.5rem Georgia, serif; }
.intro { margin: 1.1rem 0 1.8rem; font-size: 1.12rem; }
.hint { margin: .8rem 0; max-width: 27rem; }
.tabs { display: flex; width: fit-content; gap: .25rem; margin: 1.4rem 0 2rem; padding: .25rem; background: #eeefe7; border-radius: .9rem; }
.tab { padding: .4rem 1.15rem; background: transparent; color: var(--muted); }
.tab[aria-current="page"] { color: var(--pine); background: white; box-shadow: 0 1px 4px #28352416; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.memory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: 1.25rem; padding-bottom: 3rem; }
.memory { background: #fff; border: 1px solid var(--border); padding: .65rem; border-radius: .95rem; overflow: hidden; }
.memory img, .memory video { display: block; width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #eeefe9; border-radius: .55rem; }
.memory p { padding: .8rem .3rem .2rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.meta { display: block; font-size: .85rem; color: var(--muted); line-height: 1.6; }
.memory .meta { margin: .55rem .3rem .3rem; }
.empty { padding: 3rem 1rem; border-block: 1px dashed var(--border); text-align: center; }
.empty-art { color: var(--clay); font: 2.4rem Georgia, serif; }
.empty h2 { font-size: 1.26rem; margin: .6rem 0 .25rem; }
.connection { font-size: .875rem; color: var(--pine); }
.chat-card { border: 1px solid var(--border); border-radius: 1rem; background: #f6f6ee; overflow: hidden; }
.message-list { height: clamp(12rem, 50dvh, 34rem); overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.message-list .chat-empty { margin: auto; color: var(--muted); font-size: .95rem; }
.message { align-self: flex-start; max-width: 80%; }
.message.mine { align-self: flex-end; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; padding: .65rem .85rem; background: #fff; border: 1px solid #daded2; border-radius: .8rem .8rem .8rem .1rem; line-height: 1.55; }
.mine p { color: #fff; background: var(--pine); border-color: var(--pine); border-radius: .8rem .8rem .1rem .8rem; }
.message .meta { margin-bottom: .15rem; }
.mine .meta { text-align: right; }
.composer { display: flex; gap: .6rem; align-items: flex-end; padding: .75rem; background: #fff; border-top: 1px solid var(--border); }
textarea { width: 100%; padding: .75rem; resize: vertical; background: #fff; color: inherit; border: 1px solid #aeb6aa; border-radius: .65rem; }
.composer textarea { min-height: 44px; max-height: 9rem; }
dialog { width: min(92vw, 28rem); padding: 1.4rem; border: 1px solid var(--border); border-radius: 1rem; background: #fcfaf5; color: inherit; }
dialog::backdrop { background: #1b2724a3; }
dialog label { display: block; font-weight: 650; margin: 1rem 0 .5rem; }
input[type=file] { max-width: 100%; }
input[type=file]::file-selector-button { padding: .55rem .7rem; border: 1px solid var(--border); border-radius: .5rem; background: #fff; margin-right: .5rem; }
dialog form > .primary { width: 100%; margin-top: 1rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 640px) {
  #welcome { flex-direction: column; gap: 2.5rem; padding: 3rem 0; text-align: center; }
  #google-button { display: grid; justify-content: center; }
  .album-cover { width: 8rem; } .cover-frame { font-size: 2.2rem; }
  #account-name { max-width: 5rem; }
  .tabs { width: 100%; margin: 1rem 0 1.5rem; }
  .tab { flex: 1; }
  .section-head { margin-bottom: 1rem; gap: .5rem; }
  .section-head .primary { font-size: .9rem; }
  main { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
}
