/* Paper Studio V2 — Entitlement Redemption Drawer, Lock Badges & Play Gate (Zero 3D) */

.ps-header__entitlement-btn.is-entitled {
  border-color: color-mix(in srgb, var(--ps-celadon, var(--ps-accent)) 45%, var(--ps-border));
  background: var(--ps-accent-soft);
  color: var(--ps-ink);
}

.ps-bookplate__media,
.ps-edition-card__media,
.ps-trial-card__media,
.ps-plaque-2d__media {
  position: relative;
}

.ps-lock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(24, 21, 28, 0.84);
  border: 1px solid rgba(255, 253, 249, 0.22);
  color: #fffdf9;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}

.ps-lock-badge--inline {
  position: static;
  align-self: flex-start;
  background: var(--ps-accent-soft);
  border-color: color-mix(in srgb, var(--ps-accent) 32%, transparent);
  color: var(--ps-accent);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.ps-card--locked .ps-card__poster,
.ps-bookplate--locked .ps-bookplate__media img {
  filter: saturate(0.84);
}

.ps-card-editions__link.is-locked {
  gap: 4px;
}

.ps-entitlement-drawer {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(16, 20, 26, 0.48);
  display: flex;
  justify-content: flex-end;
}

.ps-entitlement-drawer[hidden] {
  display: none;
}

.ps-entitlement-drawer__panel {
  width: min(448px, 100vw);
  height: 100%;
  background: var(--ps-surface);
  border-left: 1px solid var(--ps-border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: -8px 0 32px rgba(16, 20, 26, 0.16);
}

.ps-entitlement-drawer__title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ps-heading-font);
  font-size: 18px;
  font-weight: 700;
}

.ps-entitlement-context {
  padding: 12px 14px;
  border-radius: var(--ps-radius-sm);
  background: var(--ps-surface-alt);
  border: 1px solid var(--ps-border);
  border-left: 4px solid var(--ps-accent);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ps-entitlement-context__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ps-accent);
}

.ps-entitlement-context__title {
  display: block;
  font-size: 15px;
  color: var(--ps-ink);
}

.ps-entitlement-context__scope,
.ps-entitlement-context__hint,
.ps-entitlement-form__hint,
.ps-entitlement-status__text,
.ps-entitlement-gate__scope,
.ps-entitlement-gate__desc {
  margin: 0;
  font-size: 13px;
  color: var(--ps-muted);
  line-height: 1.45;
}

.ps-entitlement-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--ps-radius-sm);
  background: var(--ps-surface-alt);
  border: 1px solid var(--ps-border);
}

.ps-entitlement-form__label,
.ps-entitlement-section__title,
.ps-entitlement-item__name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ps-ink);
}

.ps-entitlement-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.ps-entitlement-form__actions,
.ps-entitlement-status__actions,
.ps-entitlement-gate__actions,
.ps-entitlement-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ps-entitlement-status {
  padding: 10px 12px;
  border-radius: var(--ps-radius-sm);
  border: 1px solid var(--ps-border);
  background: var(--ps-accent-soft);
  color: var(--ps-ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ps-entitlement-status__text {
  color: inherit;
}

.ps-entitlement-status--success {
  background: rgba(30, 122, 92, 0.12);
  border-color: rgba(30, 122, 92, 0.36);
  color: #145a44;
}

.ps-entitlement-status--warning {
  background: rgba(200, 138, 40, 0.14);
  border-color: rgba(200, 138, 40, 0.42);
  color: #7a4f0c;
}

.ps-entitlement-status--error {
  background: rgba(196, 48, 43, 0.13);
  border-color: rgba(196, 48, 43, 0.42);
  color: #9e1f1b;
}

.ps-entitlement-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ps-entitlement-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ps-entitlement-item {
  padding: 10px 12px;
  border-radius: var(--ps-radius-sm);
  background: var(--ps-surface-alt);
  border: 1px solid var(--ps-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ps-entitlement-item__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ps-entitlement-item__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ps-entitlement-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ps-accent-soft);
  color: var(--ps-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
}

.ps-entitlement-item__meta {
  font-size: 12.5px;
  color: var(--ps-muted);
  font-variant-numeric: tabular-nums;
}

.ps-entitlement-empty {
  font-size: 13.5px;
  line-height: 1.5;
}

.ps-entitlement-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--ps-border);
}

.ps-entitlement-gate {
  width: 100%;
  min-height: 100%;
  padding: 28px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ps-bg);
}

.ps-entitlement-gate__card {
  width: min(560px, 100%);
  background: var(--ps-surface);
  border: 1px solid var(--ps-border);
  border-radius: var(--ps-radius);
  box-shadow: var(--ps-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ps-entitlement-gate__media {
  aspect-ratio: 16 / 9;
  background: var(--ps-surface-alt);
  border-bottom: 1px solid var(--ps-border);
  overflow: hidden;
}

.ps-entitlement-gate__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ps-entitlement-gate__body {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ps-entitlement-gate__title {
  margin: 0;
  font-family: var(--ps-heading-font);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ps-ink);
}

[data-theme="dark-slate"] .ps-entitlement-status--success {
  background: rgba(46, 178, 134, 0.18);
  border-color: rgba(46, 178, 134, 0.42);
  color: #8ee5c6;
}

[data-theme="dark-slate"] .ps-entitlement-status--warning {
  background: rgba(232, 168, 56, 0.18);
  border-color: rgba(232, 168, 56, 0.45);
  color: #f6d086;
}

[data-theme="dark-slate"] .ps-entitlement-status--error {
  background: rgba(235, 87, 87, 0.18);
  border-color: rgba(235, 87, 87, 0.45);
  color: #f9a3a3;
}

:is(
  .ps-entitlement-input,
  .ps-header__entitlement-btn
):focus-visible {
  outline: 2px solid var(--ps-celadon, var(--ps-accent));
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ps-header__entitlement-btn,
  .ps-entitlement-drawer__panel,
  .ps-lock-badge {
    transition: none;
  }
}

@media (pointer: coarse) {
  .ps-header__entitlement-btn,
  .ps-entitlement-input {
    min-height: 44px;
  }
}
