:root {
  --bg: #ffffff;
  --bg-elevated: #f5f5f7;
  --bg-card: #f5f5f7b3;
  --bg-card-hover: #eeeeef;
  --fill: rgba(0, 0, 0, 0.06);
  --fill-hover: rgba(0, 0, 0, 0.1);
  --text: #000000;
  --text-secondary: #6e6e73;
  --accent: #000000;
  --accent-text: #ffffff;
  --accent-hover: #2c2c2e;
  --danger: #ff3b30;
  --separator: rgba(0, 0, 0, 0.12);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 980px;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  background: #ffffff;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
a:hover { opacity: 0.7; }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 72px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}
.brand-logo {
  height: 56px;
  width: auto;
}
.brand-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
  flex-wrap: wrap;
}

.top-bar h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 11px 20px;
  font-size: 0.95rem;
  font-weight: 590;
  letter-spacing: -0.01em;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { transform: scale(0.96); }
.btn.secondary { background: var(--fill); color: var(--text); }
.btn.secondary:hover { background: var(--fill-hover); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px rgba(255, 69, 58, 0.4); }
.btn.danger:hover { background: rgba(255, 69, 58, 0.1); }
.btn.small { padding: 7px 14px; font-size: 0.82rem; }
.btn.whatsapp { background: #25d366; color: #ffffff; }
.btn.whatsapp:hover { background: #1fb959; }

.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
}
.card.danger-zone { border-color: rgba(255, 69, 58, 0.3); }

input[type="text"], input[type="password"], input[type="file"] {
  background: var(--fill);
  border: none;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  width: 100%;
  font-family: inherit;
  transition: box-shadow 0.15s ease;
}
input[type="text"]:focus, input[type="password"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25);
}
input::placeholder { color: var(--text-secondary); }

form.inline { display: flex; gap: 10px; flex-wrap: wrap; }
form.inline input[type="text"] { flex: 1; min-width: 200px; }

.error-msg {
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.3);
  color: #d70015;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box { width: 100%; max-width: 360px; }
.login-box h1 {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 22px;
}
.login-box form { display: flex; flex-direction: column; gap: 14px; }
.login-box .btn { padding: 13px 20px; }

.album-list { display: flex; flex-direction: column; gap: 10px; }
.album-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  transition: background-color 0.15s ease;
}
.album-row:hover { background: var(--bg-card-hover); }
.album-row .meta { color: var(--text-secondary); font-size: 0.85rem; margin-top: 2px; }
.album-row .title { font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }

.share-box {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--fill);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  flex-wrap: wrap;
}
.share-box code {
  flex: 1;
  min-width: 200px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.folder-heading {
  margin: 32px 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.folder-heading:first-of-type { margin-top: 8px; }

.folder-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.folder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--fill);
  border-radius: var(--radius-sm);
}
.folder-row form.inline { flex: 1; min-width: 160px; }
.folder-row input[type="text"] { padding: 8px 10px; font-size: 0.85rem; }

.folder-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.folder-tile:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  border-color: rgba(0, 0, 0, 0.25);
}
.folder-tile-icon { font-size: 2rem; margin-bottom: 8px; }
.folder-tile-name {
  font-size: 0.92rem;
  font-weight: 590;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-tile-count { color: var(--text-secondary); font-size: 0.78rem; margin-top: 2px; }

.video-tile {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.video-tile .select-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.video-tile .select-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.video-tile .kind-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 7px;
  border-radius: var(--radius-pill);
}
.video-tile:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  border-color: rgba(0, 0, 0, 0.25);
}
.video-tile .thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #e5e5e7 center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.6rem;
  cursor: pointer;
}
.video-tile .info { padding: 12px 14px; }
.video-tile .name {
  font-size: 0.88rem;
  font-weight: 590;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-tile .size { color: var(--text-secondary); font-size: 0.78rem; margin-top: 2px; }
.video-tile .tile-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px 12px;
}
.video-tile .tile-actions a,
.video-tile .tile-actions button {
  border: none;
  background: none;
  font-size: 0.78rem;
  font-family: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-secondary);
}
.video-tile .tile-actions a:hover { color: var(--text); opacity: 1; }
.video-tile .tile-actions button.remove { color: var(--danger); }

.upload-zone {
  border: 1.5px dashed var(--separator);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  color: var(--text-secondary);
  margin: 16px 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.upload-zone.drag { border-color: var(--text); background: rgba(0, 0, 0, 0.04); }

.progress-list { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.progress-item { font-size: 0.85rem; }
.progress-bar-track {
  height: 6px;
  background: var(--fill);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-content { width: 100%; max-width: 920px; }
.modal-content video,
.modal-content img#modalImage {
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  background: black;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
}
.modal-content img#modalImage { display: none; }
.modal-raw-note {
  display: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  text-align: center;
  margin: 10px 0 0;
}
.modal-raw-note a { color: #ffffff; }
.modal-back {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px 0;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: var(--radius-pill);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 590;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.modal-back:hover { background: rgba(255, 255, 255, 0.22); }

.modal-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #ffffff;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.modal-nav:hover { background: rgba(255, 255, 255, 0.22); }
.modal-nav:disabled { opacity: 0; pointer-events: none; }
.modal-nav.prev { left: 20px; }
.modal-nav.next { right: 20px; }
@media (max-width: 720px) {
  .modal-nav { width: 42px; height: 42px; font-size: 1.05rem; }
  .modal-nav.prev { left: 8px; }
  .modal-nav.next { right: 8px; }
}

.empty-state {
  color: var(--text-secondary);
  text-align: center;
  padding: 48px 16px;
  font-size: 0.95rem;
}

.selection-bar {
  position: fixed;
  left: 50%;
  bottom: -80px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: #ffffff;
  padding: 12px 16px 12px 20px;
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  transition: bottom 0.25s ease;
  max-width: calc(100% - 32px);
  flex-wrap: wrap;
  justify-content: center;
}
.selection-bar.open { bottom: 24px; }
.selection-bar span { font-size: 0.9rem; font-weight: 590; white-space: nowrap; }
.selection-bar-actions { display: flex; gap: 8px; }
.selection-bar .btn.secondary { background: rgba(255, 255, 255, 0.14); color: #ffffff; }
.selection-bar .btn.secondary:hover { background: rgba(255, 255, 255, 0.22); }

.gallery-header { text-align: center; margin-bottom: 32px; }
.gallery-header .btn { margin-top: 16px; }
.gallery-header h1 {
  margin-bottom: 6px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.gallery-header p { color: var(--text-secondary); margin: 0; font-size: 0.95rem; }

footer.hint {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.78rem;
  margin-top: 36px;
}
