/* Editor page. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: rgba(245, 248, 252, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(28, 30, 33, 0.08);
}

.topbar__inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar__title {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.topbar__status {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

.topbar__status[data-kind="error"] {
  color: #c0392b;
}

.topbar__actions {
  display: flex;
  gap: 10px;
  flex: none;
}

.editor {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 24px calc(56px + env(safe-area-inset-bottom));
}

.panel {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(28, 30, 33, 0.06);
  border-radius: 16px;
  padding: 18px 20px;
}

.panel--settings {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.setting--range {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 56px;
  align-items: center;
  gap: 16px;
}

.setting__label {
  font-size: 16px;
}

.setting__value {
  font-size: 14px;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 11px 0;
  border-radius: 2px;
  background: rgba(28, 30, 33, 0.16);
  outline: none;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(28, 30, 33, 0.18);
  box-shadow: 0 1px 4px rgba(28, 30, 33, 0.2);
  cursor: pointer;
}

.range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(28, 30, 33, 0.18);
  box-shadow: 0 1px 4px rgba(28, 30, 33, 0.2);
  cursor: pointer;
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.25);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--text);
}

.hint {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.games {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.games__empty {
  margin: 0;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.game {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  background: #fff;
  border: 1px solid rgba(28, 30, 33, 0.06);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(28, 30, 33, 0.04);
}

.game--busy {
  opacity: 0.6;
  pointer-events: none;
}

.game__media {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.game__art {
  aspect-ratio: var(--card-ratio);
  background: var(--card-placeholder);
  /* Thumbnails are roughly 40% of the iPad card width, so scale the radius to match. */
  border-radius: calc(var(--card-radius) * 0.4);
  overflow: hidden;
}

.game__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game__art img[hidden] {
  display: none;
}

.game__fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

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

.game__index {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.game__order {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(28, 30, 33, 0.14);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:not(:disabled):hover {
  background: #f2f4f7;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.field {
  display: block;
}

.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.field__label em {
  font-style: normal;
  opacity: 0.8;
}

.field__input {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: 16px; /* 16px stops iOS from zooming on focus */
  color: var(--text);
  background: #fff;
  border: 1px solid rgba(28, 30, 33, 0.16);
  border-radius: 10px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 119, 242, 0.18);
}

.game__foot {
  display: flex;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(28, 30, 33, 0.14);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: #f2f4f7;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.btn--primary:hover {
  background: #2f3236;
}

.btn--danger {
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.3);
}

.btn--danger:hover {
  background: #fdf2f1;
}

.btn--block {
  width: 100%;
}

.btn--large {
  min-height: 48px;
  padding: 0 24px;
  font-size: 16px;
}

.editor__footer {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

@media (max-width: 640px) {
  .topbar__inner {
    padding: 12px 16px;
  }

  .editor {
    padding-left: 16px;
    padding-right: 16px;
  }

  .game {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .game__media {
    flex-direction: row;
    align-items: flex-end;
  }

  .game__art {
    width: 110px;
    flex: none;
  }
}

/* Says plainly when something has not reached the server yet */
.banner {
  margin: 0 0 20px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(28, 30, 33, 0.12);
  background: #fff6e5;
  color: #6b4900;
  font-size: 15px;
  line-height: 1.45;
}

.banner[data-kind='error'] {
  background: #fdecec;
  color: #8a1c1c;
}

.banner[hidden] {
  display: none;
}

/* Undo: pick an earlier version of the list */
.setting--restore {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.setting--restore[hidden] {
  display: none;
}

.select {
  min-height: 40px;
  max-width: 100%;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(28, 30, 33, 0.14);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

/* QR code for a card: preview beside its upload button and URL field */
.game__qr {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.game__qr-art {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(28, 30, 33, 0.14);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.game__qr-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.game__qr-actions {
  display: grid;
  gap: 10px;
}

/* Which list is being edited */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(28, 30, 33, 0.06);
}

.tab {
  flex: 1;
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tab--active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(28, 30, 33, 0.12);
}

.tab:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Preview clip for a card: a small player beside its upload button and URL */
.game__video {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.game__video-art {
  aspect-ratio: var(--card-ratio);
  border-radius: 12px;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.game__video-art video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game__video-actions {
  display: grid;
  gap: 10px;
}

.hint--tight {
  margin: 0;
  font-size: 12px;
}

/* Trackable QR links page */
.links {
  display: grid;
  gap: 20px;
}

.add-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 14px;
  align-items: end;
}

.link {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.link__qr {
  display: block;
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid rgba(28, 30, 33, 0.14);
  background: #fff;
  overflow: hidden;
}

.link__qr img {
  display: block;
  width: 100%;
  height: 100%;
}

.link__fields {
  display: grid;
  gap: 14px;
}

.link__address {
  display: flex;
  gap: 10px;
  align-items: center;
}

.link__code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(28, 30, 33, 0.05);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.link__scans {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.link__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .link,
  .add-link {
    grid-template-columns: 1fr;
  }
}

/* Per-platform destinations on a link */
.link__stores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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