:root {
  --canvas-blue: #87ceeb;
  --teal-card: #165b7a;
  --teal-deep: #0f445c;
  --border-soft: rgba(15, 23, 42, 0.14);
  --shadow-card: 0 10px 24px rgba(15, 23, 42, 0.10);
  --text-dark: #0f172a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #f1f5f9;
  color: var(--text-dark);
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: #ffffff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-logo-img {
  height: 46px;
  width: auto;
  display: block;
  object-fit: contain;
  border-radius: 10px;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  background: #e2e8f0;
  padding: 6px 12px;
  border-radius: 999px;
}

.auth-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.auth-btn:hover {
  background: #eef2f6;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.folder-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 20px;
  background: #ffffff;
  overflow-x: auto;
}

.character-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.folder-tab {
  border: none;
  background: var(--tab-color);
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 20px;
  cursor: pointer;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: padding-top 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.folder-tab:hover {
  opacity: 1;
}

.folder-tab.active {
  padding-top: 12px;
  opacity: 1;
  box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.08);
}

.add-tab-btn {
  --tab-color: #e2e8f0;
  font-size: 18px;
  font-weight: 700;
  padding: 6px 14px;
  color: #334155;
}

.add-tab-btn:hover {
  background: #cbd5e1;
}

.tab-rename-btn {
  border: none;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.7;
}

.tab-rename-btn:hover {
  opacity: 1;
  background: #ffffff;
}

.main-canvas {
  flex: 1;
  background: linear-gradient(180deg, #87ceeb 0%, #a3dcf4 100%);
  padding: 28px;
  border-top: 1px solid rgba(15, 23, 42, 0.10);
}

/* Home View */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 230px;
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}

.home-main {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.home-text-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.home-text-card {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-top: 4px solid #ec4899;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.09);
  min-height: 112px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.home-text-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

.home-video-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.home-video-card {
  background: linear-gradient(165deg, #1b6d91 0%, #0d3b52 100%);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 20px;
  box-shadow: 0 16px 34px rgba(11, 45, 64, 0.26);
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-video-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.14), transparent 65%);
  pointer-events: none;
}

.home-video-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 22px 42px rgba(11, 45, 64, 0.34);
}

.home-photo-card:hover,
.gallery-item-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
}

.home-video-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding-top: 0;
}

.home-photo-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.11);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.home-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-download-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
}

.card-download-btn:hover {
  background: #0f172a;
}

.card-upload-btn {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(236, 72, 153, 0.9);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.card-upload-btn:hover {
  background: #db2777;
}

.home-text-card,
.gallery-label-card {
  position: relative;
}

.card-edit-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.card-edit-btn:hover {
  background: rgba(15, 23, 42, 0.18);
}

/* Profile View */
.profile-wrapper {
  min-height: 68vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-card {
  width: min(100%, 480px);
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid var(--border-dark);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-card h1 {
  font-size: 22px;
  text-align: center;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

.profile-form input,
.profile-form select,
.profile-form textarea {
  padding: 8px 10px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  font: inherit;
}

.profile-status {
  font-size: 13px;
  color: #15803d;
  min-height: 18px;
}

/* Character Gallery (Lisa / Laura) */
.gallery-rows {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1360px;
  margin: 0 auto;
}

.gallery-band {
  background: linear-gradient(160deg, var(--teal-card) 0%, var(--teal-deep) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.gallery-label-card {
  flex: 0 0 112px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  padding: 8px;
  text-align: center;
}

.gallery-carousel {
  flex: 1;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}

.gallery-carousel::-webkit-scrollbar {
  height: 8px;
}

.gallery-carousel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.gallery-item-card {
  flex: 0 0 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.gallery-item-card img,
.gallery-item-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.row-remove-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.row-remove-btn:hover {
  background: #ef4444;
}

.gallery-admin-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-top: 4px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: min(100%, 420px);
  background: #ffffff;
  border: 2px solid var(--border-dark);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.media-modal-card {
  width: min(100%, 760px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

.modal-form input {
  padding: 8px 10px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
}

.modal-hint {
  font-size: 12px;
  color: #475569;
}

.auth-mode-switch {
  display: flex;
  gap: 8px;
}

.auth-mode-btn {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.auth-mode-btn.active {
  background: var(--teal-card);
  color: #ffffff;
  border-color: var(--teal-card);
}

.auth-status {
  font-size: 13px;
  min-height: 18px;
  color: #b91c1c;
}

.auth-status.ok {
  color: #15803d;
}

.auth-modal-actions {
  justify-content: space-between;
  align-items: center;
}

.auth-secondary-links {
  display: flex;
  gap: 10px;
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--teal-card);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-primary {
  background: var(--teal-card);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.media-modal-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 6px;
  overflow: hidden;
}

.media-modal-body img,
.media-modal-body video {
  max-width: 100%;
  max-height: 65vh;
}

.hidden {
  display: none !important;
}

@media (max-width: 960px) {
  .home-layout {
    grid-template-columns: 1fr;
  }
  .home-sidebar {
    padding-top: 0;
    flex-direction: row;
  }
  .home-photo-card {
    flex: 1;
  }
}

@media (max-width: 680px) {
  .home-text-row,
  .home-video-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gallery-band {
    flex-direction: column;
    align-items: stretch;
  }
  .gallery-label-card {
    flex: none;
  }
}
