: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-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand-text { line-height: 1.2; }
.brand-name {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.brand-tagline {
  font-size: 0.68rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.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; }

.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;
}

.video-tile {
  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: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 {
  width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-lg);
  background: black;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
}
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 14px auto;
  width: 36px;
  height: 36px;
  background: var(--fill);
  border: none;
  border-radius: 50%;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.modal-close:hover { background: var(--fill-hover); }

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

.gallery-header { text-align: center; margin-bottom: 32px; }
.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;
}
