:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --ink: #172126;
  --muted: #5d6b72;
  --line: #d9e2e5;
  --accent: #0f7b6c;
  --accent-strong: #07584d;
  --warn: #9a5b00;
  --ok: #14733f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
select,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.toolbar,
.panel,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 16px;
  align-items: end;
  padding: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

p {
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

select {
  min-width: 112px;
  padding: 9px 10px;
}

input {
  min-height: 40px;
  padding: 8px 10px;
}

.filePicker input {
  max-width: 260px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

button.secondary {
  border: 1px solid var(--line);
  background: #f8fbfb;
  color: var(--ink);
}

button.secondary:hover,
a.navButton:hover {
  background: #edf3f4;
}

a.navButton {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #f8fbfb;
  color: var(--accent-strong);
  text-decoration: none;
}

.panel {
  margin-top: 16px;
  padding: 18px;
}

.sectionTitle {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.actionRow,
.fileLinks,
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.fileLinks a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fbfcfc;
  color: var(--accent-strong);
  text-decoration: none;
}

.badge {
  border-radius: 999px;
  padding: 5px 10px;
  background: #edf2f3;
  color: var(--muted);
  font-size: 13px;
}

.badge.ok {
  background: #e6f5ec;
  color: var(--ok);
}

.wordGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0 0 14px 0;
  list-style-position: inside;
}

.wordGrid li {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfc;
}

textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

#mnemonicOutput {
  min-height: 76px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fbfcfc;
  font-size: 13px;
}

.tableWrap {
  overflow-x: auto;
}

.scrollTable {
  max-height: 520px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

th:first-child,
td:first-child {
  width: 52px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 76px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 140px;
}

td {
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.notice {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 14px 18px;
}

@media (max-width: 760px) {
  .toolbar {
    grid-template-columns: 1fr;
  }

  .wordGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
