:root {
  color-scheme: light;
  --page: #f4f1ea;
  --panel: #fffdf8;
  --ink: #161f1b;
  --muted: #657067;
  --soft: #d9d2c4;
  --line: #cfc6b6;
  --accent: #173f2a;
  --accent-soft: #e2ebe3;
  --warning: #8b5b18;
  --shadow: 0 24px 80px rgba(36, 31, 22, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(22, 31, 27, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 31, 27, 0.045) 1px, transparent 1px),
    var(--page);
  background-size: 48px 48px;
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.share-shell {
  min-height: 100vh;
}

.share-workbench {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.share-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(22px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.88);
}

.share-title-block {
  min-width: 0;
}

.share-kicker {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 8px 0 0;
  max-width: 900px;
  color: var(--ink);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 520;
  line-height: 1;
  overflow-wrap: anywhere;
}

p {
  margin: 12px 0 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.share-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.share-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
  padding: 12px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.share-segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  min-height: 38px;
  border: 1px solid var(--line);
  background: #f7f3ea;
}

.share-segmented button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
}

.share-segmented button:last-child {
  border-right: 0;
}

.share-segmented button.is-selected {
  background: var(--accent);
  color: var(--panel);
}

.share-segmented button:focus-visible {
  outline: 3px solid rgba(23, 63, 42, 0.28);
  outline-offset: 3px;
}

.share-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.share-status span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--soft);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.share-context {
  display: grid;
  grid-template-columns: 1.15fr 1.45fr 1fr 0.8fr;
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.share-context div {
  min-width: 0;
  background: rgba(255, 253, 248, 0.94);
  padding: 14px clamp(14px, 3vw, 28px);
}

.share-context span,
.share-context strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-context span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.share-context strong {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.share-stage {
  min-height: 0;
  padding: clamp(18px, 4vw, 42px);
  display: flex;
  justify-content: center;
}

.share-device {
  width: min(100%, 920px);
  min-height: calc(100vh - 212px);
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
  transition: width 220ms ease;
}

.share-device--mobile {
  width: min(100%, 390px);
}

.share-device iframe {
  display: block;
  width: 100%;
  min-height: calc(100vh - 214px);
  border: 0;
  background: #ffffff;
}

.share-loading,
.share-error {
  width: min(100% - 32px, 620px);
  margin: 12vh auto 0;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: clamp(28px, 6vw, 56px);
}

.share-loading-line {
  width: 100%;
  height: 3px;
  margin-top: 34px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: loading-slide 1.3s ease-in-out infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-18%);
    opacity: 0.28;
  }
  50% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(18%);
    opacity: 0.28;
  }
}

@media (max-width: 760px) {
  .share-header,
  .share-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .share-meta {
    align-items: flex-start;
  }

  .share-status {
    justify-content: flex-start;
  }

  .share-context {
    grid-template-columns: 1fr;
  }

  .share-stage {
    padding: 0;
  }

  .share-device,
  .share-device--mobile,
  .share-device iframe {
    width: 100%;
    min-height: calc(100vh - 246px);
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
