:root {
  --bg-base: #09090b;
  --bg-surface: #111115;
  --bg-surface-hover: #16161c;
  --bg-elevated: #18181f;
  --bg-input: #0d0d11;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-focus: #8b5cf6;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --emerald: #10b981;
  --danger: #f43f5e;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 24px 64px -12px rgba(0, 0, 0, 0.85);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.ambient-glow {
  position: fixed;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 960px;
  height: 440px;
  background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.16) 0%, rgba(16, 185, 129, 0.05) 45%, transparent 75%);
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.brand-logo-core {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

.brand-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-name {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.48rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.autosave-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  margin-right: 0.25rem;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.52rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.38);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: #22222b;
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.14);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.24);
  color: #ffffff;
}

.btn-sm {
  font-size: 0.78rem;
  padding: 0.38rem 0.72rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  font-size: 0.92rem;
  padding: 0.68rem 1.25rem;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #a78bfa;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease;
}

.link-btn:hover {
  color: #c4b5fd;
  text-decoration: underline;
}

/* ==========================================================================
   HERO & METRICS
   ========================================================================== */
.container {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.75rem;
}

.hero-main {
  max-width: 640px;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a78bfa;
  margin-bottom: 0.55rem;
}

.hero-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.85rem, 3.2vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: #ffffff;
}

.hero-subtitle {
  margin: 0 0 1.35rem;
  color: var(--text-secondary);
  font-size: 0.96rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-metrics {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.metric-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.metric-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   TOOLBAR (SEARCH, FILTER, SORT)
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.search-field {
  position: relative;
  flex: 1 1 320px;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.58rem 2.2rem 0.58rem 2.35rem;
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-field input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.search-clear {
  position: absolute;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.2rem 0.4rem;
}

.search-clear:hover {
  color: var(--text-primary);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.segment-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 0.36rem 0.78rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segment-btn:hover {
  color: var(--text-primary);
}

.segment-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.select-input {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.52rem 0.85rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* ==========================================================================
   DIMENSIONS GRID & CARDS
   ========================================================================== */
.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.25rem;
}

.dimension-card {
  --portal-accent: #8b5cf6;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  position: relative;
}

.dimension-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--portal-accent);
  opacity: 0.85;
  z-index: 2;
}

.dimension-card:hover {
  transform: translateY(-3px);
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow-card);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #070709;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.dimension-card:hover .card-media img {
  transform: scale(1.03);
}

.card-badges-top {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  right: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.portal-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #e4e4e7;
}

.portal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--portal-accent);
  box-shadow: 0 0 8px var(--portal-accent);
}

.photo-count-pill {
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e4e4e7;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.card-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.3;
}

.easter-pill {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.25);
  flex-shrink: 0;
}

/* Sleek Book & Quill Phrase Bar */
.book-phrase-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0.42rem 0.65rem;
}

.book-phrase-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.book-label-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.book-phrase-code {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: #c4b5fd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-mini-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.copy-mini-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.card-description {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-entities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.25rem;
}

.entity-tag {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.entity-tag-empty {
  color: var(--text-muted);
  background: transparent;
  border-style: dashed;
}

.card-footer {
  padding: 0.75rem 1.15rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.discoverer {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.player-avatar {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--border-medium);
  flex-shrink: 0;
  image-rendering: pixelated;
}

.discoverer-meta {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.discoverer-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discoverer-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.icon-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 0.26rem 0.5rem;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.icon-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.icon-action-btn.liked {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.12);
}

.icon-action-btn.delete:hover {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.14);
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-lg);
}

.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.empty-state h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.empty-state p {
  margin: 0 auto 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  max-width: 42ch;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow-y: auto;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: #121217;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  animation: modalSlide 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog-lg {
  max-width: 860px;
}

@keyframes modalSlide {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.draft-pill {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.icon-close-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.icon-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.35rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.error-banner {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fecdd3;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.form-group-block {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.block-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.block-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.14rem 0.48rem;
  border-radius: 4px;
}

.tag-required {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
}

.tag-optional {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.block-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.inline-links {
  display: flex;
  gap: 0.65rem;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e4e4e7;
}

.req-mark {
  color: #a78bfa;
  font-weight: 700;
}

.text-input,
.textarea-input {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.58rem 0.78rem;
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mono-input {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.84rem;
}

.text-input:focus,
.textarea-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.textarea-input {
  resize: vertical;
}

.field-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.field-meta code {
  color: #a78bfa;
  font-family: 'JetBrains Mono', monospace;
}

.field-help {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* Upload Dropzone */
.counter-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

.counter-badge.valid {
  color: var(--emerald);
}

.upload-dropzone {
  border: 1px dashed var(--border-medium);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 1rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.06);
}

.dropzone-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dropzone-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropzone-copy {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}

.dropzone-headline {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-primary);
}

.dropzone-headline kbd {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.08rem 0.32rem;
  border-radius: 4px;
  font-size: 0.74rem;
}

.dropzone-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dropzone-btns {
  display: flex;
  gap: 0.45rem;
}

.url-bar {
  display: flex;
  gap: 0.5rem;
}

.thumbs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.55rem;
}

.uploaded-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1px solid var(--border-medium);
  background: #000;
}

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

.thumb-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(9, 9, 11, 0.82);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 0.08rem 0.38rem;
  border-radius: 4px;
}

.thumb-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(9, 9, 11, 0.82);
  color: #fda4af;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-remove-btn:hover {
  background: var(--danger);
  color: #fff;
}

/* Portal Color Controls */
.color-control-box {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.portal-live-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.portal-live-swatch input[type='color'] {
  position: absolute;
  inset: -6px;
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  cursor: pointer;
}

.swatch-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.swatch-pill {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.swatch-pill:hover,
.swatch-pill.active {
  transform: scale(1.15);
  border-color: #ffffff;
}

/* Player Nickname Input */
.nickname-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.avatar-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-box svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

/* Entities Input & Suggestions */
.entities-input-bar {
  display: flex;
  gap: 0.5rem;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.selected-entity-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-soft);
  color: #ddd6fe;
  border: 1px solid rgba(139, 92, 246, 0.35);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
}

.selected-entity-tag button {
  background: none;
  border: none;
  color: #c4b5fd;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0;
  line-height: 1;
}

.selected-entity-tag button:hover {
  color: #ffffff;
}

.mob-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 112px;
  overflow-y: auto;
  padding-top: 0.2rem;
}

.mob-chip-btn {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.mob-chip-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.mob-chip-btn.selected {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-footer-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* ==========================================================================
   DETAIL MODAL
   ========================================================================== */
.detail-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.35rem;
}

.detail-main-shot {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #070709;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

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

.detail-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  overflow-x: auto;
}

.detail-thumb-btn {
  width: 72px;
  height: 46px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  background: #000;
  cursor: pointer;
  flex-shrink: 0;
}

.detail-thumb-btn.active {
  border-color: var(--accent);
}

.detail-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.detail-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.detail-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-book-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: #c4b5fd;
  word-break: break-word;
}

.detail-warp-row {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.detail-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ==========================================================================
   TOASTS
   ========================================================================== */
.toast-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: #18181f;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  animation: modalSlide 0.16s ease;
}

@media (max-width: 820px) {
  .form-row-2col,
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 560px) {
  .dimensions-grid {
    grid-template-columns: 1fr;
  }
  .navbar-inner {
    padding: 0.7rem 1rem;
  }
  .container {
    padding: 1.25rem 1rem 3rem;
  }
}
