@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  --bg-start: #f3f9ff;
  --bg-end: #fdf8ef;
  --ink: #1f2430;
  --muted: #5a667a;
  --brand: #0b7a75;
  --brand-strong: #075f5b;
  --line: #d8deea;
  --card: rgba(255, 255, 255, 0.94);
  --shadow: 0 22px 42px -24px rgba(31, 36, 48, 0.34);
  --radius-lg: 16px;
  --radius-md: 11px;
  --space-xs: 0.4rem;
  --space-sm: 0.62rem;
  --space-md: 0.84rem;
  --space-lg: 1rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
  font-family: 'Noto Sans SC', 'PingFang SC', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% -10%, #d6f4ff 0%, transparent 45%),
    radial-gradient(circle at 90% 0%, #ffe7c8 0%, transparent 34%),
    linear-gradient(150deg, var(--bg-start), var(--bg-end));
}

.container {
  width: min(980px, calc(100% - 1rem));
  margin: 1rem auto;
  display: grid;
  gap: var(--space-md);
}

.hero {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.88rem 1rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.badge {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand);
}

h1,
h2 {
  margin: 0.24rem 0 0;
  font-family: 'Space Grotesk', 'Noto Sans SC', sans-serif;
  line-height: 1.22;
}

h1 {
  font-size: clamp(1.15rem, 2vw + 0.65rem, 1.58rem);
}

h2 {
  font-size: clamp(1.03rem, 1.1vw + 0.73rem, 1.24rem);
}

.subtitle {
  margin: 0.34rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  background: var(--card);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

select,
button,
input {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  font: inherit;
  color: var(--ink);
}

select,
input {
  background: #ffffff;
}

button {
  cursor: pointer;
  background: var(--brand);
  color: #ffffff;
  border-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
  white-space: nowrap;
}

button:hover {
  background: var(--brand-strong);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -12px rgba(7, 95, 91, 0.95);
}

button:active {
  transform: translateY(0);
}

.table-wrap {
  width: 100%;
  overflow-x: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th:nth-child(1),
td:nth-child(1) {
  width: 2rem;
}

th:nth-child(2),
td:nth-child(2) {
  width: 4.8rem;
}

th:nth-child(3),
td:nth-child(3) {
  width: auto;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 0.52rem;
  vertical-align: top;
  font-size: 0.88rem;
  line-height: 1.3;
}

th {
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover {
  background: rgba(11, 122, 117, 0.06);
}

td code,
.result code {
  display: inline-block;
  max-width: 100%;
  font-family: 'Space Grotesk', monospace;
  background: #f2f4f8;
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.solver-card {
  margin-bottom: 0.3rem;
}

.solver-inputs {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(120px, 1fr);
  gap: 0.5rem;
}

.result {
  min-height: 1.2rem;
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.3;
}

.result.error {
  color: #b1302c;
}

.result.success {
  color: #0b7a75;
}

@media (max-width: 860px) {
  .solver-inputs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .container {
    width: min(100%, calc(100% - 0.56rem));
    margin: 0.44rem auto;
  }

  .card,
  .hero {
    border-radius: 12px;
    padding: 0.54rem;
  }

  .toolbar {
    align-items: center;
    gap: 0.42rem;
  }

  .toolbar button,
  .toolbar select,
  .field {
    width: 100%;
  }

  .table-wrap {
    margin: 0;
    padding: 0;
  }

  table {
    table-layout: fixed;
  }

  th,
  td {
    padding: 0.28rem;
    font-size: 0.76rem;
    line-height: 1.24;
  }

  th:nth-child(1),
  td:nth-child(1) {
    width: 1.7rem;
  }

  th:nth-child(2),
  td:nth-child(2) {
    width: 4.4rem;
  }

  .solver-inputs {
    gap: 0.28rem;
  }
}
