@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Source+Serif+4:wght@400;600&display=swap");

:root {
  color-scheme: light;
  --bg: #f5f2eb;
  --bg-2: #e5ece8;
  --surface: #fffdf8;
  --surface-soft: rgba(255, 253, 248, 0.92);
  --surface-strong: rgba(255, 253, 248, 0.98);
  --line: rgba(18, 63, 70, 0.12);
  --text: #172326;
  --muted: #68777a;
  --accent: #123f46;
  --accent-2: #6f8067;
  --accent-rgb: 18, 63, 70;
  --accent-2-rgb: 111, 128, 103;
  --danger: #bf4a3a;
  --shadow: 0 24px 54px rgba(18, 63, 70, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: clip;
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.2), transparent 42%),
    radial-gradient(circle at 80% 8%, rgba(var(--accent-2-rgb), 0.16), transparent 34%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  overscroll-behavior: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(115deg, rgba(23, 33, 43, 0.06) 0%, rgba(23, 33, 43, 0) 60%),
    repeating-linear-gradient(
      90deg,
      rgba(23, 33, 43, 0.025),
      rgba(23, 33, 43, 0.025) 1px,
      transparent 1px,
      transparent 120px
    );
  pointer-events: none;
  z-index: -1;
}

button,
input {
  font: inherit;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.title-icon,
.button-icon,
.drop-icon {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.title-icon {
  color: var(--accent);
  width: 0.9em;
  height: 0.9em;
}

.button-with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

[hidden] {
  display: none !important;
}

.app {
  position: relative;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
}

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px clamp(12px, 4vw, 28px);
  border-radius: 0;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 14px 30px rgba(23, 33, 43, 0.1);
  backdrop-filter: blur(12px);
  z-index: 32;
}

body[data-auth="logged-out"] .app-topbar {
  display: none;
}

.app-topbar-title {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(680px, 70vw);
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}

.topbar-actions::-webkit-scrollbar {
  display: none;
}

.topbar-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.topbar-action .button-icon {
  width: 16px;
  height: 16px;
}

.topbar-action:hover,
.topbar-action:focus-visible,
.topbar-action.is-active {
  outline: none;
  background: rgba(var(--accent-rgb), 0.12);
  border-color: rgba(var(--accent-rgb), 0.26);
  transform: translateY(-1px);
}

.topbar-action-danger {
  background: rgba(216, 75, 75, 0.1);
  border-color: rgba(216, 75, 75, 0.24);
  color: #b83232;
}

.topbar-action-danger:hover,
.topbar-action-danger:focus-visible {
  background: rgba(216, 75, 75, 0.16);
  border-color: rgba(216, 75, 75, 0.34);
  color: #9f2424;
}

.content {
  display: grid;
  place-items: center;
  padding: 72px 24px 36px;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.content > * {
  min-width: 0;
  max-width: 100%;
}

body[data-auth="logged-out"] .content,
body[data-auth="checking"] .content {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

body[data-view="upload"] .content,
body[data-view="google-drive"] .content,
body[data-view="profile"] .content {
  place-items: start center;
  align-content: start;
  padding-top: 72px;
  padding-bottom: 18px;
}

.launch-card,
.session-card {
  width: min(440px, 92vw);
  padding: 32px;
  border-radius: 24px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  animation: fadeUp 0.8s ease-out 0.1s both;
}

.launch-card {
  display: none;
  place-items: center;
  gap: 18px;
  text-align: center;
}

.launch-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 18px 36px rgba(var(--accent-rgb), 0.18);
}

.launch-card h1,
.session-card h1 {
  margin: 0;
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1.1;
}

.launch-card p,
.session-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.session-card {
  display: none;
  gap: 18px;
  text-align: center;
  background:
    linear-gradient(160deg, rgba(255, 253, 248, 0.98), rgba(239, 246, 242, 0.94));
}

.google-login-button {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 16px;
  padding: 12px 18px;
  background: rgba(255, 253, 248, 0.96);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 22px rgba(var(--accent-rgb), 0.08);
}

.google-login-button:hover,
.google-login-button:focus-visible {
  outline: none;
  background: rgba(var(--accent-rgb), 0.08);
}

.drive-connect {
  width: auto;
  min-width: 190px;
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
}

.upload-view,
.google-drive-view,
.profile-view {
  display: none;
  width: 100%;
  max-width: 980px;
  gap: 12px;
  padding: 0;
  animation: fadeUp 0.8s ease-out 0.1s both;
}

.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.view-header h1 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.profile-eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.09);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.album-pill {
  max-width: min(100%, 360px);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.09);
  color: var(--accent);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-grid,
.upload-grid {
  display: grid;
  gap: 12px;
}

.profile-card {
  border-radius: 20px;
  padding: 18px;
  border: 1px solid rgba(var(--accent-rgb), 0.1);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 16px 34px rgba(var(--accent-rgb), 0.07);
  display: grid;
  gap: 14px;
}

.card-header h2 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
}

.drive-picker-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.secondary {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.96);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.08);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.secondary:hover,
.secondary:focus-visible {
  outline: none;
  background: rgba(var(--accent-rgb), 0.08);
  border-color: rgba(var(--accent-rgb), 0.24);
  transform: translateY(-1px);
}

.secondary:disabled {
  cursor: wait;
  opacity: 0.68;
  transform: none;
}

.profile-rows {
  margin: 0;
  display: grid;
  gap: 8px;
}

.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(16, 24, 26, 0.12);
}

.profile-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-label {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.profile-value {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.upload-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 10px;
  font-size: 0.95rem;
}

.field > span {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  background: rgba(255, 253, 248, 0.96);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input:focus {
  border-color: rgba(var(--accent-rgb), 0.42);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
}

.file-drop {
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 10px;
  border: 1px dashed rgba(var(--accent-rgb), 0.32);
  border-radius: 18px;
  background: linear-gradient(140deg, rgba(var(--accent-rgb), 0.08), rgba(var(--accent-2-rgb), 0.08));
  color: var(--accent);
  text-align: center;
  cursor: pointer;
}

.file-drop input {
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 42px;
  height: 42px;
}

.primary {
  margin-top: 6px;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #1f6267);
  color: #fffdf8;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(var(--accent-rgb), 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary:hover,
.primary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(var(--accent-rgb), 0.22);
  outline: none;
}

.primary:disabled {
  cursor: wait;
  opacity: 0.64;
  transform: none;
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status:empty {
  display: none;
}

.status.error {
  color: var(--danger);
}

.uploaded-list {
  display: grid;
  gap: 8px;
}

.uploaded-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  opacity: 0;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(16, 24, 26, 0.92);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 16px 32px rgba(16, 24, 26, 0.2);
  z-index: 120;
  pointer-events: none;
  max-width: min(90vw, 520px);
  text-align: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: rgba(216, 75, 75, 0.95);
}

body[data-view="launch"] .session-card,
body[data-view="launch"] .upload-view,
body[data-view="launch"] .google-drive-view,
body[data-view="launch"] .profile-view {
  display: none;
}

body[data-view="launch"] .launch-card {
  display: grid;
}

body[data-view="login"] .launch-card,
body[data-view="login"] .upload-view,
body[data-view="login"] .google-drive-view,
body[data-view="login"] .profile-view {
  display: none;
}

body[data-view="login"] .session-card {
  display: grid;
}

body[data-view="upload"] .launch-card,
body[data-view="upload"] .session-card,
body[data-view="upload"] .google-drive-view,
body[data-view="upload"] .profile-view {
  display: none;
}

body[data-view="upload"] .upload-view {
  display: grid;
}

body[data-view="google-drive"] .launch-card,
body[data-view="google-drive"] .session-card,
body[data-view="google-drive"] .upload-view,
body[data-view="google-drive"] .profile-view {
  display: none;
}

body[data-view="google-drive"] .google-drive-view {
  display: grid;
}

body[data-view="profile"] .launch-card,
body[data-view="profile"] .session-card,
body[data-view="profile"] .upload-view,
body[data-view="profile"] .google-drive-view {
  display: none;
}

body[data-view="profile"] .profile-view {
  display: grid;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 960px) {
  :root {
    --desktop-topbar-height: 64px;
  }

  body[data-auth="logged-in"] {
    background: linear-gradient(180deg, #f6f8f7 0%, #eef3f0 100%);
  }

  body[data-auth="logged-in"]::before {
    background-image:
      linear-gradient(90deg, rgba(var(--accent-rgb), 0.035) 1px, transparent 1px),
      linear-gradient(180deg, rgba(var(--accent-rgb), 0.025) 1px, transparent 1px);
    background-position: 0 var(--desktop-topbar-height);
    background-size: 72px 72px;
  }

  body[data-auth="logged-in"] .app-topbar {
    min-height: var(--desktop-topbar-height);
    padding: 10px clamp(28px, 4vw, 56px);
    border-top: 0;
    border-right: 0;
    border-left: 0;
    border-color: rgba(var(--accent-rgb), 0.1);
    background: rgba(255, 253, 248, 0.92);
    box-shadow: 0 10px 28px rgba(var(--accent-rgb), 0.07);
    backdrop-filter: blur(18px);
    z-index: 38;
  }

  body[data-auth="logged-in"] .app-topbar-title {
    text-align: left;
    font-size: 1rem;
  }

  body[data-auth="logged-in"] .topbar-action {
    min-height: 40px;
    padding: 9px 13px;
  }

  body[data-auth="logged-in"] .content,
  body[data-auth="logged-in"][data-view] .content {
    width: 100%;
    min-height: 100vh;
    margin-left: 0;
    padding: calc(var(--desktop-topbar-height) + 28px) clamp(28px, 4vw, 56px) 48px;
    place-items: start center;
    align-content: start;
  }

  body[data-auth="logged-in"] .upload-view,
  body[data-auth="logged-in"] .google-drive-view,
  body[data-auth="logged-in"] .profile-view {
    width: 100%;
    max-width: 1180px;
  }

  body[data-auth="logged-in"] .view-header {
    align-items: center;
  }

  body[data-auth="logged-in"] .view-header h1 {
    font-size: 1.8rem;
  }

  body[data-auth="logged-in"] .upload-grid,
  body[data-auth="logged-in"] .profile-grid {
    grid-template-columns: minmax(0, min(760px, 100%));
    justify-content: start;
  }
}

@media (min-width: 780px) {
  .profile-grid {
    grid-template-columns: minmax(0, 0.72fr);
  }
}

@media (max-width: 800px) {
  .content {
    padding-top: 64px;
  }

  body[data-auth="logged-in"] .content {
    padding-top: 70px;
    padding-bottom: 14px;
  }
}

@media (max-width: 520px) {
  .app-topbar {
    gap: 6px;
    padding-inline: 8px;
  }

  .app-topbar-title {
    font-size: 0.86rem;
  }

  .topbar-actions {
    gap: 4px;
    max-width: 62vw;
  }

  .topbar-action {
    min-width: 38px;
    padding: 8px;
  }

  .topbar-action span {
    display: none;
  }

  .content {
    padding: 64px 14px 22px;
  }

  .view-header {
    align-items: stretch;
    flex-direction: column;
  }

  .view-header h1 {
    font-size: 1.58rem;
  }

  .album-pill {
    max-width: 100%;
  }

  .profile-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
