:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --border: #dcdcd8;
  --accent: #d9480f;
  --accent-soft: #fff1ea;
  --error: #b42318;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --surface: #1e1e21;
    --text: #ececee;
    --muted: #a0a0a8;
    --border: #34343a;
    --accent: #ff8a4c;
    --accent-soft: #2c1d16;
    --error: #ff8c80;
    color-scheme: dark;
  }
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}
h1 {
  margin: 0 0 4px;
  font-size: 28px;
}
.sub,
footer,
.note {
  color: var(--muted);
  font-size: 14px;
}
a {
  color: var(--accent);
}
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  padding: 40px 16px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop svg {
  color: var(--accent);
}
.drop span {
  color: var(--muted);
  font-size: 14px;
}
.drop:hover,
.drop:focus-visible,
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.drop.busy {
  pointer-events: none;
  opacity: 0.6;
}
.status {
  margin-top: 20px;
}
.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
#filename {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#stage {
  color: var(--muted);
  flex-shrink: 0;
}
.bar {
  height: 6px;
  margin-top: 8px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
#fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}
.error {
  margin-top: 20px;
  color: var(--error);
}
.result {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.bpm {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bpm .label {
  color: var(--muted);
  font-size: 14px;
}
.bpm .value {
  font-size: 72px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
dl div {
  text-align: center;
}
dt {
  color: var(--muted);
  font-size: 13px;
}
dd {
  margin: 0;
  font-weight: 600;
}
.button {
  display: block;
  padding: 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.button:hover {
  filter: brightness(1.08);
}
footer {
  margin-top: 40px;
}
.lang {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 16px;
}
.lang button {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.lang button:hover {
  color: var(--text);
}
.lang button[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
/* Japanese kanji use different glyph shapes from Traditional Chinese. */
html:lang(ja) body {
  font-family: system-ui, -apple-system, 'Segoe UI', 'Yu Gothic UI', 'Meiryo', 'Noto Sans JP', sans-serif;
}
