/* Roba de llengües — Mallorca's "tongue fabric" ikat: indigo, coral, ochre on linen.
   Phone-first: everything is designed at 375–430px, then widened. */
:root {
  --indigo: #1f3a6b;
  --indigo-d: #142849;
  --coral: #d4553f;
  --ochre: #d9a23a;
  --linen: #f4ede0;
  --stone: #e8dfcf;
  --ink: #1d1c1a;
  --muted: #6d665b;
  --ok: #3f7d4e;
  --r: 14px;
  --ikat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='28' viewBox='0 0 48 28'%3E%3Crect width='48' height='28' fill='%231f3a6b'/%3E%3Cpath fill='%23d4553f' d='M0 14 6 10 8 11 12 6 14 7 18 3 24 0 30 3 34 7 36 6 40 11 42 10 48 14 42 18 40 17 36 22 34 21 30 25 24 28 18 25 14 21 12 22 8 17 6 18Z'/%3E%3Cpath fill='%23d9a23a' d='M8 14 14 11 16 12 20 8 24 6 28 8 32 12 34 11 40 14 34 17 32 16 28 20 24 22 20 20 16 16 14 17Z'/%3E%3Cpath fill='%23f4ede0' d='M16 14 20 12 24 10 28 12 32 14 28 16 24 18 20 16Z'/%3E%3Cpath fill='%231f3a6b' d='M21 14 24 12.5 27 14 24 15.5Z'/%3E%3C/svg%3E");
  font-size: 17px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--linen); color: var(--ink);
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--indigo); }
button, input, textarea { font: inherit; }
input, textarea { font-size: 16px; } /* ≥16px or iOS zooms on focus */

/* ---------- header ---------- */
.top { background: var(--indigo); color: var(--linen); padding-top: env(safe-area-inset-top); position: relative; }
.ikat { height: 28px; background: var(--ikat) repeat-x; background-size: 48px 28px; }
.ikat.thin { height: 14px; background-size: 24px 14px; }
.brand { display: block; padding: 14px 18px 6px; color: var(--linen); text-decoration: none; }
.brand-k { display: block; font-family: Georgia, "Iowan Old Style", serif; font-size: 2rem; font-weight: 700; letter-spacing: .01em; line-height: 1; }
.brand-s { display: block; font-size: .8rem; opacity: .8; margin-top: 4px; }
.nav { display: flex; gap: 6px; padding: 8px 14px 12px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--linen); text-decoration: none; padding: 12px 16px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 999px; background: rgba(255,255,255,.1); white-space: nowrap; font-size: .9rem; }
.nav a.on { background: var(--ochre); color: var(--indigo-d); font-weight: 700; }

main { max-width: 960px; margin: 0 auto; padding: 16px 14px 120px; }

/* ---------- upload ---------- */
.hello { font-family: Georgia, serif; font-size: 1.6rem; margin: 6px 0 2px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.notyou { background: none; border: 0; color: var(--indigo); text-decoration: underline; padding: 12px 0; min-height: 44px; font-size: .9rem; cursor: pointer; }

.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 24px; }
.who button {
  min-height: 56px; border-radius: var(--r); border: 2px solid var(--stone); background: #fff;
  font-size: 1.05rem; font-weight: 600; color: var(--ink); cursor: pointer;
}
.who button:active { border-color: var(--coral); background: #fff6f3; }

.puja {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 100%; min-height: 108px; border: 0; border-radius: 20px; cursor: pointer;
  background: var(--coral); color: #fff; box-shadow: 0 6px 0 #a63c2b; margin: 8px 0 18px;
  -webkit-tap-highlight-color: transparent;
}
.puja:active { transform: translateY(4px); box-shadow: 0 2px 0 #a63c2b; }
.puja b { font-size: 1.7rem; font-family: Georgia, serif; }
.puja span { font-size: .95rem; opacity: .95; }
.puja.ride { background: var(--indigo); box-shadow: 0 6px 0 var(--indigo-d); min-height: 64px; }
.puja.ride b { font-size: 1.2rem; }

.keepopen { background: var(--ochre); color: var(--indigo-d); border-radius: var(--r); padding: 12px 14px; margin: 0 0 14px; font-weight: 600; }
.keepopen small { display: block; font-weight: 400; }
.summary { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; font-weight: 600; }
.bar { flex: 1; height: 10px; border-radius: 99px; background: var(--stone); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .3s; }
.thanks { background: #e6f1e7; color: #24502f; border-radius: var(--r); padding: 14px; font-weight: 600; margin: 0 0 14px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: #fff; border-radius: var(--r); overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tile .ph { position: relative; aspect-ratio: 1; background: var(--stone); }
.tile .ph img, .tile .ph video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .st {
  position: absolute; inset: auto 8px 8px auto; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; color: #fff;
  background: conic-gradient(var(--ok) calc(var(--p, 0) * 1%), rgba(0,0,0,.45) 0);
}
.tile .st span { width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; font-size: .75rem; }
.tile.done .st, .tile.dup .st { background: var(--ok); }
.tile.done .st span, .tile.dup .st span { background: none; font-size: 1.2rem; }
.tile.retry .st, .tile.failed .st, .tile.toobig .st { background: var(--coral); }
.tile .msg { font-size: .78rem; color: var(--coral); padding: 6px 8px 0; }
.tile .msg.ok { color: var(--muted); }
.tile input { width: 100%; border: 0; border-top: 1px solid var(--stone); padding: 10px; background: #fff; }
.tile input::placeholder { color: #a39b8e; }

.help { margin: 28px 0 0; background: #fff; border-radius: var(--r); padding: 4px 16px; }
.help summary { padding: 12px 0; font-weight: 700; cursor: pointer; }
.help ol { padding-left: 20px; margin: 0 0 14px; }
.help li { margin: 6px 0; }

/* ---------- album ---------- */
.day { margin: 8px 0 30px; }
.dayhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; border-bottom: 3px solid var(--coral); padding-bottom: 6px; margin-bottom: 10px; }
.dayhead h2 { font-family: Georgia, serif; margin: 0; font-size: 1.5rem; color: var(--indigo); }
.dayhead h2 small { font-family: inherit; font-size: .9rem; color: var(--muted); font-weight: 400; }
.dayhead p { margin: 0; color: var(--muted); font-size: .9rem; width: 100%; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 5px; } }
.grid button { position: relative; padding: 0; border: 0; background: var(--stone); aspect-ratio: 1; cursor: pointer; overflow: hidden; }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .play { position: absolute; left: 6px; bottom: 6px; color: #fff; font-size: .75rem; background: rgba(0,0,0,.55); padding: 2px 6px; border-radius: 99px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty b { display: block; font-family: Georgia, serif; font-size: 1.4rem; color: var(--indigo); margin-bottom: 6px; }

.fab {
  position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 5;
  background: var(--coral); color: #fff; text-decoration: none; font-weight: 700;
  padding: 16px 22px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0,0,0,.25);
}

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; background: rgba(12,16,26,.96); z-index: 20; display: flex; flex-direction: column; color: var(--linen); }
.lb[hidden] { display: none; }
.lb .stage { flex: 1; display: grid; place-items: center; min-height: 0; touch-action: pan-y; }
.lb img, .lb video { max-width: 100vw; max-height: calc(100vh - 150px); object-fit: contain; }
.lb .cap { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); font-size: .95rem; }
.lb .cap b { color: var(--ochre); }
.lb .x { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 1.5rem; z-index: 2; }
