* {
  box-sizing: border-box;
  border-radius: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #121212;
  color: #d8d8d8;
  font-family: Arial, sans-serif;
  font-size: 15px;
}

.box {
  width: 100%;
  max-width: 820px;
  margin: auto;
  padding: 24px;
  background: #181818;
  border: 1px solid #2e2e2e;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

h1, h2 {
  margin: 0;
  font-weight: normal;
  color: #efefef;
}

h1 {
  font-size: 21px;
}

h2 {
  font-size: 18px;
}

hr {
  border: 0;
  border-top: 1px solid #2b2b2b;
  margin: 16px 0;
}

.muted {
  color: #8f8f8f;
  margin: 8px 0 0;
  font-size: 14px;
}

.footer {
  margin: 0;
  color: #6f6f6f;
  font-size: 12px;
  text-align: center;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tool-btn {
  display: block;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  background: #1e1e1e;
  color: #dddddd;
  border: 1px solid #303030;
  font: inherit;
  cursor: pointer;
}

.tool-btn:hover {
  background: #262626;
}

.tool-btn b {
  display: block;
  font-weight: normal;
  color: #f0f0f0;
  margin-bottom: 2px;
}

.tool-btn span {
  color: #888888;
  font-size: 12px;
}

/* Okienko generatora */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.78);
  overflow-y: auto;
}

.modal[hidden] {
  display: none;
}

.modal-box {
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  margin: auto;
  padding: 22px;
  background: #181818;
  border: 1px solid #3b3b3b;
}

/* Pola i przyciski */
input,
select,
button {
  font: inherit;
  color: #e0e0e0;
  background: #1f1f1f;
  border: 1px solid #363636;
  border-radius: 0;
  outline: none;
}

input:focus,
select:focus {
  border-color: #5a5a5a;
}

input,
select {
  padding: 7px 8px;
}

input[type="checkbox"] {
  width: auto;
  margin-right: 6px;
}

.btn {
  padding: 6px 12px;
  background: #222222;
  border: 1px solid #3a3a3a;
  cursor: pointer;
}

.btn:hover {
  background: #2c2c2c;
}

.info {
  margin-bottom: 12px;
  color: #8f8f8f;
  font-size: 13px;
}

.cols {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.cols > div {
  flex: 1;
  min-width: 260px;
}

.field {
  margin-bottom: 11px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  color: #b5b5b5;
  font-size: 13px;
}

.field input:not([type="checkbox"]),
.field select {
  width: 100%;
}

.row-3 {
  display: flex;
  gap: 6px;
}

.row-3 input {
  width: 33.3%;
}

.checks {
  margin: 10px 0;
}

.checks label {
  display: inline-block;
  margin: 0 14px 6px 0;
  font-size: 13px;
  color: #cccccc;
}

.scroll-list {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid #2c2c2c;
  padding: 6px;
  background: #141414;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid #242424;
  font-size: 13px;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row input[type="number"] {
  width: 66px;
  padding: 4px 6px;
}

.rule-row {
  cursor: pointer;
}

.rule-row:hover {
  background: #1e1e1e;
}

.rule-desc {
  flex: 1;
  color: #858585;
  font-size: 12px;
}

.preview {
  margin: 12px 0;
  padding: 10px;
  background: #111111;
  border: 1px solid #2f2f2f;
  font-family: monospace;
  font-size: 15px;
}

.out-box {
  margin-top: 14px;
  padding: 12px;
  background: #111111;
  border: 1px solid #343434;
}

.out-code {
  display: block;
  margin-bottom: 10px;
  font-family: monospace;
  font-size: 13px;
  color: #f0f0f0;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 580px) {
  body {
    padding: 12px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
}