:root {
  --bg: #ff8a3d;
  --bg2: #ff5c35;
  --surface: #fff6ec;
  --text: #1c1208;
  --muted: #6b4a32;
  --accent: #1c1208;
  --shadow: rgb(28 18 8 / 0.18);
  --safe-t: max(12px, env(safe-area-inset-top));
  --safe-b: max(16px, env(safe-area-inset-bottom));
  --safe-l: max(16px, env(safe-area-inset-left));
  --safe-r: max(16px, env(safe-area-inset-right));
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: ui-rounded, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, #fff 35%, transparent), transparent 50%),
    radial-gradient(900px 500px at 110% 10%, color-mix(in srgb, #000 16%, transparent), transparent 45%),
    linear-gradient(165deg, var(--bg), var(--bg2));
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

.sidebar {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: var(--safe-t) var(--safe-r) 8px var(--safe-l);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pg-btn,
.tool-btn,
.me-btn,
.split-btn,
.step {
  border: 0;
  background: color-mix(in srgb, #fff 82%, var(--bg));
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 0.8rem;
  box-shadow: 0 6px 16px var(--shadow);
  cursor: pointer;
  white-space: nowrap;
}

.pg-sheet {
  margin: 0 var(--safe-l) 10px;
  background: var(--surface);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 10px 24px var(--shadow);
}

.pg-sheet nav,
.pg-sheet a {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pg-sheet a {
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  padding: 12px 14px;
  border-radius: 12px;
}

.pg-sheet a.active {
  background: color-mix(in srgb, var(--bg) 22%, #fff);
}

.page-pot {
  overscroll-behavior: none;
  height: 100dvh;
  overflow: hidden;
}

.page-pot main {
  position: relative;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.pot-stage {
  padding: 0 var(--safe-l) var(--safe-b) var(--safe-r);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.pot-stage {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.players {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
}

.players .step {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

.players-label,
.deal-log {
  font-size: 0.78rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--text) 78%, #fff);
}

.my-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.me-btn.on {
  background: var(--text);
  color: var(--surface);
}

.mine-slot {
  min-width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: 0 8px 16px var(--shadow);
  cursor: pointer;
}

.mine-slot.filled {
  background: var(--text);
  color: var(--surface);
}

.split-btn {
  background: var(--text);
  color: var(--surface);
}

.split-wait,
.split-note {
  font-size: 0.82rem;
  font-weight: 750;
}

.split-labels {
  display: flex;
  gap: 12px;
  font-weight: 800;
}

.advice {
  display: grid;
  gap: 8px;
}

.hand-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 12px 14px;
  box-shadow: 0 10px 24px var(--shadow);
}

.hand-card.ask {
  background: color-mix(in srgb, #16a34a 18%, var(--surface));
}

.hand-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
}

.verdict {
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.verdict.ask {
  color: #15803d;
}

.verdict.wait {
  color: var(--text);
  font-size: 1.15rem;
}

.hand-sub {
  margin-top: 2px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.rank-pad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 6px;
  flex: 1;
  min-height: 210px;
  min-width: 0;
  width: 100%;
}

.rank {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 16px var(--shadow);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.rank:active {
  transform: scale(0.96);
}

.rank.full {
  opacity: 0.38;
}

.rank[data-rank="13"] {
  grid-column: auto;
}

.rank-name {
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.pips {
  display: flex;
  gap: 3px;
}

.pips i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--muted) 80%, #000);
  display: block;
}

.pips i.on {
  background: var(--text);
  border-color: var(--text);
}

.tool-btn.armed {
  background: var(--text);
  color: var(--surface);
}

.tool-btn:disabled {
  opacity: 0.4;
}

@media (min-width: 900px) {
  .pg-btn,
  .pg-sheet {
    display: none !important;
  }

  .page-pot {
    display: flex;
    height: auto;
    overflow: auto;
  }

  .page-pot .pot-stage {
    max-width: 520px;
    margin: 12px auto 32px;
  }
}

.brand {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.install-btn,
.ios-tip {
  border: 0;
  background: color-mix(in srgb, #fff 82%, var(--bg));
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 6px 16px var(--shadow);
  cursor: pointer;
}

.ios-tip {
  display: none;
  max-width: 210px;
  text-align: left;
  line-height: 1.25;
}

.ios-tip.show,
.install-btn.show {
  display: inline-flex;
}

.install-btn[hidden],
.ios-tip[hidden] {
  display: none !important;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px var(--safe-l) var(--safe-b) var(--safe-r);
  gap: 8px;
  min-height: calc(100dvh - 88px);
}

.card {
  width: min(100%, 440px);
  background: var(--surface);
  border-radius: 28px;
  padding: 18px 16px 16px;
  box-shadow: 0 18px 40px var(--shadow);
}

.card-kicker {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.field {
  background: color-mix(in srgb, var(--bg) 14%, #fff);
  border-radius: 20px;
  padding: 12px 14px 10px;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.amount {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: clamp(1.7rem, 7vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  outline: none;
  padding: 4px 0 2px;
}

.amount::placeholder {
  color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.out-amount {
  min-height: 1.2em;
  word-break: break-all;
}

.swap-wrap {
  display: flex;
  justify-content: center;
  margin: -10px 0;
  position: relative;
  z-index: 1;
}

.swap {
  width: 48px;
  height: 48px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 16px var(--shadow);
}

.swap svg {
  width: 22px;
  height: 22px;
}

.swap.spin svg {
  animation: spin 0.35s ease;
}

.rate {
  margin-top: 12px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
}

@media (min-width: 900px) {
  body {
    display: flex;
    align-items: stretch;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 260px;
    flex-shrink: 0;
    min-height: 100dvh;
    padding: 28px 18px;
    background: color-mix(in srgb, #000 22%, transparent);
    color: #fff;
    backdrop-filter: blur(10px);
  }

  .sidebar h1 {
    font-size: 1.8rem;
    letter-spacing: -0.04em;
    margin-bottom: 4px;
  }

  .sidebar p {
    opacity: 0.8;
    font-size: 0.92rem;
    margin-bottom: 28px;
  }

  .nav-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .nav-list a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgb(255 255 255 / 0.1);
  }

  .nav-list a.active {
    background: #fff;
    color: var(--text);
  }

  .sidebar-foot {
    margin-top: auto;
    opacity: 0.7;
    font-size: 0.8rem;
  }

  .topbar {
    justify-content: flex-end;
    padding: 20px 36px 0;
  }

  .topbar .brand {
    display: none;
  }

  main {
    flex: 1;
  }

  .stage {
    min-height: calc(100dvh - 70px);
    justify-content: center;
    align-items: center;
    padding: 24px 40px 40px;
  }

  .card {
    width: 440px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .swap.spin svg {
    animation: none;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(180deg);
  }
}
