:root {
  color-scheme: light;
  --ink: #14241e;
  --muted: #4d5b55;
  --paper: #e7eee9;
  --card: #ffffff;
  --line: #d3ddd6;
  --header: #10231c;
  --accent: #0f6b4c;
  --warn: #8a3d12;
  --good: #0b6e4f;
  --serp: #1a0dab;
  --shadow: 0 8px 24px rgba(16, 35, 28, 0.06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Liberation Sans", Arial, "Noto Sans", "Droid Sans Fallback", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.4;
}

button, input, textarea, select { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.site-header {
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  background: var(--header);
  color: #f4f7f5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f4f7f5;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo { width: 20px; height: 20px; display: block; }

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.nav-link {
  color: #f4f7f5;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.08); }

.lang-menu { position: relative; }

.lang-menu summary {
  list-style: none;
  height: 32px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.lang-menu summary::-webkit-details-marker { display: none; }

.lang-menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  color: var(--ink);
  min-width: 148px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  z-index: 40;
}

.lang-menu a {
  color: var(--ink);
  text-decoration: none;
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
}

.lang-menu a[aria-current="page"] { background: #e7f3ee; font-weight: 700; }

.viewport-fit {
  height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) 28px;
}

.first-screen {
  align-content: start;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 4px;
  min-height: 0;
  height: 100%;
  padding: 6px 14px 4px;
  overflow: hidden;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.lede {
  margin: 0;
  font-size: 13px;
  line-height: 16px;
  color: var(--muted);
  white-space: nowrap;
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.inputs, .preview-pane {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 0;
}

.inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 4px 8px;
  align-content: start;
  padding: 8px;
  overflow: auto;
}

.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.field-wide, .presets { grid-column: 1 / -1; }

.label-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
}

.meter {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #5c6b7c;
}

.meter.is-over { color: var(--warn); font-weight: 700; }

.presets { display: flex; gap: 6px; }

.presets button, .tabs button, .seg button, .partner-link, #copy-html {
  border: 1px solid var(--line);
  background: #f6faf7;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.2;
}

.presets button { flex: 1 1 0; min-width: 0; }

.presets button.is-active,
.tabs button[aria-selected="true"],
.seg button[aria-pressed="true"] {
  background: var(--header);
  color: #f4f7f5;
  border-color: var(--header);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea,
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid #c5d0c9;
  border-radius: 6px;
  background: #fff;
  padding: 4px 6px;
  font-size: 13px;
}

input[type="checkbox"] { width: auto; }

textarea { resize: none; height: 40px; }

.file-row { display: flex; align-items: center; gap: 8px; min-width: 0; }

.file-row input[type="file"] { font-size: 12px; }

.local-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex: none;
}

.notice, .status-bar, .banner { grid-column: 1 / -1; }

.notice, .status-bar {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--warn);
}

.notice.is-ok, .status-bar.is-ok { color: var(--good); }

.preview-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  padding: 8px;
}

.tabs { display: flex; gap: 6px; }

.tabs button { flex: 1 1 0; }

.panels { min-width: 0; min-height: 0; overflow: auto; }

.tab-panel { height: 100%; min-width: 0; min-height: 0; }

.serp-toolbar, .code-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  margin-bottom: 6px;
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }

.seg button { border: 0; border-radius: 0; }

.serp-card {
  max-width: 600px;
  font-family: Arial, "Liberation Sans", sans-serif;
  padding: 2px 2px 6px;
}

.serp-card.is-mobile {
  max-width: 390px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.serp-url-row { display: flex; gap: 8px; align-items: center; min-width: 0; }

.favicon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f3f4;
  color: #5f6368;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.serp-site, .breadcrumb, .serp-title, .serp-desc, .serp-warn { margin: 0; }

.serp-site { font-size: 14px; color: #202124; line-height: 1.2; }

.breadcrumb {
  font-size: 12px;
  color: #4d5156;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.serp-title {
  margin-top: 2px;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 400;
  color: var(--serp);
  overflow-wrap: anywhere;
}

.serp-card.is-mobile .serp-title { font-size: 18px; }

.serp-desc {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.45;
  color: #4d5156;
  overflow-wrap: anywhere;
}

.serp-warn { margin-top: 4px; font-size: 12px; color: var(--warn); font-family: "Liberation Sans", Arial, sans-serif; }

.social-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  min-width: 0;
}

.card-media { height: 84px; background: #e7eeea; }

.card-media img, .ph { width: 100%; height: 84px; display: block; object-fit: cover; }

.ph {
  display: grid;
  place-items: center;
  color: #3d4d58;
  font-size: 11px;
  background: linear-gradient(135deg, #d9e4de, #f4f7f5 45%, #d5e0ea);
}

.card-body { padding: 6px 8px 8px; min-width: 0; }

.card-kicker, .card-domain, .card-title, .card-desc { margin: 0; }

.card-kicker {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5c6b7c;
}

.card-x .card-kicker { color: #111; }

.card-li .card-kicker { color: #0a66c2; }

.card-fb .card-kicker { color: #1877f2; }

.card-domain {
  font-size: 11px;
  color: #5c6b7c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title { margin-top: 2px; font-size: 13px; line-height: 1.3; font-weight: 700; overflow-wrap: anywhere; }

.card-desc {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: #3c4654;
  max-height: 3.9em;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.x-card.is-summary {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
}

.x-card.is-summary .card-media,
.x-card.is-summary .card-media img,
.x-card.is-summary .ph { width: 72px; height: 72px; }

.code-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 6px;
  height: 100%;
  min-height: 0;
}

.code-label { margin: 0; font-size: 12px; color: var(--muted); }

#copy-html { background: var(--accent); color: #fff; border-color: var(--accent); }

pre {
  margin: 0;
  min-height: 0;
  overflow: auto;
  background: #101820;
  color: #e7eef5;
  padding: 8px;
  border-radius: 8px;
  font-family: "Cascadia Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.audit {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: start;
}

.score-wrap { text-align: center; }

.score { margin: 0; font-size: 28px; line-height: 1; font-weight: 700; }

.score.is-good { color: var(--good); }

.score.is-fair { color: #8a5a00; }

.score.is-poor { color: var(--warn); }

.score-label { margin: 2px 0 0; font-size: 10px; color: var(--muted); }

.audit-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 8px;
  font-size: 11px;
  line-height: 1.3;
}

.audit-list li.pass::before { content: "✓ "; color: var(--good); }

.audit-list li.fail::before { content: "! "; color: var(--warn); }

.audit-resources { margin: 0; font-size: 11px; line-height: 1.35; }

.site-footer {
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 12px;
  color: var(--muted);
  background: #f7faf8;
  border-top: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guide, .partners { background: #f7faf8; }

.prose {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 16px 36px;
}

.prose h2 { margin: 0 0 10px; font-size: 22px; line-height: 1.25; }

.prose h3 { margin: 16px 0 4px; font-size: 16px; }

.prose p { margin: 0 0 10px; }

.guide-block { margin-bottom: 14px; }

.ftc-disclosure {
  background: #fff6e8;
  border: 1px solid #e6c48a;
  color: #5c3b12;
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0 0 12px;
}

.partner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.partner-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.partner-card h3 { margin: 0 0 6px; }

.partner-card p { margin: 0 0 10px; }

.partner-link {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  background: var(--header);
  border-color: var(--header);
}

.not-found { padding: 32px 16px 48px; }

@media (max-width: 960px) {
  .viewport-fit { height: auto; display: block; }
  .first-screen { height: auto; overflow: visible; }
  .studio, .social-grid, .partner-grid, .audit-list { grid-template-columns: 1fr; }
  h1, .lede, .site-footer { white-space: normal; }
  .site-footer { height: auto; max-height: none; }
  .preview-pane { min-height: 560px; }
  .inputs { overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
