:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --border: #e3e5e9;
  --accent: #e8590c;
  --accent-soft: #fff1e8;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2025;
    --text: #f1f2f4;
    --text-muted: #9aa0aa;
    --border: #2c2f36;
    --accent: #ff8a3d;
    --accent-soft: #2a1c12;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 24px 16px 48px;
}

main {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-header {
  max-width: 480px;
  margin: 0 auto 20px;
  text-align: center;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input-row {
  display: flex;
  gap: 8px;
}

input[type="number"],
select {
  flex: 1;
  font-size: 1.05rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}

input[type="number"]:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hidden { display: none; }

.unit-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.unit-btn {
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  padding: 0 14px;
  font-size: 0.95rem;
  cursor: pointer;
}

.unit-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.result {
  margin-top: 20px;
  padding: 18px;
  border-radius: 10px;
  background: var(--accent-soft);
  text-align: center;
}

.result-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.result-value {
  display: block;
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.result-unit {
  font-size: 1.1rem;
  font-weight: 500;
  margin-left: 4px;
}

.result-sub {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.table-note {
  margin: -8px 0 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  white-space: nowrap;
}

th, td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

th:first-child, td:first-child {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
}

thead th {
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

tbody tr.is-highlighted {
  background: var(--accent-soft);
}

tbody tr.is-highlighted td:first-child {
  color: var(--accent);
}

.lang-en {
  display: block;
  font-size: 0.78em;
  font-weight: 400;
  color: var(--text-muted);
}

.result-label .lang-en,
.result-sub .lang-en {
  display: inline;
  font-size: 0.85em;
  margin-left: 2px;
}

.card h2 .lang-en {
  display: inline;
  font-size: 0.75em;
  margin-left: 6px;
}

.subtitle .lang-en {
  display: inline;
  margin-left: 6px;
}

.subtitle .lang-en::before {
  content: "/ ";
}

th .lang-en,
.unit-toggle .lang-en {
  display: inline;
}
