:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f3;
  color: #172033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1560px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  letter-spacing: 0;
}

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

.topbar p {
  color: #526071;
  margin-top: 6px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 460px) 1fr;
  gap: 18px;
  align-items: start;
}

.controls,
.output {
  display: grid;
  gap: 14px;
}

.panel {
  background: #ffffff;
  border: 1px solid #d7dee5;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}

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

label {
  display: grid;
  gap: 5px;
  color: #475569;
  font-size: 13px;
}

input,
select {
  min-width: 0;
  height: 38px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 0 10px;
  background: #ffffff;
  color: #172033;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: #0f766e;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #115e59;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.validation {
  min-height: 20px;
  margin-top: 10px;
  color: #b91c1c;
  font-weight: 700;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  min-height: 68px;
  display: grid;
  align-content: space-between;
  background: #f8fafc;
}

.stat span {
  color: #64748b;
  font-size: 12px;
}

.stat strong {
  font-size: 19px;
}

canvas {
  width: 100%;
  height: 220px;
  margin-top: 14px;
  border: 1px solid #d7dee5;
  border-radius: 8px;
}

.visual-hand {
  min-height: 144px;
  display: grid;
  gap: 8px;
  color: #334155;
}

.hand-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cards-line {
  line-height: 1.35;
}

.explain {
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  color: #475569;
  font-size: 13px;
}

.explain p + p {
  margin-top: 4px;
}

.table-wrap {
  max-height: 520px;
  overflow: auto;
  border: 1px solid #d7dee5;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  z-index: 1;
}

.badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e2e8f0;
}

.badge.win,
.badge.blackjack {
  background: #dcfce7;
  color: #166534;
}

.badge.loss {
  background: #fee2e2;
  color: #991b1b;
}

.badge.push {
  background: #e0f2fe;
  color: #075985;
}

@media (max-width: 1050px) {
  .layout,
  .topbar {
    grid-template-columns: 1fr;
    display: grid;
  }

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

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1560px);
    padding-top: 10px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }
}
