.studio-header {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: end;
  padding: 30px;
  margin-bottom: 24px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.studio-card-grid,
.studio-admin-list {
  display: grid;
  gap: 18px;
}

.studio-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.studio-card,
.studio-admin-card {
  overflow: hidden;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.studio-card > div:not(.studio-card__cover),
.studio-admin-card {
  padding: 20px;
}

.studio-admin-card {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.studio-admin-card__preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.studio-admin-card__preview .studio-canvas {
  width: 100%;
  max-width: none;
  border: 0;
  box-shadow: none;
}

.studio-cover-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 14px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.studio-card__cover {
  display: grid;
  place-items: center;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  border-bottom: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.04);
}

.studio-card__cover .studio-canvas {
  width: 100%;
  max-width: none;
  border: 0;
  box-shadow: none;
}

.studio-badge {
  display: inline-flex;
  margin: 0 6px 10px 0;
  padding: 4px 8px;
  border: 1px solid rgba(87, 214, 255, 0.32);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.studio-page-type-badge {
  display: inline-flex;
  width: fit-content;
  margin: 0 6px 8px 0;
  padding: 4px 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.page-type-front_cover {
  border-color: rgba(87, 214, 255, 0.55);
  background: rgba(87, 214, 255, 0.14);
  color: #7ddfff;
}

.page-type-story {
  border-color: rgba(103, 247, 177, 0.5);
  background: rgba(103, 247, 177, 0.12);
  color: #8cf8c8;
}

.page-type-back_cover {
  border-color: rgba(192, 132, 252, 0.55);
  background: rgba(192, 132, 252, 0.14);
  color: #d8b4fe;
}

.page-type-bonus,
.page-type-gallery,
.page-type-appendix {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.13);
  color: #fde68a;
}

.page-type-credits {
  border-color: rgba(148, 163, 184, 0.5);
  background: rgba(148, 163, 184, 0.13);
  color: #d1d5db;
}

.studio-cover-preview {
  max-width: 760px;
  margin: 0 auto 28px;
}

.studio-cover-image {
  max-width: 760px;
  margin: 0 auto 28px;
  padding: 12px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.studio-cover-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.studio-reader__bar,
.studio-reader__nav {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto 22px;
}

.studio-reader__page {
  max-width: 1120px;
  margin: 0 auto;
}

.studio-canvas {
  position: relative;
  width: min(100%, 900px);
  aspect-ratio: var(--studio-ratio-width) / var(--studio-ratio-height);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(20, 20, 18, 0.45);
  background: #f8f1df;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

.studio-panel {
  position: absolute;
  overflow: hidden;
  border: solid #111;
  background: #f8f1df;
}

.studio-panel--no-border {
  border-width: 0 !important;
}

.studio-panel > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: calc(var(--image-offset-x, 50) * 1%) calc(var(--image-offset-y, 50) * 1%);
  transform-origin: calc(var(--image-offset-x, 50) * 1%) calc(var(--image-offset-y, 50) * 1%);
  transform: scale(var(--image-zoom, 1)) rotate(var(--image-rotation, 0deg));
}

.studio-object {
  position: absolute;
  z-index: 10;
  display: grid;
  gap: 4px;
  place-items: center;
  line-height: 1.15;
  text-align: center;
  white-space: pre-wrap;
}

.studio-object--speech_bubble,
.studio-object--thought_bubble {
  border-radius: 999px;
}

.studio-object--tail::before,
.studio-object--tail::after {
  position: absolute;
  z-index: 0;
  width: 0;
  height: 0;
  content: "";
  pointer-events: none;
}

.studio-object--tail > * {
  position: relative;
  z-index: 1;
}

.studio-object--tail-bottom-left::before {
  left: 18%;
  bottom: -22px;
  border-top: 24px solid #111;
  border-right: 26px solid transparent;
}

.studio-object--tail-bottom-left::after {
  left: calc(18% + 3px);
  bottom: -17px;
  border-top: 19px solid #fff;
  border-right: 20px solid transparent;
}

.studio-object--tail-bottom-right::before {
  right: 18%;
  bottom: -22px;
  border-top: 24px solid #111;
  border-left: 26px solid transparent;
}

.studio-object--tail-bottom-right::after {
  right: calc(18% + 3px);
  bottom: -17px;
  border-top: 19px solid #fff;
  border-left: 20px solid transparent;
}

.studio-object--tail-left::before {
  left: -24px;
  top: 50%;
  border-top: 14px solid transparent;
  border-right: 26px solid #111;
  border-bottom: 14px solid transparent;
  transform: translateY(-50%);
}

.studio-object--tail-left::after {
  left: -18px;
  top: 50%;
  border-top: 10px solid transparent;
  border-right: 20px solid #fff;
  border-bottom: 10px solid transparent;
  transform: translateY(-50%);
}

.studio-object--tail-right::before {
  right: -24px;
  top: 50%;
  border-top: 14px solid transparent;
  border-left: 26px solid #111;
  border-bottom: 14px solid transparent;
  transform: translateY(-50%);
}

.studio-object--tail-right::after {
  right: -18px;
  top: 50%;
  border-top: 10px solid transparent;
  border-left: 20px solid #fff;
  border-bottom: 10px solid transparent;
  transform: translateY(-50%);
}

.studio-object--sound_effect {
  font-weight: 900;
  text-transform: uppercase;
}

.studio-object--arrow::before {
  content: "➜";
  font-size: 2rem;
}

.studio-empty-page {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #111;
}

@media (max-width: 820px) {
  .studio-admin-card {
    grid-template-columns: 1fr;
  }

  .studio-admin-card__preview {
    max-width: 220px;
  }
}
