:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --fg: #e6e8ec;
  --muted: #8a93a6;
  --accent: #7cc4ff;
  --accent-2: #9ae6b4;
  --border: #272b35;
  --error: #ff6b6b;
  --source-tz-bg: #1a2838;
  --source-tz-border: #3b7bbf;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

header {
  padding: 24px 32px 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.02em;
}

header #subtitle {
  grid-column: 1 / 2;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.lang-switch {
  grid-column: 2 / 3;
  grid-row: 1 / 3;
  display: flex;
  align-items: center;
  gap: 6px;
}

main {
  padding: 24px 32px 48px;
  max-width: 1100px;
  margin: 0 auto;
}

section {
  margin-bottom: 28px;
}

h2 {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.input-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.input-section > label {
  margin-top: 12px;
}
.input-section > label:first-child {
  margin-top: 0;
}

input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 16px;
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

select {
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
}

button {
  margin-top: 14px;
  padding: 8px 14px;
  background: var(--accent);
  color: #0b1320;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
button:hover {
  filter: brightness(1.1);
}

.error {
  margin-top: 12px;
  color: var(--error);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.explanation {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}
.expl-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.expl-row:last-child {
  border-bottom: none;
}
.expl-label {
  color: var(--muted);
  font-size: 13px;
}
.expl-text {
  color: var(--fg);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 720px;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}
tbody tr:last-child td {
  border-bottom: none;
}
.index-col {
  width: 40px;
  color: var(--muted);
  text-align: right;
}
th.source-tz {
  background: var(--source-tz-bg);
  color: var(--accent);
  border-bottom: 1px solid var(--source-tz-border);
}
td.source-tz {
  background: var(--source-tz-bg);
  color: var(--accent);
}
.no-matches {
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

footer {
  padding: 24px 32px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 600px) {
  header, main, footer { padding-left: 18px; padding-right: 18px; }
  header h1 { font-size: 18px; }
  .expl-row { grid-template-columns: 80px 1fr; }
}
