:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #1b2430;
  --muted: #637083;
  --line: #dfe4ea;
  --primary: #0b6b5d;
  --primary-strong: #084f45;
  --accent: #d95832;
  --soft: #eaf5f2;
  --warn: #fff5df;
  --warn-text: #7a4a00;
  --shadow: 0 18px 50px rgba(27, 36, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 20px;
  font-weight: 800;
}

nav {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 14px;
}

.tool-band {
  padding: 34px 0 26px;
  background:
    linear-gradient(180deg, #eef7f4 0%, rgba(246, 247, 249, 0) 84%),
    var(--bg);
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
  gap: 22px;
  align-items: stretch;
}

.query-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.query-panel {
  padding: 28px;
}

.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.05;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 17px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 26px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 13px;
}

select:focus,
input:focus {
  outline: 3px solid rgba(11, 107, 93, 0.18);
  border-color: var(--primary);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.status-strip span,
.mode-badge {
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 800;
  padding: 7px 11px;
}

.result-panel {
  padding: 24px;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.small-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-head h2 {
  margin: 2px 0 0;
  font-size: 30px;
}

.line-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.line-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.line-name {
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.line-score {
  margin-top: 10px;
  color: var(--primary-strong);
  font-size: 32px;
  font-weight: 850;
  line-height: 1;
}

.analysis-box,
.warning-box {
  margin-top: 14px;
  border-radius: 8px;
  padding: 14px;
}

.analysis-box {
  border: 1px solid #cfe5df;
  background: var(--soft);
  color: var(--primary-strong);
}

.warning-box {
  border: 1px solid #f1d59a;
  background: var(--warn);
  color: var(--warn-text);
}

.hidden {
  display: none;
}

.source-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.source-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

.source-row a {
  flex: none;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  padding: 10px 14px;
}

.ad-band {
  width: min(1120px, calc(100% - 32px));
  margin: 22px auto;
}

.ad-placeholder {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px dashed #c6ced8;
  border-radius: 8px;
  background: #fff;
  color: #8a96a5;
  font-size: 13px;
}

.table-section,
.guide-section {
  padding: 22px 0 34px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.section-head h2,
.guide-section h2 {
  margin-bottom: 6px;
  font-size: 28px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.section-head input {
  max-width: 360px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f1f4f6;
  color: var(--muted);
  font-size: 13px;
}

td:first-child {
  font-weight: 850;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.guide-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.guide-grid p {
  margin-bottom: 0;
  color: var(--muted);
}

footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 24px 0;
}

footer p {
  margin: 0;
}

@media (max-width: 860px) {
  nav {
    display: none;
  }

  .tool-layout,
  .controls,
  .guide-grid {
    grid-template-columns: 1fr;
  }

  .tool-layout {
    gap: 14px;
  }

  .line-grid {
    grid-template-columns: 1fr;
  }

  .source-row,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head input {
    max-width: none;
  }
}

/* Additional ad slots */
.ad-top {
  margin-top: 0;
  background: #f8f9fa;
  padding: 12px 0;
}

.ad-top .ad-placeholder {
  max-width: 728px;
  margin: 0 auto;
}

.ad-incontent {
  margin: 32px auto;
}

/* Mobile responsive ads */
@media (max-width: 768px) {
  .ad-top .ad-placeholder {
    min-height: 60px;
  }
  
  .ad-band {
    margin: 16px auto;
  }
}
