:root {
  --electric-blue: #2563ff;
  --electric-blue-hover: #144bcc;
  --cyan-signal: #00a9cc;
  --neon-purple: #9333ff;
  --signal-orange: #ff6b00;
  --bg: #f0f4ff;
  --surface: #fff;
  --surface-elevated: #e8efff;
  --ink: #030910;
  --ink-muted: #1a2d4d;
  --ink-soft: #526680;
  --border: rgba(37, 99, 255, 0.18);
  --border-strong: rgba(37, 99, 255, 0.34);
  --danger: #b42318;
  --success: #087f6b;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px rgba(37, 99, 255, 0.14);
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-display: "Cinzel", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  background:
    linear-gradient(118deg, rgba(0, 212, 255, 0.12), transparent 42%),
    linear-gradient(232deg, rgba(147, 51, 255, 0.1), transparent 38%),
    linear-gradient(180deg, #fbfcff, var(--bg));
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 12%, rgba(3, 9, 16, 0.9) 50%, transparent 52%),
    radial-gradient(1px 1px at 22% 38%, rgba(37, 99, 255, 0.7) 50%, transparent 52%),
    radial-gradient(1px 1px at 67% 18%, rgba(0, 169, 204, 0.7) 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 84% 72%, rgba(147, 51, 255, 0.6) 50%, transparent 52%);
  background-size: 280px 320px, 420px 380px, 360px 400px, 300px 300px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(1160px, calc(100% - 2rem));
  margin-inline: auto;
}

.boot,
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.boot {
  color: var(--ink-muted);
}

.login-card {
  width: min(440px, 100%);
  padding: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 107, 0, 0.06), rgba(37, 99, 255, 0.08)),
    var(--surface);
  box-shadow: var(--shadow);
}

.logo {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-link {
  padding: 0.28rem 0.65rem;
  border: 1px solid rgba(255, 107, 0, 0.4);
  border-radius: 999px;
  background: rgba(255, 107, 0, 0.09);
  color: #b84d00;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
}

.admin-link:hover {
  border-color: var(--signal-orange);
  background: rgba(255, 107, 0, 0.16);
}

.eyebrow {
  margin: 1.5rem 0 0.45rem;
  color: var(--electric-blue);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.login-card h1,
.page-heading h1,
.dialog h2 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.2;
}

.login-lede,
.dialog-lede {
  color: var(--ink-muted);
  margin: 0.6rem 0 1.5rem;
}

.back-link {
  display: inline-block;
  margin-top: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  text-decoration: none;
}

.signup-prompt {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.signup-prompt p,
.confirmation-copy {
  margin: 0 0 0.8rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.back-button {
  margin-top: 1.15rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
}

.back-button:hover {
  color: var(--electric-blue);
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field > span,
.public-url label {
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.verification-badge {
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(8, 127, 107, 0.12);
  color: var(--success);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.verification-badge--checking {
  background: rgba(37, 99, 255, 0.1);
  color: var(--electric-blue);
}

.field input,
.field select,
.public-url input {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.public-url input:focus {
  outline: 3px solid rgba(37, 99, 255, 0.16);
  border-color: var(--electric-blue);
}

.field > .password-input {
  position: relative;
  display: block;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.password-input input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: rgba(37, 99, 255, 0.1);
  color: var(--electric-blue);
}

.password-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.forgot-password-link {
  display: block;
  margin: -0.35rem 0 1rem auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--electric-blue);
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.readonly-value {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  color: var(--ink-muted);
  font-weight: 600;
}

.button {
  appearance: none;
  min-height: 42px;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--signal-orange), var(--electric-blue) 48%, #5b4dff);
  box-shadow: 0 5px 18px rgba(37, 99, 255, 0.23);
}

.button--primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.button--quiet {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-muted);
}

.button--danger {
  color: #fff;
  background: var(--danger);
}

.button--danger-quiet {
  border-color: rgba(180, 35, 24, 0.35);
  background: rgba(180, 35, 24, 0.06);
  color: var(--danger);
}

.button--wide {
  width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(251, 252, 255, 0.9);
  backdrop-filter: blur(14px);
}

.header-inner {
  min-height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
}

.app-nav {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.nav-button {
  padding: 0.55rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-weight: 600;
}

.nav-button.is-active {
  color: var(--electric-blue);
  background: rgba(37, 99, 255, 0.1);
}

.account-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.gear-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 1.05rem;
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}

.gear-button:hover {
  color: var(--electric-blue);
  border-color: var(--electric-blue);
  transform: rotate(25deg);
}

.page-section {
  padding: clamp(2rem, 5vw, 4rem) 0;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.page-heading .eyebrow,
.dialog-head .eyebrow {
  margin-top: 0;
}

.page-heading h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.page-heading p:not(.eyebrow) {
  margin: 0.55rem 0 0;
  color: var(--ink-muted);
}

.loading-card,
.empty-state {
  padding: 3rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
  text-align: center;
  color: var(--ink-muted);
}

.empty-state h2 {
  margin: 0.4rem 0;
  font-family: var(--font-display);
}

.empty-state p {
  margin: 0 auto 1.25rem;
  max-width: 35rem;
}

.empty-icon {
  color: var(--signal-orange);
  font-size: 2rem;
}

.frame-grid,
.library-grid {
  display: grid;
  gap: 1.25rem;
}

.frame-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.library-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.frame-card,
.library-card {
  min-height: 290px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(37, 99, 255, 0.09);
}

.frame-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
  padding: 1.35rem;
}

.frame-thumbnail {
  appearance: none;
  width: 112px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  cursor: zoom-in;
}

.frame-thumbnail:hover,
.frame-thumbnail:focus-visible {
  border-color: var(--electric-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 255, 0.14);
}

.frame-preview {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 20%, rgba(0, 212, 255, 0.22), transparent 40%),
    linear-gradient(145deg, #08101d, #17253c);
  color: #b8c7df;
}

.frame-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.frame-summary {
  min-width: 0;
}

.frame-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.frame-summary h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.35;
}

.frame-details {
  display: grid;
  gap: 0.45rem;
  margin: 0.85rem 0;
}

.frame-details div {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.5rem;
}

.frame-details dt,
.card-public-url label {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.frame-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.inline-editable {
  min-width: 2rem;
  padding: 0.12rem 0.25rem;
  border-radius: 5px;
  cursor: text;
  transition: background 0.15s, box-shadow 0.15s;
}

.inline-editable:hover {
  background: rgba(37, 99, 255, 0.08);
}

.inline-editable:focus {
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 255, 0.18);
}

.inline-editable--title {
  flex: 1;
}

.inline-editable.is-saving {
  cursor: wait;
  opacity: 0.6;
}

.inline-edit-form {
  margin: 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.inline-metadata-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
}

.inline-edit-field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.65rem;
}

.inline-edit-field > span {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inline-edit-field input,
.inline-edit-field select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.inline-edit-field input:focus,
.inline-edit-field select:focus {
  outline: 3px solid rgba(37, 99, 255, 0.16);
  border-color: var(--electric-blue);
}

.inline-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inline-edit-actions .button {
  min-height: 36px;
  padding: 0.42rem 0.72rem;
  font-size: 0.76rem;
}

.card-edit-message {
  margin: 0 0 0.65rem;
  color: var(--success);
  font-size: 0.76rem;
}

.card-edit-message.message--error {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
}

.card-public-url > div {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.card-public-url input {
  min-width: 0;
  width: 100%;
  padding: 0.48rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
}

.card-public-url .button {
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  font-size: 0.76rem;
}

.preview-placeholder {
  max-width: 18rem;
  padding: 0.65rem;
  text-align: center;
  font-size: 0.72rem;
}

.card-body {
  padding: 1.15rem;
}

.card-body h2,
.card-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.card-meta {
  margin: 0.3rem 0 1rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(8, 127, 107, 0.1);
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 700;
}

.status--inactive {
  background: rgba(82, 102, 128, 0.12);
  color: var(--ink-soft);
}

.library-card {
  padding: 1.35rem;
  border-top: 4px solid var(--electric-blue);
}

.library-card:nth-child(3n + 2) {
  border-top-color: var(--signal-orange);
}

.library-card:nth-child(3n + 3) {
  border-top-color: var(--neon-purple);
}

.library-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 32%);
  align-items: start;
  gap: 1.25rem;
}

.library-card-main--text-only {
  grid-template-columns: minmax(0, 1fr);
}

.library-card-content {
  min-width: 0;
}

.library-thumbnail-button {
  appearance: none;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: zoom-in;
}

.library-thumbnail-button:hover,
.library-thumbnail-button:focus-visible {
  outline: 3px solid rgba(37, 99, 255, 0.2);
}

.library-thumbnail {
  width: 100%;
  max-height: 220px;
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  object-fit: contain;
}

.sample-preview-stage {
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: #fff;
}

.sample-preview-stage img {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.library-card p {
  color: var(--ink-muted);
}

.library-card .library-description {
  max-width: 42rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.type-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0;
}

.type-details span {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.message {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(37, 99, 255, 0.25);
  border-radius: 10px;
  background: rgba(37, 99, 255, 0.08);
  color: var(--ink-muted);
}

.message--error {
  border-color: rgba(180, 35, 24, 0.3);
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.dialog {
  width: min(650px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.5rem;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: #fbfcff;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(3, 9, 16, 0.34);
}

.dialog--preview {
  width: min(780px, calc(100% - 2rem));
}

.dialog--confirm {
  width: min(500px, calc(100% - 2rem));
}

.dialog--confirm > p:not(.message) {
  color: var(--ink-muted);
}

.dialog::backdrop {
  background: rgba(3, 9, 16, 0.68);
  backdrop-filter: blur(5px);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  font-size: 1.4rem;
}

.preview-stage {
  min-height: 300px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: #0a1220;
  color: #c2d0e6;
}

.preview-stage img {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

.detail-list div {
  padding: 0.7rem;
  border-radius: 10px;
  background: var(--surface-elevated);
}

.detail-list dt {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
}

.public-url > div {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.account-container {
  max-width: 900px;
}

.account-grid {
  display: grid;
  gap: 1.25rem;
}

.settings-card {
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 10px 32px rgba(37, 99, 255, 0.09);
}

.settings-card h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.current-email-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem;
  border-radius: 12px;
  background: var(--surface-elevated);
}

.current-email-row > div {
  min-width: 0;
  margin-right: auto;
}

.current-email-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.settings-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.settings-form,
.verification-form {
  max-width: 560px;
  margin-top: 1.25rem;
}

.verification-form {
  padding: 1rem;
  border: 1px solid rgba(37, 99, 255, 0.25);
  border-radius: 12px;
  background: rgba(37, 99, 255, 0.06);
}

.verification-form p {
  margin: 0 0 0.85rem;
  color: var(--ink-muted);
}

.settings-note {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-left: 4px solid var(--signal-orange);
  border-radius: 8px;
  background: rgba(255, 107, 0, 0.09);
  color: var(--ink-muted);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

@media (max-width: 760px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    padding-block: 0.75rem;
  }

  .app-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    order: 3;
  }

  .account-menu span {
    display: none;
  }

  .current-email-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .detail-list,
  .frame-grid {
    grid-template-columns: 1fr;
  }

  .frame-card {
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 1rem;
  }

  .frame-thumbnail {
    width: 88px;
  }

  .library-card-main {
    grid-template-columns: minmax(0, 1fr) minmax(100px, 32%);
    gap: 0.85rem;
  }
}
