:root {
  color-scheme: light;
  --bg: #f7cb28;
  --bg-deep: #f4b800;
  --surface: #fff9ea;
  --surface-strong: #ffffff;
  --ink: #173a73;
  --ink-soft: #42618f;
  --line: rgba(18, 43, 84, 0.12);
  --red: #ef5350;
  --red-deep: #d93a35;
  --blue: #2e78ff;
  --blue-deep: #1658cf;
  --yellow: #ffd94f;
  --green: #34b870;
  --shadow: 0 16px 34px rgba(25, 54, 106, 0.18);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Avenir Next", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.34), transparent 25%),
    radial-gradient(circle at right 10% top 20%, rgba(46, 120, 255, 0.18), transparent 22%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 220px;
  height: 220px;
  top: -30px;
  right: -40px;
  background:
    linear-gradient(180deg, #f35b57 0 49%, #fff 49% 100%);
  border: 10px solid rgba(23, 58, 115, 0.18);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.22);
}

body::after {
  width: 130px;
  height: 130px;
  bottom: 28px;
  left: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0 50%, rgba(46, 120, 255, 0.22) 50% 100%);
  border: 8px solid rgba(23, 58, 115, 0.14);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 14px;
  align-items: center;
  padding: 6px 6px 14px;
}

.hero-kicker,
.mini-label {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue-deep);
}

.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1;
  letter-spacing: -0.04em;
  max-width: 18ch;
}

.hero-text,
.panel-copy,
.section-head p,
.camera-status,
.card-meta,
.collection-meta,
.empty-state,
.empty {
  color: var(--ink-soft);
}

.hero-text {
  margin: 0;
  max-width: 56ch;
  font-size: 0.92rem;
  line-height: 1.35;
}

.hero-orb {
  width: 72px;
  aspect-ratio: 1;
  margin-inline: auto;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, #fff 0 16%, transparent 17%),
    linear-gradient(180deg, var(--red) 0 46%, #ffffff 46% 100%);
  border: 6px solid rgba(23, 58, 115, 0.95);
  box-shadow:
    0 10px 20px rgba(26, 57, 110, 0.18),
    inset 0 10px 18px rgba(255, 255, 255, 0.22);
}

.layout {
  display: grid;
}

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

.sidebar,
.main-column {
  min-width: 0;
}

.sidebar {
  display: grid;
  gap: 14px;
  align-content: start;
}

.main-column {
  display: grid;
  gap: 14px;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 235, 0.92));
  border: 3px solid rgba(23, 58, 115, 0.08);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.auth-card {
  max-width: 520px;
}

.section-head {
  margin-bottom: 12px;
}

.section-head h2,
.section-head h3,
.trainer-head h2 {
  margin: 0 0 6px;
}

.split-head,
.trainer-head,
.toolbar-actions,
.search-sort,
.camera-actions,
.form-actions,
.stats-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.split-head,
.trainer-head {
  justify-content: space-between;
}

.trainer-panel {
  background:
    linear-gradient(135deg, rgba(46, 120, 255, 0.12), rgba(255, 255, 255, 0.96) 42%),
    linear-gradient(180deg, rgba(255, 250, 235, 0.95), rgba(255, 255, 255, 0.96));
}

.stats-row {
  margin-top: 12px;
}

.stat-pill {
  flex: 1 1 120px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 244, 204, 0.94));
  border: 1px solid rgba(23, 58, 115, 0.1);
}

.stat-pill strong {
  display: block;
  margin-top: 4px;
  font-size: 1.18rem;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.compact-head h3 {
  margin-bottom: 4px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(360px, 460px) minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
}

.capture-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.camera-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(28, 56, 109, 0.06), rgba(255, 255, 255, 0.8)),
    linear-gradient(135deg, rgba(255, 216, 79, 0.4), rgba(46, 120, 255, 0.12));
  border: 2px solid rgba(23, 58, 115, 0.1);
}

.camera-actions {
  align-items: stretch;
}

#scan-card-button {
  margin-left: auto;
}

.camera-actions button.is-active {
  background: linear-gradient(180deg, var(--green), #1d9b59);
  color: white;
  border-color: transparent;
  box-shadow: 0 12px 18px rgba(52, 184, 112, 0.22);
}

.camera-stage,
.photo-preview-shell {
  overflow: hidden;
  border-radius: 20px;
  border: 2px solid rgba(23, 58, 115, 0.12);
  background:
    linear-gradient(135deg, rgba(46, 120, 255, 0.14), rgba(255, 217, 79, 0.24));
  aspect-ratio: 5 / 6;
  min-height: 420px;
}

.camera-stage {
  position: relative;
}

.camera-stage video,
.photo-preview-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.camera-guide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.camera-guide-frame {
  position: relative;
  width: min(74vw, 310px);
  max-width: 80%;
  aspect-ratio: 63 / 88;
  border-radius: 22px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 999px rgba(11, 23, 45, 0.42),
    0 0 0 2px rgba(255, 217, 79, 0.55) inset;
}

.camera-guide-frame::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  border: 2px dashed rgba(255, 217, 79, 0.95);
}

.camera-guide-label {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(11, 23, 45, 0.74);
  color: #fff9d2;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-form,
.stack {
  display: grid;
  gap: 12px;
}

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

.collection-selector-block {
  display: grid;
  gap: 10px;
}

.collection-selector-head {
  display: grid;
  gap: 4px;
}

.collection-selector-head span {
  font-size: 0.92rem;
  font-weight: 800;
}

.collection-selector-head small {
  color: var(--ink-soft);
}

.collection-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  border: 2px solid rgba(23, 58, 115, 0.1);
  background: rgba(255, 255, 255, 0.82);
}

.collection-choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 249, 232, 0.88);
  border: 1px solid rgba(23, 58, 115, 0.08);
}

.collection-choice input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.collection-choice-copy {
  display: grid;
  gap: 2px;
}

.collection-choice-copy small {
  color: var(--ink-soft);
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 800;
}

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

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(23, 58, 115, 0.1);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(46, 120, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(46, 120, 255, 0.12);
}

textarea {
  resize: vertical;
  min-height: 108px;
}

button {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: white;
  background: linear-gradient(180deg, var(--blue), var(--blue-deep));
  box-shadow: 0 12px 20px rgba(46, 120, 255, 0.22);
}

button:hover {
  transform: translateY(-1px);
}

button.secondary-button {
  background: linear-gradient(180deg, var(--yellow), #ffc92a);
  color: var(--ink);
  box-shadow: 0 12px 18px rgba(248, 182, 0, 0.24);
}

button.ghost-button {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  box-shadow: none;
  border: 2px solid rgba(23, 58, 115, 0.12);
}

button.danger-button {
  background: linear-gradient(180deg, var(--red), var(--red-deep));
}

.screen-nav {
  display: inline-flex;
  gap: 10px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(23, 58, 115, 0.06);
}

.sidebar-screen-nav {
  display: grid;
  width: 100%;
  gap: 8px;
}

.screen-tab {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  border: 2px solid transparent;
}

.screen-tab.active {
  background: linear-gradient(180deg, var(--blue), var(--blue-deep));
  color: white;
  box-shadow: 0 10px 18px rgba(46, 120, 255, 0.2);
}

.screen-stack {
  display: grid;
  gap: 18px;
}

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

.collection-list {
  margin-top: 14px;
}

.collection-button {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 18px;
  border: 2px solid rgba(23, 58, 115, 0.08);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: none;
}

.collection-button.active {
  background: linear-gradient(135deg, rgba(46, 120, 255, 0.12), rgba(255, 217, 79, 0.46));
  border-color: rgba(46, 120, 255, 0.24);
}

.collection-topline,
.card-actions,
.card-chip-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.collection-topline {
  justify-content: space-between;
}

.collection-name {
  font-size: 1rem;
}

.collection-count,
.collection-meta {
  font-size: 0.84rem;
}

.table-shell {
  margin-top: 10px;
  overflow: hidden;
  border-radius: 18px;
  border: 2px solid rgba(23, 58, 115, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.cards-table {
  width: 100%;
  border-collapse: collapse;
}

.cards-table th,
.cards-table td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(23, 58, 115, 0.08);
  vertical-align: middle;
}

.cards-table th {
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(46, 120, 255, 0.06);
}

.cards-table tbody tr:hover {
  background: rgba(255, 217, 79, 0.12);
}

.table-card-cell {
  display: flex;
  gap: 12px;
  align-items: center;
}

.table-thumb {
  width: 48px;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(23, 58, 115, 0.08);
}

.thumb-button {
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.thumb-button:hover {
  transform: none;
}

.card-chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.77rem;
  font-weight: 900;
  background: rgba(46, 120, 255, 0.1);
  color: var(--blue-deep);
}

.card-chip.rarity {
  background: rgba(255, 217, 79, 0.3);
  color: #6c4b00;
}

.mini-button {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.84rem;
  box-shadow: none;
}

.mini-button.secondary {
  background: rgba(46, 120, 255, 0.1);
  color: var(--blue-deep);
}

.mini-button.danger {
  background: rgba(239, 83, 80, 0.12);
  color: var(--red-deep);
}

.empty,
.empty-state {
  padding: 14px;
  border-radius: 14px;
  border: 2px dashed rgba(23, 58, 115, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 23, 45, 0.64);
  backdrop-filter: blur(4px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 253, 244, 0.98), rgba(255, 249, 232, 0.98));
  border: 3px solid rgba(23, 58, 115, 0.1);
  box-shadow: 0 20px 40px rgba(11, 23, 45, 0.28);
}

.modal-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: none;
  border: 2px solid rgba(23, 58, 115, 0.12);
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.modal-image-shell {
  overflow: hidden;
  border-radius: 20px;
  border: 2px solid rgba(23, 58, 115, 0.1);
  background: linear-gradient(135deg, rgba(46, 120, 255, 0.08), rgba(255, 217, 79, 0.2));
}

.modal-image-shell img {
  display: block;
  width: 100%;
  height: auto;
}

.modal-copy h2 {
  margin: 0 0 10px;
}

.detail-list {
  margin: 14px 0 0;
}

.detail-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(23, 58, 115, 0.08);
}

.detail-row dt {
  font-weight: 900;
  color: var(--ink-soft);
}

.detail-row dd {
  margin: 0;
}

.modal-notes {
  margin-top: 16px;
}

.modal-notes h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.modal-notes p {
  margin: 0;
  line-height: 1.55;
  color: var(--ink-soft);
  white-space: pre-line;
}

@media (max-width: 1280px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .workspace,
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-orb {
    display: none;
  }
}

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 18px, 1380px);
    padding-top: 10px;
  }

  .panel {
    padding: 14px;
  }

  .camera-stage,
  .photo-preview-shell {
    min-height: 340px;
  }

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

  .screen-nav {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .sidebar-screen-nav {
    grid-template-columns: 1fr;
  }

  .cards-table thead {
    display: none;
  }

  .cards-table,
  .cards-table tbody,
  .cards-table tr,
  .cards-table td {
    display: block;
    width: 100%;
  }

  .cards-table tr {
    padding: 10px 0;
  }

  .cards-table td {
    border-bottom: 0;
    padding: 8px 14px;
  }

  .table-card-cell {
    align-items: flex-start;
  }

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

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

  .camera-guide-frame {
    max-width: 84%;
  }
}
