:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #0f1214;
  color: #d6dde0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #2e3538;
  background: #1c2124;
  color: #d6dde0;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button.primary {
  border-color: #1e8a85;
  background: #1e8a85;
  color: #ffffff;
}

button.danger {
  border-color: #7a2f2f;
  color: #e07070;
}

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

input,
select {
  min-height: 38px;
  border: 1px solid #2e3538;
  border-radius: 6px;
  background: #1c2124;
  color: #d6dde0;
  padding: 0 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 36px);
  border-bottom: 1px solid #1e2528;
  background: #141a1d;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

p {
  margin: 5px 0 0;
  color: #7a8f96;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px clamp(12px, 3vw, 28px) 32px;
}

.actions,
.toolbar,
.addPanel,
.statusRow {
  display: flex;
  gap: 10px;
}

.toolbar,
.addPanel {
  margin-bottom: 12px;
}

.toolbar input,
.addPanel input {
  flex: 1;
  min-width: 0;
}

.statusRow {
  align-items: flex-start;
  justify-content: space-between;
  margin: 12px 0;
  color: #7a8f96;
}

#gitStatus {
  max-width: 70%;
  margin: 0;
  white-space: pre-wrap;
  text-align: right;
  font: 13px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.modList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.mod {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  min-height: 104px;
  padding: 14px;
  border: 1px solid #1e2528;
  border-radius: 8px;
  background: #141a1d;
}

.mod h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.mod .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pill {
  border: 1px solid #2a3438;
  border-radius: 999px;
  padding: 3px 8px;
  color: #8aa0a8;
  font-size: 12px;
  line-height: 1.2;
}

.file {
  grid-column: 1 / -1;
  color: #5a6e75;
  font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

dialog {
  border: 1px solid #1e2528;
  border-radius: 8px;
  padding: 18px;
  width: min(420px, calc(100vw - 28px));
  background: #141a1d;
  color: #d6dde0;
}

dialog label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #8aa0a8;
}

dialog input {
  width: 100%;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
}

#toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(520px, calc(100vw - 32px));
  border-radius: 8px;
  background: #2a3438;
  color: #d6dde0;
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: 150ms ease;
  pointer-events: none;
  white-space: pre-wrap;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 720px) {
  .topbar,
  .toolbar,
  .addPanel,
  .statusRow {
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions button,
  .addPanel button {
    flex: 1;
  }

  #gitStatus {
    max-width: 100%;
    text-align: left;
  }
}
