:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --panel: #fffdf8;
  --panel-strong: #ffffff;
  --ink: #171717;
  --muted: #6b655c;
  --line: #ded6c8;
  --teal: #137c72;
  --teal-dark: #0f5f58;
  --blue: #1c5d99;
  --coral: #d6654f;
  --amber: #e6b650;
  --shadow: 0 24px 70px rgba(41, 32, 17, 0.13);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(90deg, rgba(19, 124, 114, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 23, 23, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px, 34px 34px, auto;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.tool-panel {
  display: grid;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.url-form {
  display: grid;
  gap: 8px;
}

.url-form label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.input-row input {
  min-width: 0;
  width: 100%;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  outline: 0;
  padding: 0 15px;
  box-shadow: inset 0 0 0 1px transparent;
}

.input-row input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(19, 124, 114, 0.13);
}

.primary-button,
.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  border: 0;
  background: var(--teal);
  color: #ffffff;
  font-weight: 900;
  padding: 0 18px;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.primary-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.72;
  transform: none;
}

.primary-button svg,
.source-link svg {
  width: 18px;
  height: 18px;
}

.status-line {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-line.is-loading::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--amber);
  animation: pulse 900ms ease-in-out infinite;
}

.result-shell {
  margin-top: 18px;
}

.empty-state,
.message-card,
.article-view {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(41, 32, 17, 0.08);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 18px;
  min-height: 420px;
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state p {
  max-width: 34rem;
  margin: 0;
  font-size: 1rem;
}

.empty-art {
  width: min(260px, 80vw);
  aspect-ratio: 4 / 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff9ee;
}

.empty-art span {
  min-height: 88px;
  border-radius: 6px;
  background: var(--panel-strong);
  border: 1px solid rgba(23, 23, 23, 0.08);
}

.empty-art span:nth-child(1) {
  grid-row: span 2;
  background: linear-gradient(180deg, rgba(19, 124, 114, 0.18), #ffffff);
}

.empty-art span:nth-child(2) {
  background: linear-gradient(180deg, rgba(214, 101, 79, 0.2), #ffffff);
}

.empty-art span:nth-child(3) {
  background: linear-gradient(180deg, rgba(28, 93, 153, 0.18), #ffffff);
}

.empty-art span:nth-child(4) {
  grid-column: 1 / -1;
  min-height: 18px;
  background: var(--amber);
}

.message-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px;
  color: #4d251d;
  background: #fff6f3;
  border-color: rgba(214, 101, 79, 0.35);
}

.message-card svg {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  color: var(--coral);
}

.message-card h2,
.message-card p {
  margin: 0;
}

.message-card h2 {
  font-size: 1rem;
}

.message-card p {
  margin-top: 4px;
  color: #784236;
  line-height: 1.45;
}

.article-view {
  overflow: hidden;
}

.article-header {
  padding: clamp(24px, 5vw, 52px) clamp(20px, 6vw, 76px) 28px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(230, 182, 80, 0.14), transparent 74%),
    var(--panel-strong);
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(19, 124, 114, 0.1);
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 900;
}

.source-link {
  min-height: 34px;
  height: auto;
  border: 1px solid var(--line);
  padding: 6px 10px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
  background: #ffffff;
}

.source-link:hover {
  border-color: rgba(28, 93, 153, 0.45);
}

.publication {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-header h2 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.subtitle {
  max-width: 780px;
  margin: 18px 0 0;
  color: #4e473d;
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  line-height: 1.45;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.meta-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #fffaf0;
  font-size: 0.82rem;
  font-weight: 700;
}

.notice {
  display: none;
  max-width: 780px;
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(230, 182, 80, 0.45);
  border-radius: 8px;
  background: #fff8e7;
  color: #655126;
  line-height: 1.45;
}

.notice.is-visible {
  display: block;
}

.article-body {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(26px, 6vw, 58px) 0 clamp(36px, 7vw, 72px);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  line-height: 1.72;
}

.article-body > *:first-child {
  margin-top: 0;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  margin: 1.55em 0 0.55em;
  font-family: var(--sans);
  line-height: 1.18;
  letter-spacing: 0;
}

.article-body h1 {
  font-size: 2.2rem;
}

.article-body h2 {
  font-size: 1.75rem;
}

.article-body h3 {
  font-size: 1.38rem;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body figure,
.article-body blockquote,
.article-body pre,
.article-body table {
  margin: 1.1em 0;
}

.article-body a {
  color: var(--blue);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.article-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.article-body figcaption {
  margin-top: 0.6em;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.45;
}

.article-body blockquote {
  border-left: 4px solid var(--teal);
  padding-left: 18px;
  color: #342f29;
}

.article-body pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #161616;
  color: #f8f4ea;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.5;
}

.article-body code {
  border-radius: 5px;
  padding: 0.1em 0.28em;
  background: rgba(19, 124, 114, 0.11);
  font-family: var(--mono);
  font-size: 0.88em;
}

.article-body pre code {
  padding: 0;
  background: transparent;
}

.article-body hr {
  height: 1px;
  margin: 2em 0;
  border: 0;
  background: var(--line);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.article-body th,
.article-body td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.article-body th {
  background: #fff8e7;
}

.unsupported-node {
  border: 1px dashed rgba(19, 124, 114, 0.42);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(19, 124, 114, 0.07);
  color: #36534f;
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.45;
}

.embed-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  font-family: var(--sans);
}

.embed-card strong {
  font-size: 0.98rem;
}

.embed-card a {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.service-embed {
  font-family: var(--sans);
}

.service-embed-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111111;
}

.service-embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.service-embed.is-tiktok {
  width: min(100%, 380px);
  margin-right: auto;
  margin-left: auto;
}

.service-embed.is-tiktok .service-embed-frame {
  aspect-ratio: 9 / 16;
  background: #ffffff;
}

.service-embed figcaption {
  text-align: center;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.8);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 22px, 1120px);
    padding-top: 12px;
  }

  .tool-panel {
    padding: 16px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .article-header {
    padding-left: 18px;
    padding-right: 18px;
  }

  .article-body {
    width: min(100% - 36px, 760px);
  }
}
