* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--tt-bg, #f5f7fb);
  color: var(--tt-text, #172033);
  font-family: var(--tt-font, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  line-height: 1.5;
}

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

.page-shell {
  width: min(100% - 32px, var(--tt-maxw, 1120px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: var(--tt-gap, 20px);
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--tt-primary, #2563eb);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .78rem;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; }
h2 { margin-bottom: 12px; font-size: 1.1rem; }
.intro { max-width: 760px; color: var(--tt-muted, #5d6b82); margin-bottom: 0; }

.tool-grid {
  display: grid;
  grid-template-columns: minmax(280px, 430px) 1fr;
  gap: var(--tt-gap, 20px);
  align-items: start;
}

.card {
  background: var(--tt-surface, #ffffff);
  border: 1px solid var(--tt-line, #d9e1ef);
  border-radius: var(--tt-radius, 12px);
  box-shadow: var(--tt-shadow, 0 12px 30px rgba(23, 32, 51, .08));
  padding: 20px;
}

.section-heading, .actions-row, .color-row, .inline-fields {
  display: flex;
  gap: 12px;
}

.section-heading { align-items: center; justify-content: space-between; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.color-row input[type="text"] { flex: 1; }
.inline-fields > .field { flex: 1; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--tt-line, #d9e1ef);
  color: var(--tt-text, #172033);
  background: var(--tt-surface-soft, #fbfdff);
  border-radius: 10px;
  padding: 10px 12px;
}

input[type="color"] {
  width: 54px;
  min-width: 54px;
  height: 46px;
  padding: 4px;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus, button:focus {
  outline: 3px solid var(--tt-primary-soft, #e9f1ff);
  border-color: var(--tt-primary, #2563eb);
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--tt-primary, #2563eb);
  color: var(--tt-surface, #ffffff);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--tt-primary-dark, #1d4ed8); }
button.ghost { background: var(--tt-primary-soft, #e9f1ff); color: var(--tt-primary-dark, #1d4ed8); }

.error {
  min-height: 1.3em;
  margin: 6px 0 0;
  color: var(--tt-danger, #b42318);
  font-weight: 700;
  font-size: .9rem;
}

.ratio-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 18px;
  background: var(--tt-primary-soft, #e9f1ff);
  border-radius: var(--tt-radius, 12px);
  margin-bottom: 16px;
}

.ratio-box .label { color: var(--tt-muted, #5d6b82); font-weight: 700; }
#ratio-output { font-size: clamp(2.5rem, 8vw, 4.5rem); font-weight: 900; line-height: 1; }
.ratio-suffix { font-weight: 800; }

.preview {
  min-height: 110px;
  border: 1px solid var(--tt-line, #d9e1ef);
  border-radius: var(--tt-radius, 12px);
  display: grid;
  place-items: center;
  padding: 20px;
  margin-bottom: 16px;
  overflow: hidden;
}

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

.pass-item {
  border: 1px solid var(--tt-line, #d9e1ef);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: var(--tt-surface-soft, #fbfdff);
}

.pass-item.pass strong { color: var(--tt-success, #087443); }
.pass-item.fail strong { color: var(--tt-danger, #b42318); }
.status { min-height: 1.4em; color: var(--tt-muted, #5d6b82); }
.suggestions { border-top: 1px solid var(--tt-line, #d9e1ef); padding-top: 14px; }
.suggestions p { margin-bottom: 0; }

.batch { margin-top: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; border-bottom: 1px solid var(--tt-line, #d9e1ef); padding: 9px; }
code { background: var(--tt-primary-soft, #e9f1ff); padding: 2px 5px; border-radius: 6px; }
.content-slot { margin-top: 22px; }

@media (max-width: 820px) {
  .tool-grid { grid-template-columns: 1fr; }
  .inline-fields, .actions-row { flex-direction: column; }
  .pass-grid { grid-template-columns: 1fr; }
}
