/* The export dialog is a result workspace, not a second dashboard.
   The all-digits dialog (.sheet-dialog) shares its look. */
#share-dialog, .sheet-dialog {
  width: min(920px, calc(100vw - 36px));
  max-width: 920px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.share-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

#share-dialog h2, .sheet-dialog h2 {
  margin: 0;
  font: 500 21px/1.2 var(--sans);
  letter-spacing: .065em;
}

#share-dialog .eyebrow, .sheet-dialog .eyebrow {
  margin-bottom: 7px;
}

#share-dialog .dialog-close, .sheet-dialog .dialog-close {
  margin: 0 -8px 0 0;
  float: none;
}

.share-preview-window {
  border: 1px solid var(--line);
  background: var(--page);
  max-height: 50dvh;
  min-height: 120px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#share-zoom {
  border: 0;
  background: none;
  padding: 0;
  display: block;
  width: 100%;
  cursor: zoom-in;
  color: inherit;
  text-align: left;
}

#share-preview {
  display: block;
  width: 100%;
  height: auto;
}

#share-zoom.zoomed {
  width: 1440px;
  cursor: zoom-out;
}

#share-dialog .share-preview-meta, .sheet-dialog .share-preview-meta {
  font: 10px/1.6 var(--mono);
  color: var(--muted);
  margin: 9px 0 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
}

.share-actions button {
  padding: 13px 12px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--field);
  font: 11px/1.2 var(--mono);
  color: var(--ink);
}

.share-actions button svg {
  width: 17px;
  height: 17px;
  stroke: var(--accent);
  flex: 0 0 auto;
}

.share-actions button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.share-actions button:active:not(:disabled) {
  transform: translateY(1px);
}

.share-actions #share-native {
  border-color: var(--accent);
  color: var(--accent);
}

.share-actions button:disabled {
  opacity: .4;
}

#share-dialog #share-feedback, .sheet-dialog .sheet-feedback {
  min-height: 22px;
  font: 12px/1.6 var(--sans);
  color: var(--accent);
  margin-top: 12px;
}

#share-dialog #share-feedback[data-error=true] {
  color: var(--error);
}

#share-dialog #share-availability {
  font: 11px/1.6 var(--sans);
  color: var(--muted);
  margin: 0 0 10px;
}

#share-text-details {
  border-top: 1px solid var(--fine);
  padding-top: 10px;
  margin-top: 2px;
}

#share-text-details summary {
  font: 11px/1.6 var(--mono);
  color: var(--muted);
  cursor: pointer;
}

#share-text {
  font: 12px/1.7 var(--mono);
  width: 100%;
  min-height: 100px;
  height: 160px !important;
  max-height: 240px;
  margin-top: 10px;
  color: var(--ink);
  resize: vertical;
  letter-spacing: 0;
}

/* Every digit, grouped by five; each line starts with its first digit's position. */
#digits-dialog {
  width: min(1000px, calc(100vw - 36px));
  max-width: 1000px;
}

.digits-window {
  border: 1px solid var(--line);
  background: var(--page);
  padding: 14px 16px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

#digits-body {
  margin: 0;
  font: 12px/18px var(--mono);
  letter-spacing: 0;
  color: var(--ink);
  white-space: pre;
}

#digits-body .digits-index {
  color: var(--muted);
}

.digits-actions {
  grid-template-columns: minmax(0, 220px);
  margin-top: 18px;
}

@media (max-width: 620px) {
  #share-dialog, .sheet-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 16px;
  }
  #share-dialog h2, .sheet-dialog h2 {
    font-size: 18px;
  }
  .share-heading {
    margin-bottom: 12px;
  }
  .share-actions {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .share-actions button {
    font-size: 11px;
  }
  .share-preview-window {
    max-height: 40dvh;
    min-height: 80px;
  }
  #share-dialog .share-preview-meta, .sheet-dialog .share-preview-meta {
    font-size: 8px;
    margin-bottom: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .share-actions button {
    transition: none;
  }
}

/* Normal preview shows the entire card; zoom is explicitly opt-in. */
#share-preview {
  max-height: 50dvh;
  object-fit: contain;
}

#share-zoom.zoomed #share-preview {
  max-height: none;
}

@media (max-width:620px) {
  #share-preview {
    max-height: 40dvh;
  }
}
