.tool-page {
  width: min(var(--max), calc(100% - 44px));
  margin-inline: auto;
  padding: clamp(38px, 7vw, 86px) 0 88px;
}

.tool-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 360px);
  gap: clamp(28px, 5vw, 68px);
  align-items: end;
  padding-bottom: 38px;
}

.tool-hero > * {
  min-width: 0;
}

.tool-hero h1 {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(42px, 7vw, 76px);
  font-weight: 590;
  letter-spacing: 0;
  line-height: 1.02;
}

.tool-hero p {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.55;
  overflow-wrap: break-word;
}

.tool-sponsor {
  display: grid;
  min-height: 108px;
  align-content: center;
  gap: 6px;
  border: 1px dashed rgba(30, 106, 120, 0.32);
  border-radius: 8px;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(32, 178, 170, 0.08), transparent 58%),
    rgba(3, 7, 8, 0.72);
}

.tool-sponsor span,
.tool-sponsor small {
  color: var(--muted);
  font-size: 12px;
}

.tool-sponsor strong {
  color: var(--ink);
  font-size: 16px;
}

.tool-workbench {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

.tool-workbench.single {
  grid-template-columns: 1fr;
}

.tool-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 14%, rgba(32, 178, 170, 0.1), transparent 30%),
    rgba(3, 7, 8, 0.88);
  box-shadow: none;
}

.tool-panel {
  padding: clamp(18px, 3vw, 28px);
}

.result-panel {
  overflow: hidden;
}

.panel-top {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.panel-top h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 680;
}

.panel-top p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.field-section {
  margin-top: 14px;
}

.field-grid.one {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.control-caption {
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea,
.habit-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.habit-form input:focus {
  border-color: rgba(30, 106, 120, 0.5);
  box-shadow: 0 0 0 4px rgba(32, 178, 170, 0.12);
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.panel-top .tool-actions {
  margin-top: 0;
}

.tool-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 720;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms var(--ease);
}

.tool-button {
  border: 1px solid rgba(30, 106, 120, 0.52);
  background: linear-gradient(135deg, var(--teal), var(--mint));
  color: #ffffff;
}

.ghost-button {
  border: 1px solid rgba(30, 106, 120, 0.24);
  background: transparent;
  color: var(--teal);
}

.danger-button {
  border: 1px solid rgba(217, 109, 95, 0.28);
  background: transparent;
  color: #ff9c90;
}

.tool-button:hover,
.tool-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible,
.danger-button:hover,
.danger-button:focus-visible {
  outline: none;
  transform: translateY(-2px);
}

.output-box {
  min-height: 420px;
  width: 100%;
  border: 0;
  padding: 22px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font:
    14px/1.58 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  resize: vertical;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.metric-card {
  display: grid;
  gap: 5px;
  min-height: 104px;
  align-content: center;
  padding: 18px;
  background: rgba(255, 255, 255, 0.025);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-card strong {
  color: var(--ink);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 680;
  line-height: 1;
}

.metric-card small {
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.4;
}

.insight-list,
.idea-list,
.habit-list,
.checklist-list {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.insight-list p,
.idea-row,
.habit-row,
.checklist-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
}

.insight-list p {
  padding: 13px 14px;
  line-height: 1.5;
}

.idea-row,
.habit-row,
.checklist-item {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.idea-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.idea-row strong,
.habit-row strong,
.checklist-item strong {
  color: var(--ink);
}

.idea-row small,
.habit-row small,
.checklist-item small {
  color: var(--muted);
  line-height: 1.45;
}

.habit-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.habit-form input {
  min-width: 0;
  flex: 1;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-toggle {
  display: grid;
  min-height: 50px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.day-toggle.is-done {
  border-color: rgba(30, 106, 120, 0.42);
  background: rgba(32, 178, 170, 0.14);
  color: var(--teal);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.progress-shell {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar {
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--mint));
  transition: width 240ms ease;
}

.checklist-item {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.checklist-item input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.checklist-group-title {
  padding: 18px 20px 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-toast {
  min-height: 20px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .tool-page {
    width: min(var(--max), calc(100% - 28px));
  }

  .tool-hero,
  .tool-workbench {
    grid-template-columns: 1fr;
  }

  .field-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .output-box {
    min-height: 320px;
  }

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

@media (max-width: 520px) {
  .tool-hero h1 {
    font-size: 38px;
  }

  .tool-hero p {
    max-width: 32ch;
    font-size: 16px;
  }
}
