:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #627083;
  --line: #d9e0e8;
  --panel: #ffffff;
  --surface: #f5f7f9;
  --accent: #176b5d;
  --accent-ink: #ffffff;
  --digit: #f1b948;
  --letter: #62c7b8;
  --ghost: #8a5cf6;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 0 18px;
}

button.secondary,
#copy {
  background: #e7ecef;
  color: var(--ink);
}

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

.topbar {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  line-height: 1.05;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

.topbar p {
  color: var(--muted);
  margin-top: 8px;
}

.controls {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 240px));
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.panel-title,
dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
}

input {
  height: 42px;
  padding: 0 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(23 107 93 / 14%);
}

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

.message-panel {
  margin-bottom: 18px;
  padding: 18px;
}

.panel-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.message {
  align-items: center;
  background: #101820;
  border-radius: 8px;
  color: #f9fbfc;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 74px;
  padding: 18px;
  word-break: break-word;
}

.char {
  border-radius: 4px;
  min-width: 8px;
  padding: 2px 1px;
}

.digit {
  background: var(--digit);
  color: #2b2208;
  font-weight: 800;
  padding-inline: 5px;
}

.letter {
  background: var(--letter);
  color: #082522;
  font-weight: 800;
  padding-inline: 5px;
}

.ghost {
  background: rgb(138 92 246 / 22%);
  border: 1px solid rgb(178 157 255 / 70%);
  color: #dfd6ff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 5px;
}

textarea {
  height: 86px;
  margin-top: 12px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 18px;
}

.full {
  grid-column: 1 / -1;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.facts div {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 3px;
  padding-top: 12px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.rows {
  display: grid;
  gap: 10px;
}

.row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: 110px 1fr 110px;
  padding-top: 10px;
}

.compact .row {
  grid-template-columns: 100px 1fr 90px;
}

.badge {
  background: #eef3f5;
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-width: 56px;
  padding: 4px 8px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .controls,
  .grid,
  .row,
  .compact .row {
    grid-template-columns: 1fr;
  }
}
