
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #20242b;
  --muted: #737b88;
  --line: #e5e8ed;
  --accent: #315fce;
  --accent-hover: #254eae;
  --soft: #edf1fa;

  font-family: -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  display: block;
  padding: 24px 16px;
}

.app {
  width: min(100%, 680px);
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .18em;
  margin: 0 0 8px;
}

h1 {
  font-size: clamp(25px, 5vw, 34px);
  margin: 0;
}

.subheading {
  color: var(--muted);
  margin: 10px 0 0;
  font-size: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(22px, 5vw, 38px);
  min-height: 270px;
  box-shadow: 0 12px 35px rgba(28, 39, 58, .06);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
}

.counter {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.tag {
  color: var(--accent);
  background: var(--soft);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
}

.formula {
  min-height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow-wrap: anywhere;
  padding: 24px 0;
  font-size: clamp(21px, 4.8vw, 30px);
}

.formula .katex-display {
  margin: 0;
  max-width: 100%;
}

.formula .katex {
  max-width: 100%;
  white-space: normal;
}

.answer-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0 18px;
}

.answer-tag {
  display: inline-block;
}

.answer-area .formula {
  min-height: 70px;
  padding-bottom: 4px;
}

.status {
  min-height: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0 8px;
}


.actions {
  display: grid;
  grid-template-columns: 1fr;
}

.button {
  border: 0;
  border-radius: 13px;
  width: 100%;
  min-height: 68px;
  padding: 16px 20px;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .15s;
  touch-action: manipulation;
}

.button:active {
  transform: scale(.98);
}

.button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.primary {
  color: white;
  background: var(--accent);
}

.primary:not(:disabled):hover {
  background: var(--accent-hover);
}

.secondary {
  color: var(--text);
  background: #e7eaf0;
}

.secondary:not(:disabled):hover {
  background: #dce1e9;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 25px;
}

code {
  background: #e9ecf1;
  padding: 2px 5px;
  border-radius: 5px;
}

@media (max-width: 420px) {
  body {
    padding: 22px 14px;
    align-items: start;
  }

  .header {
    margin: 28px 0 24px;
  }

  .card {
    min-height: 250px;
    border-radius: 17px;
  }

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

  .button {
    min-height: 56px;
  }
}
