:root {
  color-scheme: light;
  --page: #f7fbff;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: rgba(17, 24, 39, 0.12);
  --blue: #2563eb;
  --teal: #0f9f8f;
  --rose: #e85d75;
  --amber: #c88418;
  --danger: #c2410c;
  --shadow: 0 22px 70px rgba(35, 52, 76, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(37, 99, 235, 0.12), transparent 30%),
    radial-gradient(circle at 84% 22%, rgba(15, 159, 143, 0.12), transparent 28%),
    radial-gradient(circle at 52% 86%, rgba(232, 93, 117, 0.1), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--page) 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(247, 251, 255, 0.86), rgba(247, 251, 255, 0.44) 50%, rgba(247, 251, 255, 0.9)),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.72) 62%, var(--page));
}

.app-shell,
.album-view {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
}

.auth-view {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 28px 0;
}

.auth-panel {
  position: relative;
  width: min(520px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  padding: clamp(28px, 6vw, 48px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.7)),
    var(--surface);
  box-shadow: 0 28px 90px rgba(35, 52, 76, 0.16);
  backdrop-filter: blur(22px);
}

.auth-panel::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.16), transparent 38%),
    linear-gradient(300deg, rgba(15, 159, 143, 0.16), transparent 42%);
  pointer-events: none;
}

.auth-panel > * {
  position: relative;
}

.auth-mark {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 74px;
  margin-bottom: 28px;
}

.auth-mark span {
  display: block;
  aspect-ratio: 1;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.18);
}

.auth-mark span:nth-child(2) {
  background: linear-gradient(135deg, var(--rose), var(--amber));
}

.auth-mark span:nth-child(3) {
  background: linear-gradient(135deg, var(--teal), #7dd3fc);
}

.auth-mark span:nth-child(4) {
  background: linear-gradient(135deg, #111827, var(--blue));
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.auth-panel h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 7vw, 54px);
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.auth-copy,
.media-copy p,
.form-note {
  color: var(--muted);
}

.login-form,
.upload-form {
  display: grid;
  gap: 18px;
}

.login-form {
  margin-top: 30px;
}

label,
legend {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.password-row,
.form-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.password-row input {
  flex: 1 1 220px;
}

.primary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 11px 16px;
  font-weight: 950;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.2);
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
}

.danger-button {
  border: 1px solid rgba(194, 65, 12, 0.22);
  background: rgba(194, 65, 12, 0.1);
  color: var(--danger);
}

.primary-button:hover,
.primary-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.danger-button:hover,
.danger-button:focus-visible {
  outline: 0;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 251, 255, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  font-weight: 950;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.nav-links {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: clamp(8px, 2vw, 22px);
}

.nav-link {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link[aria-pressed="true"] {
  color: var(--ink);
  outline: 0;
}

.section-heading h2 {
  margin-bottom: 14px;
  font-size: clamp(34px, 6vw, 72px);
  line-height: 1.02;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  margin-bottom: 18px;
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented-control button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  font-weight: 950;
}

.segmented-control button[aria-pressed="true"] {
  border-color: rgba(37, 99, 235, 0.42);
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
}

.search-field {
  flex: 1 1 260px;
  max-width: 420px;
}

.upload-shortcut {
  flex: 0 0 auto;
  min-height: 42px;
  padding-inline: 18px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(35, 52, 76, 0.08);
}

.media-open {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: #e5edf5;
  color: var(--ink);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.media-open img,
.media-open video,
.dialog-media img,
.dialog-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-open img,
.media-open video {
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.media-open:hover img,
.media-open:focus-visible img {
  transform: scale(1.02);
}

.live-preview {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.live-preview[data-playing="true"] {
  opacity: 1;
}

.type-badge,
.play-badge {
  position: absolute;
  z-index: 2;
  border-radius: 8px;
  padding: 6px 9px;
  background: rgba(17, 24, 39, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.type-badge {
  top: 10px;
  left: 10px;
}

.play-badge {
  right: 10px;
  bottom: 10px;
}

.media-copy {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.media-copy h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.18;
}

.media-copy p {
  min-height: 42px;
  margin-bottom: 0;
  font-size: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-row span {
  border-radius: 8px;
  padding: 5px 8px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.upload-page {
  padding: clamp(42px, 7vw, 82px) 0;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.section-heading .eyebrow {
  flex-basis: 100%;
  margin-bottom: 0;
}

.upload-form {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.file-groups {
  display: grid;
  gap: 14px;
}

.file-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.file-group[data-file-group="photo"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-note {
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 800;
}

.upload-progress {
  min-height: 22px;
  margin: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.media-dialog {
  width: min(1040px, calc(100% - 28px));
  max-height: min(880px, calc(100svh - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #fff;
  box-shadow: var(--shadow);
}

.media-dialog::backdrop {
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(6px);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.68);
  color: #fff;
  font-size: 24px;
}

.dialog-media {
  background: #0f172a;
  aspect-ratio: 16 / 10;
}

.dialog-media > img,
.dialog-media > video,
.live-detail {
  max-height: 72svh;
}

.live-detail {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: #0f172a;
}

.live-detail video {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.live-detail video[data-playing="true"] {
  opacity: 1;
}

.dialog-copy {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.dialog-copy h3 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(380px, calc(100% - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-weight: 900;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast[data-visible="true"] {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .app-shell,
  .album-view {
    width: min(100% - 24px, 1220px);
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
  }

  .nav-links {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .form-grid,
  .file-group {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }

  .media-copy p {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  .brand small {
    display: none;
  }

  .password-row,
  .form-actions,
  .dialog-actions {
    flex-direction: column;
  }

  .primary-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
