:root {
  color-scheme: light;
  --bg: #f4f1e8;
  --panel: #fffdf6;
  --ink: #1d2521;
  --muted: #68736c;
  --line: #d8d0be;
  --accent: #226f54;
  --accent-strong: #164936;
  --warm: #b23a48;
  --shadow: 0 18px 50px rgba(44, 54, 47, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(34, 111, 84, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(178, 58, 72, 0.12), transparent 32%),
    var(--bg);
}

button,
input {
  font: inherit;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.intro {
  max-width: 760px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 0.95;
}

.intro p {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  gap: 22px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 253, 246, 0.92);
  box-shadow: var(--shadow);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
}

input:focus {
  outline: 3px solid rgba(34, 111, 84, 0.18);
  border-color: var(--accent);
}

.links-header,
.result-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin: 22px 0 14px;
}

.links-header h2,
.result-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.result-header {
  margin-top: 0;
}

.result-header p {
  margin: 0;
  color: var(--muted);
}

.links-container {
  display: grid;
  gap: 12px;
}

.link-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbf7eb;
}

.link-card h3 {
  grid-column: 1 / -1;
  margin-bottom: 0;
  color: var(--accent-strong);
  font-size: 1rem;
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--accent-strong);
  background: #ffffff;
}

.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.result-panel {
  min-height: 620px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metrics article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbf7eb;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.metrics strong {
  display: block;
  margin-top: 5px;
  color: var(--warm);
  font-size: 1.1rem;
}

.chart-frame {
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.chart-frame img {
  display: block;
  width: 100%;
  height: auto;
}

#empty-state {
  width: min(320px, 80%);
  margin: 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding: 24px 0;
  }

  .field-grid,
  .link-card,
  .metrics {
    grid-template-columns: 1fr;
  }

  .links-header,
  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
