:root {
  --ink: #17202b;
  --muted: #5d6b78;
  --line: #d8e0e6;
  --page: #edf3f5;
  --panel: #ffffff;
  --accent: #117a77;
  --ok: #177245;
  --warn: #8a5a00;
  --danger: #a33131;
}

* {
  box-sizing: border-box;
}

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

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

.hero,
.controls,
.statusGrid,
.phraseBox {
  background: var(--panel);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  padding: 18px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

h1,
p {
  margin-top: 0;
}

.hero a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.heroLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 170px 180px 110px;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

select,
button,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

select,
textarea {
  direction: ltr;
  padding: 10px;
}

button {
  cursor: pointer;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 800;
}

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

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

.statusGrid div {
  border: 1px solid var(--line);
  background: #f8fafb;
  padding: 12px;
}

.statusGrid span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.statusGrid strong {
  direction: ltr;
  display: block;
}

.slots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.slot {
  min-height: 86px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px;
  direction: ltr;
}

.slotIndex {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.slotWord {
  font-size: 22px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.slot.spinning .slotWord {
  color: var(--warn);
}

.slot.matched {
  border-color: var(--ok);
  background: #f0faf4;
}

.slot.matched .slotWord {
  color: var(--ok);
}

textarea {
  resize: vertical;
}

.balanceDetails {
  direction: ltr;
  border: 1px solid var(--line);
  background: #f8fafb;
  margin-top: 12px;
  padding: 12px;
}

.balanceDetails p {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.balanceDetails p:last-child {
  border-bottom: 0;
}

.balanceDetails span {
  color: var(--muted);
  font-weight: 700;
}

.balanceDetails strong {
  overflow-wrap: anywhere;
}

.danger {
  color: var(--danger);
  margin-bottom: 0;
}

.message {
  min-height: 24px;
  font-weight: 800;
}

@media (max-width: 820px) {
  .hero,
  .controls,
  .statusGrid {
    display: block;
  }

  .controls > *,
  .statusGrid > * {
    margin-bottom: 12px;
  }

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