/* Shared finishing layer: existing tokens, predictable spacing and clear controls. */
dialog {
  border-color: #414c39;
  border-radius: 16px;
  box-shadow: 0 24px 96px #0008;
}

dialog:not(.editor-dialog):not(.artwork-dialog):not(.how-dialog) {
  width: 560px;
  max-width: calc(100vw - 32px);
}

.modal-header {
  padding: 24px 32px 0;
  gap: 24px;
}

.modal-header h2,
.editor-dialog .modal-header h2 {
  min-width: 0;
  font:
    500 26px / 1.25 "Space Grotesk",
    sans-serif;
  letter-spacing: -0.7px;
  overflow-wrap: anywhere;
}

.close-button {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  line-height: 1;
}

.close-button:hover {
  border-color: var(--line);
}

.modal-body {
  padding: 24px 32px 32px;
}

.modal-body h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}

.modal-body p {
  line-height: 1.65;
}

.modal-body .tag,
.artwork-info .tag {
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.6px;
}

.modal-body .creation-steps {
  justify-content: flex-start;
  gap: 12px;
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.modal-actions {
  gap: 12px;
  margin-top: 24px;
  align-items: stretch;
}

.modal-actions > button {
  flex: 0 1 auto;
  min-width: 112px;
}

dialog .primary,
dialog .secondary {
  min-height: 46px;
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.4;
  border-radius: 8px;
}

dialog .secondary {
  background: #20261c;
  border-color: #49553e;
}

dialog .secondary.danger {
  background: #2c211e;
  border-color: #6b423c;
}

dialog .text-button {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 6px;
}

dialog .text-button:hover:not(:disabled) {
  background: #ffffff06;
}

dialog .field {
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
}

dialog input:not([type="range"]):not([type="color"]):not([type="file"]),
dialog select {
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 8px;
  line-height: 1.4;
}

dialog .coord-fields {
  gap: 16px;
  margin: 16px 0 0;
}

dialog summary {
  cursor: pointer;
  line-height: 1.5;
}

dialog summary:focus-visible,
dialog .upload-label:focus-within {
  outline: 2px solid var(--lime);
  outline-offset: 4px;
  border-radius: 4px;
}

dialog .receipt {
  margin: 24px 0;
  padding: 0 16px;
  background: #11160f60;
  border-radius: 10px;
}

dialog .receipt > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: baseline;
  gap: 16px;
  min-height: 48px;
  padding: 14px 0;
  font-size: 13px;
  line-height: 1.5;
}

dialog .receipt strong {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

dialog .receipt .receipt-total {
  padding: 18px 0;
  font-size: 14px;
}

dialog .receipt-total strong {
  font-size: 18px;
  letter-spacing: -0.35px;
}

.modal-body .size-options {
  gap: 12px;
  margin: 24px 0;
}

.modal-body .size-option {
  min-height: 120px;
  padding: 20px 12px;
  gap: 8px;
  justify-content: center;
  border-radius: 10px;
  background: #1b2417;
}

.modal-body .size-option.active {
  background: #293b1e;
}

.modal-body .size-option strong {
  font-size: 21px;
  line-height: 1.2;
}

.modal-body .size-option span {
  font-size: 12px;
}

.modal-body .start-art-actions {
  gap: 12px;
  margin-top: 24px;
}

#draft-estimate {
  margin-top: 24px;
}

#draft-error:empty,
#price-error:empty {
  margin: 0;
}

#refill-wallet {
  margin-top: 24px !important;
}

#reset-demo {
  margin-top: 8px !important;
}

.artwork-layout {
  gap: 32px;
  padding: 24px 32px 32px;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.artwork-info {
  min-width: 0;
}

.artwork-info .creator-line {
  gap: 12px;
  margin-top: 24px;
}

.creator-avatar {
  flex-shrink: 0;
}

.creator-line strong {
  overflow-wrap: anywhere;
}

.artwork-info .value-panel {
  margin: 24px 0 0;
  padding: 20px 0;
}

.artwork-info .quiet-caption {
  font-size: 12px !important;
}

/* Keep the studio's scrollable body and pinned action bar intact. */
.editor-dialog .modal-header {
  padding: 24px 24px 0;
}

.studio-settings .palette {
  margin: 24px 0;
}

.studio-settings .custom-color-field {
  flex-direction: row;
}

.studio-settings .color-input {
  border-radius: 6px;
}

.studio-settings .upload-label {
  margin-top: 24px;
  min-height: 44px;
  border-color: #546546;
  border-radius: 8px;
}

.studio-settings .editor-footnote {
  line-height: 1.6;
}

.crop-heading {
  margin-bottom: 16px;
  gap: 16px;
}

.crop-heading strong {
  font-weight: 500;
}

.crop-tools {
  gap: 16px;
  margin: 16px 0 24px;
}

.crop-tools .segmented {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #11160f;
}

.crop-tools .chip {
  min-height: 36px;
  padding: 8px 12px;
  border-color: transparent;
  font-size: 13px;
  white-space: nowrap;
}

.crop-tools .chip.active {
  border-color: #637f44;
}

.crop-zoom {
  font-size: 13px;
}

.crop-zoom input {
  padding: 0;
}

.crop-zoom output {
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.crop-resolution {
  margin: 24px 0;
}

.crop-footer {
  gap: 24px;
  padding-top: 24px;
  margin-top: 24px;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  dialog button,
  dialog .upload-label {
    transition:
      background-color 140ms ease,
      border-color 140ms ease;
  }
}

@media (max-width: 760px) {
  .modal-header,
  .editor-dialog .modal-header {
    padding: 20px 24px 0;
    gap: 16px;
  }

  .modal-header h2,
  .editor-dialog .modal-header h2 {
    font-size: 23px;
    letter-spacing: -0.5px;
  }

  .modal-body {
    padding: 24px;
  }

  .modal-body .creation-steps {
    gap: 8px;
  }

  .modal-body .creation-steps li {
    gap: 5px;
    font-size: 11px;
  }

  .modal-body .size-options {
    gap: 8px;
  }

  .modal-body .size-option {
    min-height: 108px;
    padding: 16px 6px;
  }

  .modal-body .size-option strong {
    font-size: 18px;
  }

  .modal-body .size-option span {
    font-size: 11px;
  }

  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions > button {
    flex: 1 1 130px;
  }

  .artwork-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 24px;
  }

  .studio-settings .palette {
    margin: 16px 0;
  }

  .studio-settings .custom-color-field {
    font-size: 0;
  }

  .studio-settings .upload-label {
    margin-top: 0;
  }

  .editor-dialog .modal-header {
    padding: 16px 16px 0;
  }

  .editor-dialog .studio-buttons .primary {
    padding: 12px;
    font-size: 13px;
  }

  .editor-dialog .studio-buttons .text-button {
    padding-inline: 4px;
    font-size: 12px;
  }

  .crop-tools {
    gap: 12px;
  }

  .crop-tools .segmented {
    flex: 0 1 auto;
  }

  .crop-tools > .text-button {
    margin-left: auto;
  }

  .crop-footer {
    gap: 16px;
  }
}

@media (max-width: 380px) {
  .modal-header {
    padding-inline: 20px;
  }

  .modal-body,
  .artwork-layout {
    padding-inline: 20px;
  }

  .modal-body .creation-steps li {
    font-size: 10px;
  }

  dialog .receipt {
    padding-inline: 12px;
  }

  dialog .receipt > div {
    gap: 12px;
    font-size: 12px;
  }

  dialog .receipt strong {
    font-size: 12px;
  }

  dialog .receipt-total strong {
    font-size: 16px;
  }
}
.claim-currency-options {
  display: grid;
  gap: 14px;
}
.claim-currency-options > button,
.claim-token-result {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
}
.claim-currency-options > button span,
.claim-token-result span,
.claim-token-result small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.claim-token-search {
  display: grid;
  gap: 10px;
}
#reward-token-results {
  display: grid;
  gap: 8px;
  max-height: 230px;
  overflow: auto;
}
.community-fields {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.community-fields summary {
  cursor: pointer;
}
.community-fields .field {
  margin-top: 10px;
}
.creation-community code {
  overflow-wrap: anywhere;
}

/* Confirmation actions remain anchored while longer content scrolls. */
dialog.has-modal-footer {
  overflow: hidden;
}
.has-modal-footer #modal-content {
  display: flex;
  flex-direction: column;
  max-height: 92dvh;
  overflow: hidden;
}
.has-modal-footer .modal-header {
  flex-shrink: 0;
  padding-bottom: 4px;
}
.has-modal-footer .modal-body {
  min-height: 0;
  overflow: auto;
  padding-bottom: 24px;
}
.has-modal-footer #modal-content > .modal-actions {
  margin: 0;
  flex-shrink: 0;
  padding: 20px 32px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.reservation-total {
  padding: 0 0 3px;
}
.reservation-total > span {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 600;
}
.reservation-total > strong {
  display: block;
  margin: 8px 0 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--lime);
}
.reservation-total > strong small {
  font-size: 20px;
  letter-spacing: -0.4px;
  font-weight: 400;
  color: #b1c29f;
}
.reservation-total > p {
  font-size: 12px;
  margin: 0;
  color: var(--muted);
}
.reservation-note {
  font-size: 13px !important;
}
.reservation-dialog .quiet-caption {
  margin-bottom: 0;
  font-size: 11px !important;
}
@media (max-width: 760px) {
  .has-modal-footer #modal-content > .modal-actions {
    padding: 16px 24px;
    gap: 12px;
    flex-wrap: nowrap;
  }
  .has-modal-footer .modal-actions > button {
    min-width: 0;
    flex: 1;
    padding: 12px 10px;
    font-size: 13px;
  }
  .reservation-total > strong {
    font-size: 32px;
  }
  .has-modal-footer .modal-body {
    padding-bottom: 20px;
  }
}
@media (max-width: 380px) {
  .has-modal-footer #modal-content > .modal-actions {
    padding-inline: 20px;
  }
  .reservation-dialog .receipt > div {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 8px;
  }
  .reservation-dialog .receipt strong {
    font-size: 11px;
  }
}
