/* lcs-web shell. Tokens and .btn/.card/.chip/.input/.tabs come from
   prismfield.css, which must be linked first. Nothing here redefines a kit
   component; this is layout plus the few pieces the kit doesn't have.
   Same rule as Creator Studio: lime is the one saturated accent, and it
   belongs to the primary action on each screen (here, Send). */

[hidden] { display: none !important; }

body { margin: 0; font-family: var(--font-body); color: var(--color-ink); background: var(--color-paper); }

.frame { padding: 12px; }
.frame::after { inset: 12px; }
.canvas { min-height: calc(100vh - 24px); display: flex; flex-direction: column; }

@media (max-width: 640px) {
  .frame { padding: 6px; }
  .frame::after { inset: 6px; }
  .canvas { min-height: calc(100vh - 12px); }
}

/* ---------- Topbar ------------------------------------------------------- */

.topbar { flex-wrap: wrap; padding: var(--space-md) var(--space-lg); }
.topbar__brand { gap: var(--space-sm); color: inherit; text-decoration: none; }
.brand-icon { width: 32px; height: 32px; border-radius: var(--radius-full); }
.topbar__wordmark {
  margin: 0;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar__wordmark small {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-mute);
}
.topbar__actions { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.whoami { font-size: var(--text-body-sm); color: var(--color-graphite); }

.theme-toggle {
  display: inline-flex;
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.theme-opt {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--color-mute);
  cursor: pointer;
}
.theme-opt:hover { color: var(--color-ink); }
.theme-opt[aria-pressed="true"] { background: var(--color-canvas-soft); color: var(--color-ink); }

/* ---------- Page layout -------------------------------------------------- */

.page {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  display: grid;
  gap: var(--space-lg);
  align-content: start;
}

.page--narrow { max-width: 880px; }

.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-lg); flex-wrap: wrap; }
.page__title { margin: 0; font-family: var(--font-display); font-size: var(--text-display-md); font-weight: 600; letter-spacing: var(--tracking-tight); }
.page__lede { margin: var(--space-xs) 0 0; color: var(--color-graphite); font-size: var(--text-body-md); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-lg); align-items: start; }
.split__side { display: grid; gap: var(--space-lg); }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-lg); }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; } }

.card:hover { box-shadow: none; border-color: var(--color-hairline); } /* these cards aren't clickable */

.form-row { display: flex; gap: var(--space-sm); align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 140px; }
.hint { font-size: var(--text-body-sm); color: var(--color-graphite); margin: 0; }
.error { font-size: var(--text-body-sm); color: var(--color-danger); margin: 0; }
.danger { --btn-fg: var(--color-danger); }

.copy-field { display: flex; gap: var(--space-sm); }
.copy-field .input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: var(--text-body-sm); }

/* ---------- Status ------------------------------------------------------- */

.chip__dot--off { background: var(--color-mute); }
.chip__dot--warn { background: var(--color-prism-amber); }
.chip__dot--bad { background: var(--color-danger); }

/* ---------- Key reveal --------------------------------------------------- */

.key-reveal {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-lime-soft);
}
.key-reveal__key {
  font-family: var(--font-pixel);
  font-size: 30px;
  letter-spacing: 0.08em;
  line-height: 1;
  user-select: all;
  word-break: break-all;
}

/* ---------- Lists -------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list__item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-top: var(--border-hairline);
  min-width: 0;
}
.list__item:first-child { border-top: 0; }
.list__main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list__title { font-weight: 600; font-size: var(--text-body-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { font-size: var(--text-body-sm); color: var(--color-graphite); }
.list__thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; background: var(--color-canvas-soft); flex: none; }
.list__empty { color: var(--color-mute); font-size: var(--text-body-sm); padding: var(--space-sm) 0; }
.list__item.is-inactive .list__title { color: var(--color-mute); text-decoration: line-through; }

/* ---------- GIF picker --------------------------------------------------- */

.picker { display: grid; gap: var(--space-md); }
.picker__bar { display: flex; gap: var(--space-sm); align-items: center; }
.picker__bar .input--search { flex: 1; }

/* A plain grid, not masonry: CSS columns reshuffle every tile when the next
   page loads, which moves the GIF a mod was about to tap. */
.picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-sm);
}
.gif-tile {
  display: block;
  width: 100%;
  height: 140px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-canvas-soft);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.gif-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) {
  .picker__grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .gif-tile { height: 110px; }
}
.gif-tile:hover { border-color: var(--color-hairline-strong); }
.gif-tile:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.gif-tile[aria-pressed="true"] { border-color: var(--color-ink); }

.picker__more { justify-self: center; }
.picker__status { text-align: center; color: var(--color-mute); font-size: var(--text-body-sm); padding: var(--space-xl) 0; }
.picker__attribution { justify-self: end; font-size: var(--text-label-sm); color: var(--color-mute); letter-spacing: var(--tracking-label); text-transform: uppercase; }

/* The selected GIF + Send. Sticks to the bottom of the viewport so Send is
   always one tap away however far down the grid a mod has scrolled. */
.sendbar {
  position: sticky;
  bottom: var(--space-md);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--color-canvas);
  box-shadow: var(--shadow-pop);
  flex-wrap: wrap;
}
.sendbar__thumb { width: 56px; height: 56px; border-radius: var(--radius-sm); object-fit: cover; background: var(--color-canvas-soft); }
.sendbar__main { flex: 1; min-width: 120px; display: grid; gap: 2px; }
.sendbar__title { font-weight: 600; font-size: var(--text-body-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stepper { display: inline-flex; align-items: center; border: var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.stepper button { width: 30px; height: 30px; border: 0; background: var(--color-canvas); color: var(--color-ink); font-size: 16px; cursor: pointer; }
.stepper button:hover { background: var(--color-canvas-soft); }
.stepper button:disabled { color: var(--color-mute); cursor: default; }
.stepper output { min-width: 64px; text-align: center; font-size: var(--text-body-sm); font-weight: 600; }

/* ---------- Toast -------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  background: var(--color-ink);
  color: var(--color-canvas);
  font-size: var(--text-body-sm);
  font-weight: 600;
  box-shadow: var(--shadow-pop);
  transition: opacity var(--duration-base) var(--ease-standard), transform var(--duration-base) var(--ease-standard);
  z-index: 50;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast--bad { background: var(--color-danger); color: #fff; }

/* ---------- Creator tabs (mod view) ------------------------------------- */

.creator-tabs { display: flex; gap: var(--space-xs); flex-wrap: wrap; }

.footer {
  margin-top: auto;
  padding: var(--space-md) var(--space-lg);
  border-top: var(--border-hairline);
  font-size: var(--text-label-sm);
  color: var(--color-mute);
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}
