:root {
  --bg: #fbf6ef; --card: #fff; --ink: #3b2f2a; --muted: #8a7a70;
  --accent: #c8643b; --accent-dark: #a54e2b; --soft: #f3e6d8; --radius: 14px;
  --shadow: 0 2px 10px rgba(80, 50, 30, .08);
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.site-header { background: linear-gradient(135deg, #c8643b, #e3a15b); color: #fff; padding-top: 18px; box-shadow: var(--shadow); }
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 2rem; letter-spacing: .5px; }
.tagline { margin: 2px 0 0; opacity: .9; }
.auth-box { display: flex; align-items: center; gap: 8px; }
.pill { font-size: .85rem; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.2); }
.pill.unlocked { background: rgba(255,255,255,.95); color: var(--accent-dark); }
.tabs { display: flex; gap: 4px; margin-top: 14px; }
.tab { background: transparent; border: 0; color: #fff; font-size: 1rem; padding: 10px 16px; border-radius: 10px 10px 0 0; cursor: pointer; opacity: .85; }
.tab.active { background: var(--bg); color: var(--ink); opacity: 1; font-weight: 600; }
main.wrap { padding: 20px 16px 40px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card h2, dialog h2 { margin: 0 0 10px; font-family: Georgia, serif; font-weight: normal; }
input[type=text], input[type=password], textarea { width: 100%; padding: 11px 12px; border: 1px solid #e2d3c4; border-radius: 10px; font: inherit; background: #fffdfa; margin-bottom: 10px; }
textarea { resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-light { background: rgba(255,255,255,.9); color: var(--accent-dark); }
.btn-light:hover { background: #fff; }
.file-drop { display: block; border: 2px dashed #e0bfa5; border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 10px; background: #fffaf4; }
.file-drop.drag { background: var(--soft); }
.file-drop input { display: none; }
.progress { position: relative; height: 26px; background: var(--soft); border-radius: 8px; overflow: hidden; margin-top: 12px; }
.progress .bar { height: 100%; width: 0; background: #e3a15b; transition: width .2s; }
.progress .ptext { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.note { background: var(--soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; color: #6b5548; font-size: .95rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--soft); cursor: pointer; box-shadow: var(--shadow); border: 0; padding: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.tile:hover img { transform: scale(1.04); }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: .8rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .noimg { display: flex; height: 100%; align-items: center; justify-content: center; font-size: 2rem; }
.messages { display: flex; flex-direction: column; gap: 12px; }
.msg { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-left: 4px solid #e3a15b; }
.msg .who { font-weight: 600; }
.meta { color: var(--muted); font-size: .85rem; }
.msg .body { white-space: pre-wrap; margin-top: 4px; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.footer { text-align: center; color: var(--muted); font-size: .9rem; padding-bottom: 30px; }
dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(92vw, 380px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(40, 25, 15, .5); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .btn-light { background: var(--soft); }
.error { color: #b3261e; margin: 0 0 10px; }
.lightbox { position: fixed; inset: 0; background: rgba(20, 12, 8, .92); z-index: 50; display: flex; align-items: center; justify-content: center; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-width: 92vw; max-height: 72vh; border-radius: 8px; object-fit: contain; }
.lightbox figcaption { color: #fff; text-align: center; margin-top: 10px; }
.lightbox .meta { color: #d8c6b8; margin: 4px 0 10px; }
.lb-close, .lb-nav { position: absolute; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 44px; height: 44px; font-size: 1.5rem; cursor: pointer; }
.lb-close { top: 14px; right: 14px; }
.lb-prev { left: 10px; top: 50%; }
.lb-next { right: 10px; top: 50%; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #3b2f2a; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); }
@media (max-width: 560px) {
  h1 { font-size: 1.6rem; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 6px; }
  .lb-nav { top: auto; bottom: 14px; }
}
