:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --accent: #2563eb;
  --text: #111827;
  --muted: #6b7280;
  --error: #b91c1c;
  --success: #16a34a;
  --border-subtle: #e5e7eb;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, rgba(59,130,246,0.12), transparent 32%),
              radial-gradient(circle at 80% 0%, rgba(45,212,191,0.14), transparent 38%),
              var(--bg);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text);
  padding: 24px;
}
.card {
  width: min(480px, 100%);
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  padding: 24px 28px;
  backdrop-filter: blur(6px);
}
h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.02em;
}
p.lead {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
}
.field {
  margin-bottom: 14px;
}
.label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}
input[type="number"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: #f9fafb;
  color: var(--text);
  font-size: 16px;
  transition: border-color 150ms, box-shadow 150ms, transform 120ms;
}
input[type="number"]:focus {
  outline: none;
  border-color: rgba(37,99,235,0.9);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
  transform: translateY(-1px);
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
button {
  flex: 1;
  padding: 13px 16px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  box-shadow: 0 10px 24px rgba(37,99,235,0.35);
  transition: transform 120ms, box-shadow 120ms, filter 150ms;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); box-shadow: 0 6px 20px rgba(79,70,229,0.35); }
.muted-btn {
  flex: 0 0 auto;
  width: 48px;
  background: #e5e7eb;
  color: var(--muted);
  box-shadow: none;
  transition: background 120ms, color 120ms;
}
.muted-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.result {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 15px;
  min-height: 56px;
}
.value {
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
}
.helper-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin: 4px 0 0;
}
.helper-link:hover { text-decoration: underline; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 20px 80px rgba(15,23,42,0.25);
  max-width: 720px;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.modal::-webkit-scrollbar {
  display: none;
}
.modal img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(90vh - 44px);
  object-fit: contain;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 14px;
}
.close-btn {
  border: none;
  background: #e5e7eb;
  color: var(--text);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  flex: 0 0 auto;
  box-shadow: none;
}
.close-btn:hover { background: rgba(255,255,255,0.12); }
.notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid var(--border-subtle);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.notice a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.notice a:hover { text-decoration: underline; }
.error {
  color: var(--error);
  font-weight: 600;
}
footer {
  margin-top: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 520px) {
  .card { padding: 20px; }
  h1 { font-size: 22px; }
  button { font-size: 14px; }
}


