
.aoca-overlay {
  --charcoal: hsl(271 45% 9%);
  --pebble: rgb(237, 237, 237);
  --ivory: #fff;
  --surface: rgba(237, 237, 237, 0.05);
  --surface-10: rgba(237, 237, 237, 0.1);
  --border: rgba(237, 237, 237, 0.2);
  --text-primary: rgb(237, 237, 237);
  --text-secondary: rgba(237, 237, 237, 0.8);
  --montra: var(--font-montra, 'montra', sans-serif);
  --bricolage: var(--font-bricolage, 'Bricolage Grotesque', sans-serif);
}


.aoca-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);              
  backdrop-filter: blur(5px);                  
  -webkit-backdrop-filter: blur(5px);
}
.aoca-modal {
  position: relative;
  width: min(880px, 92vw);
  max-width: 880px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 32px;                         
  background: var(--charcoal);                 
  color: var(--text-primary);
  font-family: var(--bricolage);
}
.aoca-close-wrap {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;                                 
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 50%;
  z-index: 3;
}
.aoca-close {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.aoca-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: min(560px, 90vh);
}
.aoca-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 32%, var(--surface), var(--charcoal));
}
.aoca-preview-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}
.aoca-character {
  position: relative;
  z-index: 1;
  height: 85%;
  max-height: 460px;
  aspect-ratio: 320 / 400;
}
.aoca-preview-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.aoca-dl {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  gap: 4px;
}
.aoca-dl-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(6px);
  color: var(--ivory);
  font-family: var(--bricolage);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.aoca-dl-btn span { font-size: inherit; min-width: 1.75em; }
.aoca-dl-btn:hover { background: rgba(0, 0, 0, 0.32); }
.aoca-dl-btn:disabled { opacity: 0.5; cursor: default; }


.aoca-dl-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(6px);
  color: var(--ivory);
  font-family: var(--bricolage);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}
.aoca-dl-toggle span { font-size: inherit; }
.aoca-dl-toggle input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--ivory);
  cursor: pointer;
}
.aoca-dl-toggle:has(input:disabled) { opacity: 0.5; cursor: default; }

.aoca-editor {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 24px 24px;
  background: var(--charcoal);
  min-width: 0;
  min-height: 0;
}
.aoca-title {
  font-size: 1.5rem;
  font-weight: 500;
  font-family: var(--montra);
  color: var(--text-primary);
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.aoca-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
  min-height: 0;
  align-content: start;
  scrollbar-width: none;
}
.aoca-grid::-webkit-scrollbar { display: none; }
.aoca-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aoca-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.aoca-tile:hover { border-color: var(--border); }
.aoca-tile:active { transform: scale(0.97); }
.aoca-tile-selected,
.aoca-tile-selected:hover { border-color: var(--text-primary); }
.aoca-tile-none {
  font-family: var(--bricolage);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.aoca-tile-skeleton {
  cursor: default;
  background: var(--surface-10);
  animation: aoca-pulse 1.4s ease-in-out infinite;
}
@keyframes aoca-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.aoca-tile-locked .aoca-tile-img {
  opacity: 0.55;
  filter: saturate(0.7);
}
.aoca-chip-test {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  padding: 1px 5px;
  border-radius: 4px;
  background: hsl(23, 100%, 50%);
  color: var(--charcoal);
  font: 700 9px/1.4 var(--bricolage);
  letter-spacing: 0.04em;
}
.aoca-pill {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 20px;
  border-radius: 9999px;
  background: hsla(271, 45%, 9%, 0.85);
  color: var(--text-primary);
  font: 600 11px var(--bricolage);
  white-space: nowrap;
}
.aoca-pill-wearing {
  background: var(--pebble);
  color: var(--charcoal);
}
.aoca-coin {
  width: 12px;
  height: 12px;
}
.aoca-stage-pill {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  margin: 0;
  padding: 4px 10px;
  border-radius: 9999px;
  background: hsla(271, 45%, 9%, 0.8);
  color: var(--text-primary);
  font: 600 12px var(--bricolage);
}
.aoca-lockbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-primary);
  font: 500 13px var(--bricolage);
}
.aoca-lockbar[hidden],
.aoca-stage-pill[hidden] {
  display: none;
}
.aoca-lockbar-text {
  min-width: 0;
}
.aoca-lockbar-cta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 9999px;
  background: var(--pebble);
  color: var(--charcoal);
  font: 600 13px var(--bricolage);
  text-decoration: none;
  white-space: nowrap;
}
.aoca-lockbar-cta:hover {
  opacity: 0.92;
}
.aoca-state {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}
.aoca-catnav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.aoca-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: none;
  background: transparent;                     
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}
.aoca-arrow:hover { background: var(--surface); }
.aoca-arrow:disabled { opacity: 0; pointer-events: none; }
.aoca-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.aoca-strip::-webkit-scrollbar { display: none; }
.aoca-cat {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: none;
  background: transparent;                     
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.aoca-cat:hover { background: var(--surface); color: var(--text-primary); }
.aoca-cat-active,
.aoca-cat-active:hover { background: var(--ivory); color: var(--charcoal); }
.aoca-save {
  height: 56px;
  border-radius: 9999px;
  border: none;
  background: var(--text-primary);
  color: var(--charcoal);
  font-family: var(--bricolage);
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.aoca-save:hover { opacity: 0.92; }
.aoca-save:active { transform: scale(0.98); }
.aoca-save:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 768px) {
  
  .aoca-modal {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    border: none;
    border-radius: 0;
  }
  .aoca-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    height: 100dvh;
  }
  .aoca-preview { min-height: 0; }
  .aoca-character { height: 88%; }
  
  .aoca-dl { right: 12px; bottom: 12px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 24px); }
  .aoca-title { display: none; }
  .aoca-editor {
    padding: 16px 16px 24px;
    gap: 16px;
    overflow-y: auto;
  }
  .aoca-grid {
    display: flex;
    flex: 0 0 auto;
    column-gap: 8px;
    row-gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding-right: 0;
    padding-bottom: 4px;
  }
  .aoca-tile { flex: 0 0 84px; }
  .aoca-arrow { display: none; }
  .aoca-save { height: 48px; }
}
