:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --ink: #f8f2e8;
  --muted: #bbaea0;
  --bg: #14110f;
  --panel: #211b17;
  --panel-2: #302720;
  --line: #4a3a30;
  --gold: #f0b74b;
  --lime: #80c96e;
  --pink: #eb5f76;
  --blue: #5ab1d0;
  --shadow: 0 24px 70px rgb(0 0 0 / 42%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgb(235 95 118 / 18%), transparent 34%),
    linear-gradient(240deg, rgb(128 201 110 / 16%), transparent 40%),
    var(--bg);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.app {
  width: min(1160px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}

.table,
.panel section {
  border: 1px solid rgb(255 255 255 / 10%);
  background: rgb(33 27 23 / 86%);
  box-shadow: var(--shadow);
}

.table {
  min-height: calc(100vh - 36px);
  border-radius: 8px;
  padding: clamp(16px, 3vw, 34px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
}

.topbar,
.actions,
.section-head,
.player-form,
.segmented,
.stats,
.chips,
.sips,
.toggle {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 12px;
}

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 900;
}

.round {
  min-width: 116px;
  height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--bg);
}

.round span,
.section-head span,
.settings > span,
.stats span,
.card-type {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.card {
  min-height: 480px;
  align-self: stretch;
  border-radius: 8px;
  padding: clamp(22px, 5vw, 60px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgb(240 183 75 / 18%), transparent 48%),
    linear-gradient(315deg, rgb(90 177 208 / 16%), transparent 52%),
    #2a211b;
  border: 1px solid rgb(255 255 255 / 12%);
}

.card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  width: 46%;
  aspect-ratio: 1;
  right: -16%;
  bottom: -20%;
  border: 22px solid rgb(255 255 255 / 8%);
  transform: rotate(22deg);
}

.card-type {
  margin: 0 0 16px;
  color: var(--gold);
}

h1 {
  width: min(920px, 100%);
  margin: 0;
  font-size: clamp(3rem, 8vw, 7.2rem);
  line-height: 0.98;
  letter-spacing: 0;
  text-wrap: balance;
  position: relative;
  z-index: 1;
}

.card p:not(.card-type) {
  width: min(680px, 100%);
  margin: 22px 0 0;
  color: #e2d4c7;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1.5;
  text-wrap: balance;
  position: relative;
  z-index: 1;
}

.sips {
  min-height: 38px;
  margin-top: 28px;
  gap: 10px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.sips span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pink);
  border: 2px solid rgb(255 255 255 / 68%);
}

.sips .water-dot {
  width: auto;
  height: 34px;
  border-radius: 999px;
  padding: 0 14px;
  display: grid;
  place-items: center;
  color: #08202b;
  background: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.actions {
  gap: 12px;
}

.actions button,
dialog .primary {
  min-height: 58px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
}

.actions button {
  flex: 1;
}

.primary {
  color: #16100c;
  background: var(--gold);
}

.secondary {
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.panel {
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
}

.panel section {
  border-radius: 8px;
  padding: 16px;
}

.section-head {
  justify-content: space-between;
  gap: 10px;
}

.section-head button {
  min-height: 34px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 900;
}

.player-form {
  gap: 8px;
  margin: 14px 0 12px;
}

input {
  min-width: 0;
  width: 100%;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #15110f;
  border: 1px solid var(--line);
}

.chips {
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  color: #19110e;
  background: var(--lime);
  font-weight: 900;
}

.settings {
  display: grid;
  gap: 12px;
}

.segmented {
  gap: 6px;
  padding: 5px;
  border-radius: 8px;
  background: #15110f;
  border: 1px solid var(--line);
}

.seg {
  flex: 1;
  min-height: 40px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.seg.active {
  color: #15110f;
  background: var(--blue);
}

.toggle {
  gap: 10px;
  min-height: 42px;
  color: var(--muted);
  font-weight: 800;
}

.toggle input {
  width: 22px;
  min-height: 22px;
  accent-color: var(--lime);
}

.stats {
  gap: 12px;
}

.stats div {
  flex: 1;
  min-height: 82px;
  border-radius: 8px;
  padding: 12px;
  background: #15110f;
  border: 1px solid var(--line);
}

.stats strong {
  display: block;
  margin-top: 6px;
  font-size: 2.4rem;
  line-height: 1;
}

.history {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

ol {
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  align-content: start;
  gap: 8px;
}

li {
  min-height: 52px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #15110f;
  border: 1px solid var(--line);
  font-weight: 900;
}

li span {
  display: block;
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 0.72rem;
  text-transform: uppercase;
}

dialog {
  width: min(440px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(0 0 0 / 72%);
}

dialog form {
  padding: 22px;
  display: grid;
  gap: 14px;
}

dialog .close {
  justify-self: end;
}

h2 {
  margin: 0;
  font-size: 2rem;
}

dialog p {
  margin: 0;
  color: #dccdc0;
  line-height: 1.5;
}

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
  }

  .table,
  .panel {
    min-height: auto;
  }

  .table {
    min-height: calc(100vh - 28px);
  }
}

@media (max-width: 540px) {
  .app {
    width: calc(100vw - 16px);
    padding: 8px 0 16px;
    gap: 10px;
  }

  .table {
    padding: 12px;
  }

  .card {
    min-height: 430px;
    padding: 28px 18px;
  }

  h1 {
    font-size: clamp(2.5rem, 14vw, 4.8rem);
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }
}
