.published-image {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[data-image-slot] {
  position: relative;
  overflow: hidden;
}

[data-image-slot].has-published-image > span,
[data-image-slot].has-published-image > strong {
  visibility: hidden;
}

.author-route body {
  min-height: 100dvh;
}

.author-mode {
  padding-bottom: calc(88px + env(safe-area-inset-bottom));
}

.author-login {
  position: fixed;
  z-index: 200;
  display: grid;
  inset: 0;
  place-items: center;
  padding: 20px;
  background: #f7f5ef;
}

.author-login-panel {
  display: grid;
  width: min(100%, 390px);
  gap: 16px;
  padding: 28px;
  border: 1px solid #181817;
  border-radius: 6px;
  background: #fffdf8;
  box-shadow: 0 18px 60px rgb(24 24 23 / 0.12);
}

.author-kicker {
  margin: 0;
  color: #f05a45;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.author-login h1,
.crop-heading h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 0;
}

.author-login label {
  display: grid;
  gap: 8px;
  font-size: 12px;
  font-weight: 750;
}

.author-login input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #d5d1c7;
  border-radius: 3px;
  outline: 0;
  background: white;
}

.author-login input:focus {
  border-color: #f05a45;
  box-shadow: 0 0 0 2px rgb(240 90 69 / 0.13);
}

.author-login button,
.author-publish-button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid #f05a45;
  border-radius: 3px;
  color: white;
  background: #f05a45;
  font-weight: 800;
  cursor: pointer;
}

.author-login button:disabled,
.author-publish-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.author-login a {
  color: #6d6b65;
  font-size: 12px;
  text-align: center;
}

.author-form-error {
  min-height: 18px;
  margin: -6px 0;
  color: #a92f22;
  font-size: 12px;
}

.author-toolbar {
  position: fixed;
  z-index: 120;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: min(100%, 760px);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: auto;
  padding: 12px max(14px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  border: 1px solid #c9c5ba;
  border-bottom: 0;
  background: rgb(255 253 248 / 0.96);
  box-shadow: 0 -8px 28px rgb(24 24 23 / 0.1);
  backdrop-filter: blur(16px);
}

.author-toolbar-brand {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.author-toolbar-brand strong {
  font-size: 13px;
}

.author-toolbar-brand span {
  max-width: 160px;
  overflow: hidden;
  color: #6d6b65;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.author-secondary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid #c9c5ba;
  border-radius: 3px;
  color: #181817;
  background: #fffdf8;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.author-icon-button {
  width: 38px;
  flex: 0 0 38px;
  padding: 0;
}

.author-icon-button svg {
  width: 16px;
  height: 16px;
}

.author-publish-button {
  min-height: 38px;
  font-size: 11px;
}

.author-publish-button.is-dirty {
  box-shadow: 0 0 0 3px rgb(240 90 69 / 0.18);
}

.author-image-slot {
  cursor: default;
  outline: 1px dashed rgb(240 90 69 / 0.58);
  outline-offset: -4px;
}

.slot-image-controls {
  position: absolute;
  z-index: 4;
  right: 9px;
  bottom: 9px;
  left: 9px;
  display: flex;
  justify-content: center;
  gap: 7px;
}

.slot-image-controls button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgb(255 255 255 / 0.56);
  border-radius: 3px;
  color: white;
  background: rgb(24 24 23 / 0.84);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 3px 14px rgb(0 0 0 / 0.18);
  cursor: pointer;
}

.slot-image-controls .slot-remove-button {
  color: #181817;
  background: rgb(255 253 248 / 0.94);
}

.crop-dialog {
  width: min(calc(100% - 24px), 560px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 1px solid #181817;
  border-radius: 6px;
  color: #181817;
  background: #f7f5ef;
  box-shadow: 0 22px 90px rgb(0 0 0 / 0.28);
  overflow-y: auto;
}

.archive-image-dialog {
  width: min(calc(100% - 24px), 620px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  border: 1px solid #181817;
  border-radius: 6px;
  color: #181817;
  background: #f7f5ef;
  box-shadow: 0 22px 90px rgb(0 0 0 / 0.28);
  overflow-y: auto;
}

.archive-image-dialog::backdrop {
  background: rgb(24 24 23 / 0.66);
  backdrop-filter: blur(4px);
}

.archive-image-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.archive-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.archive-manager-heading {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 12px;
  border-top: 1px solid #c9c5ba;
  font-size: 12px;
  line-height: 1.4;
}

.archive-manager-heading:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.archive-manager-slot {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 3px;
}

.archive-manager-slot.ratio-cover { aspect-ratio: 1.56; }
.archive-manager-slot.ratio-feature { aspect-ratio: 1.62; }
.archive-manager-slot.ratio-friend { aspect-ratio: 1.38; }
.archive-manager-slot.ratio-scene { aspect-ratio: 1.15; }
.archive-manager-slot.ratio-portrait-cover { aspect-ratio: 1.42; }
.archive-manager-slot.ratio-portrait { aspect-ratio: 0.8; }

.archive-manager-slot .slot-image-controls {
  right: 5px;
  bottom: 5px;
  left: 5px;
  gap: 4px;
}

.archive-manager-slot .slot-image-controls button {
  min-height: 30px;
  padding: 0 6px;
  font-size: 9px;
}

.crop-dialog::backdrop {
  background: rgb(24 24 23 / 0.66);
  backdrop-filter: blur(4px);
}

.crop-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.crop-heading,
.crop-actions,
.zoom-control {
  display: flex;
  align-items: center;
}

.crop-heading {
  justify-content: space-between;
}

.crop-heading > div {
  display: grid;
  gap: 4px;
}

.crop-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid #d5d1c7;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.crop-canvas-shell {
  width: 100%;
  overflow: hidden;
  border: 1px solid #181817;
  background: #181817;
  touch-action: none;
}

.crop-canvas-shell canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
}

.crop-canvas-shell canvas:active {
  cursor: grabbing;
}

.zoom-control {
  gap: 13px;
  color: #6d6b65;
  font-size: 11px;
  font-weight: 750;
}

.zoom-control input {
  width: 100%;
  accent-color: #f05a45;
}

.crop-actions {
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 560px) {
  .author-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .author-toolbar-brand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }

  .author-toolbar-brand span {
    max-width: 66vw;
  }

  .author-toolbar-actions {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
  }

  .author-mode {
    padding-bottom: calc(116px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .author-toolbar,
  .crop-dialog {
    scroll-behavior: auto;
  }
}
