:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #1d4ed8;
  --accent-dark: #173ea7;
  --danger: #b42318;
  --shadow: 0 12px 40px rgba(16, 24, 40, .08);
  --radius: 24px;
}


/* =========================================================
   GLOBAL
   ========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "Segoe UI",
    sans-serif;

  color: var(--text);
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}


/* =========================================================
   SPLASH SCREEN
   ========================================================= */

.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: #000000;
  color: white;

  transition: opacity .28s ease;
}

.splash.light {
  background: #fff;
  color: #111827;
}

.splash-logo {
  width: 154px;
  height: 154px;

  object-fit: contain;

  margin-bottom: 18px;
}

.splash-name {
  font-weight: 800;
  font-size: 30px;

  letter-spacing: -.03em;
}


/* =========================================================
   APP
   ========================================================= */

.app {
  min-height: 100vh;
}


/* =========================================================
   MAIN TOP BAR
   ========================================================= */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;

  display: flex;
  align-items: center;

  gap: 12px;

  padding:
    calc(12px + env(safe-area-inset-top))
    16px
    12px;

  background: rgba(255,255,255,.92);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border-bottom:
    1px solid rgba(228,231,236,.9);
}

.brand {
  display: flex;
  align-items: center;

  gap: 10px;

  min-width: 0;

  flex: 1;
}

.brand img {
  width: 40px;
  height: 40px;

  object-fit: contain;

  border-radius: 10px;
}

.brand-name {
  font-weight: 800;
}

.brand-sub {
  font-size: 12px;

  color: var(--muted);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* =========================================================
   CARD DETAIL TOP BAR
   ========================================================= */

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 30;

  display: grid;

  grid-template-columns:
    64px
    minmax(0, 1fr)
    64px;

  align-items: center;

  min-height: 58px;

  padding:
    calc(8px + env(safe-area-inset-top))
    10px
    8px;

  background:
    rgba(255,255,255,.96);

  border-bottom:
    1px solid var(--line);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.detail-topbar-title {
  text-align: center;

  font-size: 16px;
  font-weight: 800;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-back-btn,
.detail-edit-btn {
  min-height: 44px;

  border: 0;

  background: transparent;

  touch-action: manipulation;

  -webkit-tap-highlight-color:
    transparent;
}

.detail-back-btn {
  justify-self: start;

  width: 48px;

  padding: 0;

  color: var(--text);

  font-size: 42px;
  font-weight: 300;

  line-height: 1;
}

.detail-edit-btn {
  justify-self: end;

  color: var(--accent);

  font-size: 16px;
  font-weight: 800;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.icon-btn {
  border: 0;

  background: transparent;

  width: 40px;
  height: 40px;

  border-radius: 12px;

  font-size: 20px;

  color: var(--text);
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: 0;

  border-radius: 14px;

  padding: 11px 15px;

  font-weight: 700;

  display: inline-flex;

  align-items: center;
  justify-content: center;

  gap: 8px;
}

.primary-btn {
  background: var(--accent);

  color: #fff;
}

.primary-btn:active {
  background:
    var(--accent-dark);
}

.ghost-btn {
  background: #eef2f6;

  color: var(--text);
}

.danger-btn {
  background: #fee4e2;

  color: var(--danger);
}


/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
  position: fixed;

  inset:
    0
    auto
    0
    0;

  width: min(86vw,340px);

  z-index: 50;

  background: #fff;

  transform:
    translateX(-100%);

  transition:
    .22s ease;

  padding:
    calc(12px + env(safe-area-inset-top))
    14px
    20px;

  box-shadow:
    var(--shadow);
}

.sidebar.open {
  transform:
    translateX(0);
}

.sidebar-head {
  display: flex;

  align-items: center;
  justify-content: space-between;

  padding:
    0 4px 16px;
}

.sidebar nav {
  display: grid;

  gap: 8px;
}

.nav-item {
  border: 0;

  background: transparent;

  text-align: left;

  padding: 14px;

  border-radius: 14px;

  font-weight: 700;

  color: var(--text);

  display: flex;

  align-items: center;

  gap: 12px;
}

.nav-item.active {
  background: #eef4ff;

  color: var(--accent);
}

.scrim {
  position: fixed;

  inset: 0;

  background:
    rgba(0,0,0,.35);

  z-index: 40;

  opacity: 0;

  pointer-events: none;

  transition:
    .2s ease;
}

.scrim.show {
  opacity: 1;

  pointer-events: auto;
}


/* =========================================================
   MAIN VIEWS
   ========================================================= */

main {
  max-width: 1100px;

  margin: 0 auto;

  padding:
    18px
    16px
    44px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}


/* =========================================================
   HERO
   ========================================================= */

.hero {
  background:
    linear-gradient(
      145deg,
      #0b1020,
      #172554
    );

  color: #fff;

  border-radius: 28px;

  padding: 20px;

  box-shadow:
    var(--shadow);

  margin-bottom: 16px;
}

.hero-brand {
  display: flex;

  align-items: center;

  gap: 16px;

  margin-bottom: 20px;
}

.hero-brand img {
  width: 72px;
  height: 72px;

  object-fit: contain;

  border-radius: 16px;

  background:
    rgba(255,255,255,.08);

  padding: 6px;
}

.hero h1 {
  margin: 0;

  font-size: 28px;

  letter-spacing: -.03em;
}

.hero p {
  margin:
    5px 0 0;

  color: #cbd5e1;
}


/* =========================================================
   STATS
   ========================================================= */

.stats-grid {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );

  gap: 12px;
}

.stat-card {
  background: var(--panel);

  border:
    1px solid var(--line);

  border-radius: 20px;

  padding: 16px;
}

.hero .stat-card {
  background:
    rgba(255,255,255,.09);

  border-color:
    rgba(255,255,255,.12);
}

.stat-card span {
  display: block;

  font-size: 12px;

  color: var(--muted);

  margin-bottom: 6px;

  font-weight: 700;

  text-transform: uppercase;

  letter-spacing: .04em;
}

.hero .stat-card span {
  color: #cbd5e1;
}

.stat-card strong {
  font-size: 22px;

  letter-spacing: -.03em;
}


/* =========================================================
   TOOLBAR / INPUTS
   ========================================================= */

.toolbar-card {
  display: grid;

  gap: 10px;

  background: var(--panel);

  border:
    1px solid var(--line);

  padding: 12px;

  border-radius: 20px;

  margin-bottom: 18px;
}

input,
select,
textarea {
  width: 100%;

  border:
    1px solid var(--line);

  background: #fff;

  color: var(--text);

  padding: 12px 13px;

  border-radius: 13px;

  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color:
    #9db7ff;

  box-shadow:
    0 0 0 3px #e8efff;
}

label {
  display: grid;

  gap: 7px;

  font-size: 13px;

  font-weight: 700;

  color: #344054;
}


/* =========================================================
   SECTION HEADERS
   ========================================================= */

.section-title-row,
.action-head {
  display: flex;

  justify-content:
    space-between;

  align-items:
    flex-end;

  gap: 12px;

  margin:
    18px 2px 12px;
}

.section-title-row h2,
.page-head h1 {
  margin: 0;
}

.section-title-row p,
.page-head p {
  margin:
    5px 0 0;

  color: var(--muted);

  font-size: 14px;
}

.page-head {
  margin:
    10px 2px 18px;
}


/* =========================================================
   COLLECTION CARDS
   ========================================================= */

.cards-grid {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );

  gap: 14px;
}

.card-tile {
  width: 100%;

  padding: 0;

  background: #fff;

  border:
    1px solid var(--line);

  border-radius: 20px;

  overflow: hidden;

  box-shadow:
    0 4px 20px
    rgba(16,24,40,.04);

  color: inherit;

  text-align: left;
}

.card-image-wrap {
  aspect-ratio:
    2.5 / 3.5;

  background: #eef2f6;

  display: flex;

  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;

  object-fit: cover;
}

.card-image-placeholder {
  font-size: 42px;
}

.card-body {
  padding: 11px;
}

.card-player {
  font-weight: 800;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.card-desc {
  margin-top: 3px;

  color: var(--muted);

  font-size: 12px;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.card-value-row {
  margin-top: 9px;

  display: flex;

  justify-content:
    space-between;

  gap: 8px;

  align-items: center;
}

.pill {
  background: #f2f4f7;

  color: #475467;

  padding: 5px 8px;

  border-radius: 999px;

  font-size: 11px;

  font-weight: 700;

  max-width: 55%;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;
}

.card-value {
  font-weight: 800;
}


/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
  text-align: center;

  padding:
    54px 20px;

  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 54px;
}

.empty-state h3 {
  color: var(--text);

  margin:
    12px 0 6px;
}

.empty-state p {
  margin:
    0 0 16px;
}


/* =========================================================
   VALUE / SETTINGS CARDS
   ========================================================= */

.list-card,
.settings-card {
  background: #fff;

  border:
    1px solid var(--line);

  border-radius: 22px;

  padding: 18px;

  margin-bottom: 16px;
}

.list-card h2,
.settings-card h2 {
  margin:
    0 0 14px;

  font-size: 18px;
}

.value-row {
  display: flex;

  justify-content:
    space-between;

  gap: 12px;

  padding:
    12px 0;

  border-top:
    1px solid var(--line);
}

.value-row:first-child {
  border-top: 0;
}

.value-row strong {
  font-variant-numeric:
    tabular-nums;
}


/* =========================================================
   FOLDERS
   ========================================================= */

.folder-tree {
  display: grid;

  gap: 9px;
}

.folder-row {
  background: #fff;

  border:
    1px solid var(--line);

  border-radius: 15px;

  padding: 12px;
}

.folder-row-main {
  display: flex;

  gap: 10px;

  align-items: center;

  justify-content:
    space-between;
}

.folder-open {
  border: 0;

  background: transparent;

  flex: 1;

  text-align: left;

  font-weight: 800;

  padding: 0;

  color: var(--text);
}

.folder-meta {
  color: var(--muted);

  font-size: 12px;
}

.folder-children {
  display: grid;

  gap: 8px;

  margin-top: 8px;

  margin-left: 16px;
}


/* =========================================================
   SETTINGS LOGO
   ========================================================= */

.logo-setting {
  display: flex;

  gap: 16px;

  align-items: center;

  padding:
    12px 0 18px;
}

.logo-setting img {
  width: 92px;
  height: 92px;

  object-fit: contain;

  border-radius: 18px;

  background: #f8fafc;

  border:
    1px solid var(--line);

  padding: 8px;
}

.logo-actions {
  display: grid;

  gap: 8px;
}

.file-btn {
  cursor: pointer;
}

.toggle-row {
  display: flex;

  justify-content:
    space-between;

  align-items: center;

  gap: 12px;

  padding:
    10px 0;
}

.toggle-row input {
  width: auto;

  transform:
    scale(1.2);
}

.settings-actions {
  display: flex;

  gap: 10px;

  flex-wrap: wrap;
}

.muted {
  color: var(--muted);

  font-size: 14px;

  line-height: 1.45;
}


/* =========================================================
   ADD / EDIT CARD MODAL
   ========================================================= */

.modal {
  width:
    min(94vw,700px);

  max-height: 90vh;

  border: 0;

  border-radius: 26px;

  padding: 0;

  box-shadow:
    0 30px 80px
    rgba(16,24,40,.28);
}

.modal::backdrop {
  background:
    rgba(16,24,40,.45);

  backdrop-filter:
    blur(4px);

  -webkit-backdrop-filter:
    blur(4px);
}

.modal form {
  padding: 20px;

  overflow: auto;

  max-height: 90vh;
}

.modal.small {
  width:
    min(92vw,480px);
}

.modal-head {
  display: flex;

  justify-content:
    space-between;

  gap: 12px;

  align-items:
    flex-start;

  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
}

.modal-head p {
  margin:
    5px 0 0;

  color: var(--muted);

  font-size: 14px;
}

.form-grid {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );

  gap: 13px;
}

.form-grid .wide {
  grid-column:
    1 / -1;
}

.form-section {
  margin-bottom: 15px;
}

.photo-preview {
  display: flex;

  gap: 10px;

  overflow: auto;

  padding-top: 10px;
}

.photo-preview img {
  width: 88px;
  height: 122px;

  object-fit: cover;

  border-radius: 12px;

  border:
    1px solid var(--line);
}

.modal-actions {
  display: flex;

  gap: 10px;

  align-items: center;

  margin-top: 20px;
}

.spacer {
  flex: 1;
}


/* =========================================================
   AI CARD IDENTIFICATION
   ========================================================= */

.photo-slot-grid {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0,1fr)
    );

  gap: 12px;

  margin-bottom: 14px;
}

.photo-slot {
  gap: 8px;
}

.photo-slot input {
  padding: 9px;
}

.single-photo-preview {
  aspect-ratio:
    2.5 / 3.5;

  border:
    1.5px dashed #cbd5e1;

  border-radius: 16px;

  background: #f8fafc;

  overflow: hidden;

  display: flex;

  align-items: center;
  justify-content: center;

  color: var(--muted);

  font-size: 12px;

  text-align: center;
}

.single-photo-preview img {
  width: 100%;
  height: 100%;

  object-fit: cover;
}

.additional-photo-label {
  margin-top: 4px;
}

.identify-btn {
  width: 100%;

  border:
    1px solid #bfdbfe;

  background:
    linear-gradient(
      135deg,
      #eff6ff,
      #eef2ff
    );

  color: #1e40af;

  border-radius: 16px;

  padding:
    13px 16px;

  font-weight: 800;

  margin-top: 14px;
}

.identify-btn:disabled {
  opacity: .45;

  cursor: not-allowed;
}

.identify-hint {
  margin:
    7px 2px 0;

  color: var(--muted);

  font-size: 12px;

  line-height: 1.4;
}

.identify-status {
  margin-top: 12px;

  padding:
    13px 14px;

  border-radius: 14px;

  background: #f2f4f7;

  color: #475467;

  font-size: 13px;
}

.identify-status.error {
  background: #fef3f2;

  color: #b42318;
}

.identify-review {
  margin-top: 14px;

  border:
    1px solid #bfdbfe;

  border-radius: 18px;

  padding: 15px;

  background: #f8fbff;
}

.identify-review-head {
  display: flex;

  align-items:
    flex-start;

  justify-content:
    space-between;

  gap: 12px;
}

.identify-review h3 {
  margin:
    2px 0 4px;

  font-size: 18px;
}

.eyebrow {
  font-size: 10px;

  font-weight: 800;

  color: #2563eb;

  letter-spacing: .08em;
}

.confidence-badge {
  flex: none;

  background: #dbeafe;

  color: #1d4ed8;

  border-radius: 999px;

  padding:
    7px 10px;

  font-size: 12px;

  font-weight: 800;
}

.identified-fields {
  display: grid;

  gap: 7px;

  margin-top: 12px;
}

.identified-field {
  display: flex;

  justify-content:
    space-between;

  gap: 14px;

  border-top:
    1px solid #e5e7eb;

  padding-top: 8px;

  font-size: 13px;
}

.identified-field:first-child {
  border-top: 0;

  padding-top: 0;
}

.identified-field span {
  color: var(--muted);
}

.identified-field strong {
  text-align: right;
}

.identify-review-actions {
  display: flex;

  justify-content:
    flex-end;

  gap: 9px;

  margin-top: 15px;
}


/* =========================================================
   NEW CARD DETAIL PAGE
   ========================================================= */

.detail-view {
  max-width: 760px;

  margin: 0 auto;
}


/* =========================================================
   DETAIL PHOTO AREA
   ========================================================= */

.detail-photo-section {
  overflow: hidden;

  margin:
    -18px
    -16px
    0;

  background:
    linear-gradient(
      180deg,
      #101828,
      #111827
    );

  border-bottom:
    1px solid var(--line);
}


/*
  The photo area cannot take more than
  roughly half the phone screen.
*/

.detail-slider {
  position: relative;

  height:
    min(
      46dvh,
      470px
    );

  min-height: 300px;

  width: 100%;

  display: flex;

  align-items: center;
  justify-content: center;
}


/* =========================================================
   DETAIL GALLERY VIEWPORT
   ========================================================= */

.detail-gallery-viewport {
  width: 100%;
  height: 100%;

  overflow: hidden;

  touch-action:
    pan-y;
}


/* =========================================================
   DETAIL GALLERY TRACK
   ========================================================= */

.detail-gallery-track {
  width: 100%;
  height: 100%;

  display: flex;

  transition:
    transform .28s
    cubic-bezier(
      .22,
      .61,
      .36,
      1
    );

  will-change:
    transform;
}


/* =========================================================
   DETAIL PHOTO SLIDE
   ========================================================= */

.detail-photo-slide {
  flex:
    0 0 100%;

  width: 100%;
  height: 100%;

  display: flex;

  align-items: center;
  justify-content: center;

  padding:
    16px 46px;
}


/*
  Important:
  card photo stays completely inside
  the available space.
*/

.detail-photo-slide img {
  display: block;

  width: auto;
  height: auto;

  max-width: 100%;
  max-height: 100%;

  object-fit: contain;

  border-radius: 14px;

  box-shadow:
    0 16px 34px
    rgba(0,0,0,.38);
}


/* =========================================================
   NO PHOTO
   ========================================================= */

.detail-no-photo {
  display: flex;

  flex-direction: column;

  align-items: center;
  justify-content: center;

  gap: 10px;

  color: #cbd5e1;
}

.detail-no-photo div {
  font-size: 52px;
}

.detail-no-photo span {
  font-size: 14px;
}


/* =========================================================
   SLIDER ARROWS
   ========================================================= */

.detail-slider-arrow {
  position: absolute;

  top: 50%;

  transform:
    translateY(-50%);

  z-index: 5;

  width: 42px;
  height: 52px;

  border: 0;

  border-radius: 14px;

  background:
    rgba(0,0,0,.44);

  color: white;

  font-size: 42px;

  line-height: 1;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 0;

  box-shadow:
    0 3px 14px
    rgba(0,0,0,.18);

  backdrop-filter:
    blur(8px);

  -webkit-backdrop-filter:
    blur(8px);

  -webkit-tap-highlight-color:
    transparent;

  touch-action:
    manipulation;
}

.detail-slider-arrow-left {
  left: 8px;
}

.detail-slider-arrow-right {
  right: 8px;
}

.detail-slider-arrow:active {
  transform:
    translateY(-50%)
    scale(.92);
}


/* =========================================================
   SLIDER FOOTER
   ========================================================= */

.detail-slider-footer {
  position: relative;

  min-height: 42px;

  display: flex;

  align-items: center;
  justify-content: center;

  background:
    #fff;

  border-bottom:
    1px solid var(--line);
}


/* =========================================================
   DETAIL DOTS
   ========================================================= */

.detail-dots {
  display: flex;

  align-items: center;

  gap: 7px;
}

.detail-dot {
  width: 7px;
  height: 7px;

  padding: 0;

  border: 0;

  border-radius: 999px;

  background:
    #d0d5dd;

  transition:
    .18s ease;
}

.detail-dot.active {
  width: 9px;
  height: 9px;

  background:
    var(--accent);
}


/* =========================================================
   PHOTO COUNT
   ========================================================= */

.detail-photo-count {
  position: absolute;

  right: 16px;

  color: var(--muted);

  font-size: 12px;

  font-weight: 700;

  font-variant-numeric:
    tabular-nums;
}


/* =========================================================
   CARD DETAIL HEADING
   ========================================================= */

.detail-card-heading {
  padding:
    22px
    4px
    16px;
}

.detail-card-heading h1 {
  margin: 0;

  font-size:
    clamp(
      26px,
      7vw,
      34px
    );

  line-height: 1.08;

  letter-spacing:
    -.035em;
}

.detail-subtitle {
  margin-top: 7px;

  color:
    var(--muted);

  font-size: 15px;

  line-height: 1.4;
}


/* =========================================================
   CARD DETAIL INFORMATION
   ========================================================= */

.detail-info-card {
  overflow: hidden;

  background:
    #fff;

  border:
    1px solid
    var(--line);

  border-radius:
    20px;

  box-shadow:
    0 4px 16px
    rgba(16,24,40,.035);
}

.detail-info-row {
  display: flex;

  align-items: center;

  justify-content:
    space-between;

  gap: 20px;

  min-height: 54px;

  margin-left:
    17px;

  padding:
    10px
    17px
    10px
    0;

  border-bottom:
    1px solid
    var(--line);
}

.detail-info-row:last-child {
  border-bottom: 0;
}

.detail-info-label {
  color:
    var(--muted);

  font-size:
    14px;
}

.detail-info-value {
  max-width: 62%;

  text-align: right;

  font-size: 15px;

  font-weight: 700;

  overflow-wrap:
    anywhere;
}


/* =========================================================
   NOTES
   ========================================================= */

.detail-notes-card {
  margin-top: 14px;

  padding: 18px;

  background:
    #fff;

  border:
    1px solid
    var(--line);

  border-radius:
    20px;
}

.detail-section-title {
  margin-bottom: 9px;

  color:
    var(--muted);

  font-size: 11px;

  font-weight: 800;

  text-transform:
    uppercase;

  letter-spacing:
    .06em;
}

.detail-notes {
  font-size: 15px;

  line-height: 1.5;

  white-space:
    pre-wrap;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (min-width: 720px) {

  .stats-grid {
    grid-template-columns:
      repeat(
        4,
        minmax(0,1fr)
      );
  }


  .toolbar-card {
    grid-template-columns:
      1fr 220px;
  }


  .cards-grid {
    grid-template-columns:
      repeat(
        4,
        minmax(0,1fr)
      );
  }


  .detail-photo-section {
    margin:
      0;
  }


  .detail-slider {
    height:
      min(
        50dvh,
        540px
      );

    border-radius:
      24px 24px 0 0;
  }


  .detail-slider-footer {
    border-radius:
      0 0 20px 20px;
  }

}


@media (max-width: 560px) {

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


  .form-grid .wide {
    grid-column:
      auto;
  }


  .brand-sub {
    display:
      none;
  }


  /*
    Prevent iPhone Safari from zooming
    when a form field receives focus.
  */

  input,
  select,
  textarea {
    font-size:
      16px;
  }


  /*
    Keep detail photo below half-screen.
  */

  .detail-slider {
    height:
      44dvh;

    min-height:
      290px;
  }


  .detail-photo-slide {
    padding:
      14px
      42px;
  }

}


@media (max-width: 420px) {

  .photo-slot-grid {
    gap: 9px;
  }


  .detail-slider {
    height:
      42dvh;

    min-height:
      270px;
  }


  .detail-slider-arrow {
    width:
      38px;

    height:
      48px;

    font-size:
      38px;
  }


  .detail-slider-arrow-left {
    left:
      5px;
  }


  .detail-slider-arrow-right {
    right:
      5px;
  }


  .detail-photo-slide {
    padding:
      12px
      39px;
  }

}


/* =========================================================
   PWA / NATIVE APP FEEL
   ========================================================= */

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;

  margin: 0;

  overflow: hidden;

  overscroll-behavior:
    none;

  -webkit-text-size-adjust:
    100%;

  background:
    var(--bg);
}

body {
  padding-bottom:
    0;

  -webkit-touch-callout:
    none;

  -webkit-user-select:
    none;

  user-select:
    none;
}


/*
  The app itself becomes the scrolling surface.
*/

.app {
  width: 100%;

  height: 100dvh;

  min-height: 100dvh;

  overflow-x:
    hidden;

  overflow-y:
    auto;

  overscroll-behavior-y:
    contain;

  -webkit-overflow-scrolling:
    touch;

  touch-action:
    pan-y;

  padding-bottom:
    env(safe-area-inset-bottom);
}


/*
  Stable sticky headers.
*/

.topbar,
.detail-topbar {
  transform:
    translateZ(0);

  -webkit-transform:
    translateZ(0);
}


/*
  Remove Safari tap highlight.
*/

button,
a,
select,
label,
.card-tile,
.folder-open,
.nav-item,
.icon-btn,
.primary-btn,
.ghost-btn,
.danger-btn,
.identify-btn,
.detail-back-btn,
.detail-edit-btn,
.detail-slider-arrow,
.detail-dot {
  touch-action:
    manipulation;

  -webkit-tap-highlight-color:
    transparent;
}


/*
  Prevent accidental UI text selection.
*/

button,
.card-tile,
.folder-open,
.nav-item,
.icon-btn,
.primary-btn,
.ghost-btn,
.danger-btn,
.identify-btn,
.detail-back-btn,
.detail-edit-btn {
  -webkit-user-select:
    none;

  user-select:
    none;
}


/*
  Allow normal form editing.
*/

input,
textarea,
select {
  -webkit-user-select:
    text;

  user-select:
    text;

  touch-action:
    manipulation;
}


/*
  Keep modal scrolling inside the modal.
*/

.modal {
  overscroll-behavior:
    contain;
}

.modal form {
  overscroll-behavior:
    contain;

  -webkit-overflow-scrolling:
    touch;
}


/*
  Reduce image dragging / long-press behavior.
*/

img {
  -webkit-user-drag:
    none;

  user-drag:
    none;
}


/*
  Native-style collection card feedback.
*/

.card-tile {
  appearance:
    none;

  -webkit-appearance:
    none;

  transition:
    transform .08s ease,
    box-shadow .12s ease;
}

.card-tile:active {
  transform:
    scale(.985);
}


/*
  Native button tap feedback.
*/

.primary-btn:active,
.ghost-btn:active,
.danger-btn:active,
.icon-btn:active,
.nav-item:active,
.folder-open:active,
.identify-btn:active,
.detail-back-btn:active,
.detail-edit-btn:active {
  transform:
    scale(.97);
}


/*
  Slider viewport needs horizontal gestures
  while still allowing the page to scroll vertically.
*/

.detail-gallery-viewport {
  touch-action:
    pan-y;
}


/*
  Force black splash immediately.
*/

.splash {
  background:
    #000000;
}


/* =========================================================
   DASHBOARD NAVIGATION
   ========================================================= */

.stat-link {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform .08s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}

.hero .stat-link {
  color: #fff;
}

.stat-link:active {
  transform: scale(.97);
}

.hero .stat-link:active {
  background: rgba(255,255,255,.15);
}


/* =========================================================
   PLAYER / SPORT BROWSING
   ========================================================= */

.browse-toolbar {
  grid-template-columns: 1fr !important;
}

.browse-list {
  display: grid;
  gap: 10px;
}

.browse-row {
  width: 100%;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  box-shadow: 0 3px 14px rgba(16,24,40,.035);
  -webkit-tap-highlight-color: transparent;
}

.browse-row > div:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.browse-row strong {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-row span {
  color: var(--muted);
  font-size: 12px;
}

.browse-row-end {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.browse-row-end b {
  color: var(--accent);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.browse-row:active {
  transform: scale(.985);
}


/* =========================================================
   FOLDER DELETE
   ========================================================= */

.folder-row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.folder-delete-btn {
  border: 0;
  border-radius: 10px;
  background: #fef3f2;
  color: var(--danger);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
  -webkit-tap-highlight-color: transparent;
}

.folder-delete-btn:active {
  transform: scale(.96);
}


/* =========================================================
   CARD-TO-CARD DETAIL NAVIGATION
   ========================================================= */

.detail-topbar {
  grid-template-columns: 58px minmax(0, 1fr) 58px;
}

.detail-topbar-center {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 1px;
}

.detail-card-nav-btn {
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 44px;
  font-weight: 300;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.detail-card-nav-btn:first-child {
  justify-self: start;
}

.detail-card-nav-btn:last-child {
  justify-self: end;
}

.detail-card-nav-btn:disabled {
  opacity: .25;
}

.detail-card-nav-btn:active:not(:disabled) {
  transform: scale(.9);
}

.detail-back-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 1px 8px 0;
  font-size: 11px;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}

.detail-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-heading-row h1 {
  min-width: 0;
}

.detail-heading-edit {
  flex: none;
  border: 0;
  border-radius: 12px;
  background: #eef4ff;
  color: var(--accent);
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 800;
}


/* =========================================================
   DETAIL PHOTO RELIABILITY / CONTAINMENT
   ========================================================= */

.detail-slider {
  height: min(40dvh, 420px);
  min-height: 260px;
}

.detail-gallery-track {
  min-width: 100%;
  height: 100%;
}

.detail-photo-slide {
  min-width: 100%;
  width: 100%;
  height: 100%;
  flex: 0 0 100%;
  overflow: hidden;
}

.detail-photo-slide img {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: auto !important;
  height: auto !important;
  max-width: calc(100% - 4px) !important;
  max-height: calc(100% - 4px) !important;
  object-fit: contain !important;
  object-position: center center;
}

@media (max-width: 560px) {
  .detail-slider {
    height: 38dvh;
    min-height: 250px;
  }
}

@media (max-width: 420px) {
  .detail-slider {
    height: 36dvh;
    min-height: 235px;
  }
}


/* =========================================================
   FAVORITES / GRADED CARD ENHANCEMENTS
   ========================================================= */

.card-tile {
  position: relative;
}

.card-tile-badges {
  position: absolute;
  top: 9px;
  left: 9px;
  right: 9px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.card-favorite-badge,
.card-graded-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  border-radius: 999px;
  box-shadow: 0 3px 12px rgba(0,0,0,.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card-favorite-badge {
  width: 27px;
  padding: 0;
  background: rgba(255,255,255,.94);
  color: #f59e0b;
  font-size: 17px;
}

.card-graded-badge {
  margin-left: auto;
  padding: 4px 8px;
  background: rgba(16,24,40,.82);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.detail-heading-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-favorite-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #f2d38a;
  border-radius: 13px;
  background: #fffaf0;
  color: #f59e0b;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.detail-favorite-btn.active {
  background: #fff7df;
  color: #f59e0b;
}

.detail-favorite-btn:active {
  transform: scale(.94);
}


/* =========================================================
   AUTHENTICATION
   ========================================================= */

.auth-screen {
  min-height: 100dvh;
  width: 100%;
  padding:
    calc(28px + env(safe-area-inset-top))
    18px
    calc(28px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, #1d315f 0, #0b1020 48%, #05070d 100%);
  overflow-y: auto;
}

.auth-card {
  width: min(100%, 430px);
  background: rgba(255,255,255,.98);
  border-radius: 28px;
  padding: 26px;
  box-shadow: 0 30px 90px rgba(0,0,0,.38);
}

.auth-logo {
  display: block;
  width: 104px;
  height: 104px;
  object-fit: contain;
  border-radius: 22px;
  margin: 0 auto 16px;
}

.auth-card h1,
.auth-card h2 {
  margin: 0;
  text-align: center;
}

.auth-card h1 {
  font-size: 28px;
  letter-spacing: -.035em;
}

.auth-card h2 {
  font-size: 21px;
  margin-bottom: 14px;
}

.auth-subtitle {
  text-align: center;
  color: var(--muted);
  margin: 7px 0 20px;
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-main-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 2px;
}

.auth-links {
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auth-links button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 750;
  padding: 8px 0;
}

.auth-status {
  margin: 0 0 14px;
  border-radius: 14px;
  padding: 11px 13px;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: 13px;
  line-height: 1.4;
}

.auth-status.error {
  background: #fef3f2;
  color: var(--danger);
}


/* =========================================================
   ACCOUNT / PERSONAL BRANDING
   ========================================================= */

.account-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.account-summary > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.account-summary strong {
  overflow-wrap: anywhere;
}

.account-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-role-badge {
  flex: none;
  border-radius: 999px;
  padding: 6px 9px;
  background: #eef4ff;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.personal-brand-grid > div {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 9px;
}

.personal-brand-preview {
  width: 112px;
  height: 112px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fafc;
  padding: 8px;
}

.small-note {
  margin-bottom: 0;
}


/* =========================================================
   ADMIN USERS
   ========================================================= */

.admin-users-list {
  display: grid;
  gap: 12px;
}

.admin-user-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(16,24,40,.035);
}

.admin-user-main {
  display: grid;
  gap: 4px;
}

.admin-user-main span {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.admin-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.admin-user-meta span {
  border-radius: 999px;
  padding: 5px 8px;
  background: #f2f4f7;
  color: #475467;
  font-size: 11px;
  font-weight: 700;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.admin-user-actions button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .personal-brand-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 22px 18px;
  }
}
