[hidden] { display: none !important; }

:root {
  --paper: #f6efe4;
  --card: #fffaf2;
  --ink: #2b2420;
  --mute: #8a7d70;
  --line: #e6dccd;
  --sea: #1f7a7a;
  --sea-soft: #d5ebe6;
  --sun: #e07a4f;
  --sun-soft: #f8dccd;
  --sand: #efe2cc;
  --danger: #b9473a;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1714;
    --card: #26201c;
    --ink: #f3ebe0;
    --mute: #a69a8c;
    --line: #3a322c;
    --sea: #5fb8ae;
    --sea-soft: #1f3532;
    --sun: #ef9470;
    --sun-soft: #3d2a22;
    --sand: #302823;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select {
  font: inherit; color: var(--ink);
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px; /* prevent iOS zoom */
}
textarea { resize: vertical; min-height: 80px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--sea); outline-offset: 0; border-color: transparent; }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--mute); font-weight: 500; }

.brand { font-family: "Fraunces", serif; font-style: italic; font-weight: 600; font-size: 44px; margin: 0; letter-spacing: -.01em; }
.brand--small { font-size: 26px; }
.muted { color: var(--mute); }
.error { color: var(--danger); font-size: 14px; margin: 0; }
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

/* Buttons */
.btn {
  border: 1px solid transparent; border-radius: 999px;
  padding: 12px 18px; font-weight: 600; font-size: 15px;
  background: var(--sand); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn--primary { background: var(--sea); color: #fff; }
.btn--sun { background: var(--sun); color: #fff; }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn--sm { padding: 7px 13px; font-size: 14px; }
.btn--icon { width: 46px; height: 46px; padding: 0; font-size: 24px; flex: none; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--sea); padding: 8px; font-size: 14px; }
.link--danger { color: var(--danger); }

/* Screens */
.screen.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 360px; display: grid; gap: 14px; text-align: center; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: var(--sun-soft); color: var(--sun); font-weight: 600;
}
main { padding: 0 16px calc(110px + var(--safe-b)); max-width: 900px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 12px; gap: 12px; }
.view-title { font-family: "Fraunces", serif; font-weight: 400; font-size: 32px; margin: 0; }
.empty { text-align: center; color: var(--mute); padding: 40px 12px; }

/* Chips */
.chips { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 6px 12px; font-size: 14px; white-space: nowrap;
}
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .count { opacity: .6; margin-left: 4px; }

/* Plan grid */
.plan-grid { columns: 2; column-gap: 12px; }
@media (min-width: 640px) { .plan-grid { columns: 3; } }
.plan-card {
  break-inside: avoid; margin-bottom: 12px; width: 100%;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 0; padding: 0; text-align: left; display: block;
}
.plan-card__img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--sand); }
.plan-card__noimg {
  aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 44px;
  background: linear-gradient(135deg, var(--sea-soft), var(--sun-soft));
}
.plan-card__body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.plan-card__title { font-family: "Fraunces", serif; font-size: 17px; line-height: 1.2; font-weight: 600; }
.plan-card__meta { font-size: 12.5px; color: var(--mute); display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11.5px; border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.badge--planned { background: var(--sea-soft); color: var(--sea); }
.badge--done { background: var(--sun-soft); color: var(--sun); }

/* Tasks */
.quick-add { display: flex; gap: 8px; margin-bottom: 14px; }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.task {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow);
}
.task__check {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 2px solid var(--line); background: transparent; display: grid; place-items: center; font-size: 14px; color: #fff;
}
.task.is-done .task__check { background: var(--sea); border-color: var(--sea); }
.task.is-done .task__title { text-decoration: line-through; color: var(--mute); }
.task__main { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 0; }
.task__title { display: block; overflow-wrap: anywhere; }
.task__meta { font-size: 12.5px; color: var(--mute); }
.task__meta .overdue { color: var(--danger); font-weight: 600; }
.who {
  flex: none; border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 4px 10px; font-size: 12.5px; color: var(--mute);
}
.who.is-set { background: var(--sun-soft); color: var(--sun); border-color: transparent; font-weight: 600; }
.done-group { margin-top: 18px; }
.done-group summary { color: var(--mute); padding: 8px 0; cursor: pointer; }
.task-list--done .task { box-shadow: none; background: transparent; border: 1px dashed var(--line); }

/* Album */
.month { margin-bottom: 22px; }
.month h3 { font-family: "Fraunces", serif; font-style: italic; font-weight: 400; font-size: 20px; margin: 0 0 8px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 640px) { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.photo-grid button { border: 0; padding: 0; background: var(--sand); aspect-ratio: 1; overflow: hidden; border-radius: 6px; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }

/* FAB + tabbar */
.fab {
  position: fixed; right: 18px; bottom: calc(84px + var(--safe-b)); z-index: 20;
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--sun); color: #fff; font-size: 30px; box-shadow: 0 8px 24px rgba(224, 122, 79, .4);
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 6px 8px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  border: 0; background: none; padding: 6px; font-size: 12px; color: var(--mute);
  display: grid; justify-items: center; gap: 2px; font-weight: 500;
}
.tabbar .tab-ico { font-size: 20px; filter: grayscale(1); opacity: .6; }
.tabbar .is-active { color: var(--ink); }
.tabbar .is-active .tab-ico { filter: none; opacity: 1; }

/* Sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 14, 10, .45); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(22px + var(--safe-b));
  max-width: 640px; margin: 0 auto;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet__grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { font-family: "Fraunces", serif; font-weight: 600; font-size: 26px; margin: 0 0 4px; line-height: 1.15; }
.sheet__body { display: grid; gap: 14px; }
.sheet__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.sheet__actions .spacer { flex: 1; }

.cover-pick {
  position: relative; border: 2px dashed var(--line); border-radius: var(--radius);
  min-height: 120px; display: grid; place-items: center; color: var(--mute); overflow: hidden; cursor: pointer;
}
.cover-pick img { width: 100%; max-height: 300px; object-fit: cover; }
.detail-cover { max-width: none; width: calc(100% + 36px); margin: -8px -18px 0; max-height: 52dvh; object-fit: cover; border-radius: 22px 22px 0 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--sand); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 9px 4px; font-size: 14px; font-weight: 500; }
.seg button.is-on { background: var(--card); box-shadow: var(--shadow); }
.notes { white-space: pre-wrap; margin: 0; }
.ext-link {
  display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-radius: 12px;
  background: var(--card); color: var(--sea); text-decoration: none; font-weight: 600; overflow: hidden;
}
.ext-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mute); font-weight: 400; font-size: 13px; }
.memory-box { background: var(--sun-soft); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.memory-box h3 { margin: 0; font-family: "Fraunces", serif; font-style: italic; font-weight: 400; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: #000; color: #fff;
  display: grid; grid-template-rows: auto 1fr auto;
}
.lightbox__top { display: flex; justify-content: space-between; padding: calc(10px + var(--safe-t)) 12px 10px; }
.lightbox__top button { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 999px; padding: 8px 14px; }
.lightbox__img { position: relative; min-height: 0; overflow: hidden; touch-action: pan-y; }
.lightbox__img img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.lightbox__info { padding: 12px 16px calc(16px + var(--safe-b)); display: grid; gap: 8px; }
.lightbox__info input { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; }
.lightbox__info .row { font-size: 13px; color: #bbb; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-b)); z-index: 80;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center;
}
.upload-bar {
  position: fixed; left: 16px; right: 16px; top: calc(64px + var(--safe-t)); z-index: 30;
  background: var(--sea); color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 14px; text-align: center;
}
.menu-item { display: flex; justify-content: space-between; align-items: center; padding: 14px; background: var(--card); border-radius: 12px; border: 0; width: 100%; text-align: left; }
.code { font-family: ui-monospace, monospace; font-size: 18px; letter-spacing: .1em; }
.random-card { text-align: center; display: grid; gap: 12px; }

/* Recuerdos: albums + gallery */
.seg--2 { grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.seg--2 button { padding: 11px 4px; font-size: 15px; }
.btn--block { width: 100%; margin-bottom: 18px; padding: 15px; font-size: 16px; }
.album-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
@media (min-width: 640px) { .album-grid { grid-template-columns: repeat(3, 1fr); } }
.album-card { border: 0; padding: 0; background: none; text-align: left; display: grid; gap: 4px; }
.album-card__cover {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius);
  background: var(--sand); box-shadow: var(--shadow);
}
.album-card__cover--empty { display: grid; place-items: center; font-size: 36px; }
.album-card__title { font-family: "Fraunces", serif; font-weight: 600; font-size: 16px; line-height: 1.2; margin-top: 4px; }
.album-card__count { font-size: 13px; color: var(--mute); }
.album-card--new .album-card__plus {
  aspect-ratio: 1; border: 2px dashed var(--line); border-radius: var(--radius);
  display: grid; place-items: center; font-size: 44px; color: var(--sun); background: var(--card);
}
.back-btn { border: 0; background: none; color: var(--sea); font-size: 17px; font-weight: 600; padding: 12px 0 4px; }
.album-head { margin: 4px 0 14px; }
.album-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.album-actions .btn { padding: 14px 10px; font-size: 16px; }
.album-actions .btn:only-child { grid-column: 1 / -1; }
.gallery { columns: 2; column-gap: 6px; }
@media (min-width: 640px) { .gallery { columns: 3; } }
.gallery button {
  display: block; width: 100%; margin: 0 0 6px; border: 0; padding: 0; border-radius: 10px;
  overflow: hidden; background: var(--sand); break-inside: avoid;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.album-footer { display: flex; gap: 10px; justify-content: center; margin-top: 26px; }
.big-choice {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; cursor: pointer; font-size: 16px;
}
.big-choice__ico { font-size: 30px; }
.photo-grid--pick button { position: relative; }
.pick-mark {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.25); color: transparent;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
}
.is-picked img { opacity: .75; }
.is-picked .pick-mark { background: var(--sea); color: #fff; }
.sheet__actions--sticky { position: sticky; bottom: calc(-22px - var(--safe-b)); background: var(--paper); padding: 12px 0 calc(8px + var(--safe-b)); }

/* Lightbox extras */
.lightbox__count { align-self: center; font-size: 14px; color: #bbb; }
.lightbox__img { user-select: none; }
.lightbox__img img { animation: fadein .35s ease; }
@keyframes fadein { from { opacity: 0; } }
.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 64px; border: 0; border-radius: 12px; font-size: 34px; line-height: 1;
  background: rgba(0,0,0,.35); color: #fff;
}
.lb-arrow--prev { left: 8px; }
.lb-arrow--next { right: 8px; }
.is-playing .lb-arrow { display: none; }
.lightbox__caption { margin: 0; font-family: "Fraunces", serif; font-style: italic; font-size: 20px; text-align: center; }
.lightbox__meta { font-size: 13px; color: #aaa; }
.lightbox__more { background: none; border: 0; color: #9fd3cb; font-size: 15px; padding: 4px 0; text-align: left; }
.lb-field { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; font-size: 14px; color: #bbb; }
.lb-field select, .lb-field input { background: rgba(255,255,255,.1); border-color: transparent; color: #fff; padding: 9px 12px; }
.lb-field option { color: #000; }
.lb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lb-actions button, .lb-actions a {
  background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 999px; padding: 9px 14px;
  font-size: 14px; text-decoration: none;
}
.lb-actions .danger { color: #ff9c8f; }
