:root {
  color-scheme: light;
  --ink: #162e33;
  --muted: #5a6b6d;
  --paper: #f9f5ea;
  --paper-strong: #fffdf7;
  --teal: #123d4a;
  --teal-light: #2f817f;
  --coral: #db544f;
  --yellow: #f2c45c;
  --wood: #a85e34;
  --wood-dark: #66391f;
  --wood-light: #d08b51;
  --focus: #087d95;
  --border: rgba(18, 61, 74, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--teal);
}

body {
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: #e9e2d3;
  background-image:
    linear-gradient(rgba(249, 245, 234, 0.74), rgba(249, 245, 234, 0.74)),
    url("assets/banig-background.png");
  background-size: 960px auto;
  background-attachment: fixed;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible + span {
  outline: 3px solid rgba(8, 125, 149, 0.5);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 10px 14px;
  color: white;
  background: var(--teal);
  border-radius: 6px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  width: 100%;
  min-width: 0;
  color: white;
  background: var(--teal);
  border-bottom: 4px solid var(--coral);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  min-height: 78px;
  min-width: 0;
  margin: 0 auto;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  line-height: 0.95;
  letter-spacing: 0;
}

.brand p {
  margin: 5px 0 0;
  color: #b8dcda;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 34px;
  flex: 0 0 auto;
  background: var(--wood);
  border: 2px solid #e8b36c;
  border-radius: 50% 50% 46% 46%;
  box-shadow: inset 0 -5px 0 rgba(69, 28, 14, 0.25);
}

.brand-mark i {
  width: 8px;
  height: 8px;
  margin: 0 2px;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: inset 0 -2px 0 rgba(126, 76, 17, 0.24);
}

.brand-mark i:nth-child(2) {
  background: #59c3b5;
}

.brand-mark i:nth-child(3) {
  background: #f8786e;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon-button,
.command-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 42px;
  padding: 0;
  color: currentColor;
  background: transparent;
  border-radius: 50%;
}

.site-header .icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.icon-button svg,
.command-button svg,
.select-control svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

.sound-off,
.is-muted .sound-on {
  display: none;
}

.is-muted .sound-off {
  display: block;
}

.command-button {
  gap: 8px;
  padding: 0 16px;
  color: #17363e;
  font-weight: 800;
  background: var(--yellow);
  border-radius: 6px;
  box-shadow: 0 2px 0 #b98826;
}

.command-button:hover {
  background: #ffda7e;
}

.command-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #b98826;
}

.app-shell {
  flex: 1 0 auto;
  min-width: 0;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 24px;
}

.game-controls {
  display: flex;
  align-items: end;
  min-height: 56px;
  padding-bottom: 16px;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 3px;
  margin: 0;
  background: rgba(255, 253, 247, 0.76);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.segmented-control legend,
.select-control > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 105px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  border-radius: 5px;
}

.segmented-control input:checked + span {
  color: white;
  background: var(--teal);
  box-shadow: 0 1px 3px rgba(13, 50, 58, 0.2);
}

.select-control {
  position: relative;
  display: flex;
  align-items: center;
}

.select-control[hidden] {
  display: none;
}

.select-control select {
  min-height: 46px;
  padding: 0 40px 0 14px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  appearance: none;
  background: rgba(255, 253, 247, 0.76);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.language-control select {
  min-width: 118px;
}

.select-control svg {
  position: absolute;
  right: 12px;
  width: 16px;
  pointer-events: none;
}

.shell-total {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin-left: auto;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.shell-total strong {
  color: var(--ink);
  font-size: 16px;
}

.mini-shell,
.shell {
  display: block;
  background: #f2d597;
  border: 1px solid rgba(83, 45, 18, 0.35);
  border-radius: 50% 50% 46% 46%;
  box-shadow: inset 0 -2px 0 rgba(107, 61, 23, 0.2), 0 1px 1px rgba(44, 23, 10, 0.22);
}

.mini-shell {
  width: 17px;
  height: 13px;
  transform: rotate(-12deg);
}

.turn-strip {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.4fr) auto;
  align-items: center;
  min-height: 72px;
  padding: 12px 18px;
  margin: 18px 0 16px;
  background: rgba(255, 253, 247, 0.9);
  border: 1px solid rgba(18, 61, 74, 0.14);
  border-left: 5px solid var(--teal-light);
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(28, 53, 51, 0.07);
}

.turn-owner {
  display: flex;
  align-items: center;
  gap: 11px;
}

.player-token {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: var(--coral);
  border: 3px solid #ffd8c8;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #b83e3a;
}

.player-token.player-two,
.turn-strip.player-two-turn .player-token {
  background: var(--teal-light);
  border-color: #bee4df;
  box-shadow: 0 0 0 1px #1c6664;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0;
}

.turn-owner strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.turn-strip p {
  margin: 0;
  color: #314c50;
  font-size: 14px;
  text-align: center;
}

.turn-number {
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #edf1eb;
  border-radius: 6px;
}

.board-section {
  position: relative;
  padding: 22px 0 24px;
}

.player-name {
  display: flex;
  align-items: center;
  width: max-content;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.player-name-top {
  margin: 0 0 9px 9%;
}

.player-name-bottom {
  margin: 9px 9% 0 auto;
}

.board-frame {
  position: relative;
  width: 100%;
  padding: 22px 26px;
  overflow: hidden;
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(4deg, rgba(255, 224, 164, 0.08) 0 2px, transparent 2px 12px),
    repeating-linear-gradient(92deg, rgba(73, 32, 15, 0.08) 0 1px, transparent 1px 18px);
  border: 7px solid #744023;
  border-radius: 68px 68px 54px 54px;
  box-shadow:
    inset 0 5px 0 rgba(255, 213, 139, 0.28),
    inset 0 -8px 0 rgba(71, 29, 12, 0.23),
    0 14px 28px rgba(43, 45, 34, 0.22);
}

.board-frame::before,
.board-frame::after {
  position: absolute;
  top: 50%;
  width: 15px;
  height: 70%;
  background: #d99a5e;
  border-radius: 50%;
  content: "";
  opacity: 0.35;
  transform: translateY(-50%);
}

.board-frame::before {
  left: 3px;
}

.board-frame::after {
  right: 3px;
}

.board-grain {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 218, 155, 0.22);
  border-radius: 54px;
  pointer-events: none;
}

.sungka-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(82px, 0.85fr) minmax(0, 6fr) minmax(82px, 0.85fr);
  grid-template-rows: repeat(2, 88px);
  align-items: stretch;
  gap: 14px 18px;
}

.pit-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(48px, 1fr));
  align-items: center;
  gap: 12px;
}

.top-row {
  grid-column: 2;
  grid-row: 1;
}

.bottom-row {
  grid-column: 2;
  grid-row: 2;
}

.pit,
.store {
  position: relative;
  overflow: hidden;
  color: #fff8e8;
  background: #56301f;
  border: 2px solid rgba(67, 25, 12, 0.78);
  box-shadow:
    inset 0 8px 14px rgba(22, 8, 3, 0.76),
    inset 0 -3px 5px rgba(240, 163, 91, 0.22),
    0 2px 0 rgba(239, 176, 103, 0.55);
}

.pit {
  width: 100%;
  max-width: 82px;
  aspect-ratio: 1;
  justify-self: center;
  padding: 0;
  border-radius: 50%;
  cursor: default;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.pit.is-playable {
  cursor: pointer;
  border-color: #ffe18d;
  box-shadow:
    inset 0 8px 14px rgba(22, 8, 3, 0.7),
    inset 0 -3px 5px rgba(240, 163, 91, 0.25),
    0 0 0 3px rgba(255, 224, 130, 0.48),
    0 5px 0 rgba(79, 36, 17, 0.32);
}

.pit.is-playable:hover {
  transform: translateY(-3px);
  box-shadow:
    inset 0 8px 14px rgba(22, 8, 3, 0.68),
    0 0 0 4px rgba(255, 229, 150, 0.66),
    0 7px 0 rgba(79, 36, 17, 0.35);
}

.pit.is-active {
  animation: pit-pulse 380ms ease both;
}

.pit:disabled {
  opacity: 1;
}

.pit-number {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 27px;
  padding: 0 5px;
  color: white;
  font-size: 13px;
  font-weight: 900;
  background: rgba(29, 15, 9, 0.72);
  border: 1px solid rgba(255, 242, 204, 0.34);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.shell-layer {
  position: absolute;
  inset: 0;
}

.shell {
  position: absolute;
  left: var(--shell-x);
  top: var(--shell-y);
  width: 17px;
  height: 13px;
  transform: translate(-50%, -50%) rotate(var(--shell-r));
}

.shell:nth-child(3n + 2) {
  background: #e98768;
}

.shell:nth-child(3n + 3) {
  background: #6fc4b5;
}

.store {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-radius: 50%;
}

.store-left {
  grid-column: 1;
  grid-row: 1 / 3;
}

.store-right {
  grid-column: 3;
  grid-row: 1 / 3;
}

.store-owner,
.store-label {
  position: relative;
  z-index: 3;
  max-width: 80%;
  overflow: hidden;
  color: rgba(255, 242, 215, 0.68);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.store-count {
  position: relative;
  z-index: 3;
  margin: 2px 0;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(29, 12, 5, 0.8);
}

.store-shells {
  position: absolute;
  inset: 9px;
  opacity: 0.72;
}

.store-shells .shell {
  width: 14px;
  height: 10px;
}

.move-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(360px, 1.3fr);
  padding: 18px 0;
  gap: 34px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.move-summary p {
  margin: 5px 0 0;
  color: #314c50;
  font-size: 14px;
}

.event-list {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  padding: 0;
  margin: 0;
  gap: 8px;
  list-style: none;
}

.event-list li {
  flex: 0 1 auto;
  padding: 6px 9px;
  overflow: hidden;
  color: #38585b;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.event-list .event-capture {
  color: #8c2c2a;
  border-color: rgba(219, 84, 79, 0.38);
}

.event-list .event-extra {
  color: #63500f;
  border-color: rgba(185, 138, 30, 0.42);
}

.event-list .empty-event {
  color: var(--muted);
  background: transparent;
  border-style: dashed;
}

footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  gap: 9px;
  color: #c5d9d7;
  font-size: 12px;
  background: var(--teal);
}

footer button {
  padding: 4px;
  color: white;
  text-decoration: underline;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.modal {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--ink);
  background: var(--paper-strong);
  border: 1px solid rgba(18, 61, 74, 0.22);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(10, 39, 46, 0.34);
}

.modal::backdrop {
  background: rgba(8, 31, 36, 0.72);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal h2 {
  margin: 4px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  letter-spacing: 0;
}

.modal-close {
  margin: -7px -7px 0 0;
}

.modal-close:hover {
  background: #edf1eb;
}

.rules-content {
  max-height: calc(100vh - 150px);
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.rules-content ol {
  display: grid;
  padding-left: 23px;
  margin: 0;
  gap: 12px;
}

.rules-content li {
  padding-left: 5px;
  color: #385256;
  font-size: 14px;
  line-height: 1.55;
}

.rules-content li::marker {
  color: var(--coral);
  font-weight: 900;
}

.terms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 22px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.terms div {
  padding: 13px 10px;
  text-align: center;
}

.terms div + div {
  border-left: 1px solid var(--border);
}

.terms span,
.terms strong {
  display: block;
}

.terms span {
  color: var(--coral);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 800;
}

.terms strong {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.variant-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.result-modal {
  max-width: 480px;
  padding: 32px;
  text-align: center;
}

.result-symbol {
  display: flex;
  justify-content: center;
  height: 36px;
  margin-bottom: 13px;
  gap: 6px;
}

.result-symbol span {
  display: block;
  width: 24px;
  height: 19px;
  background: var(--yellow);
  border: 1px solid #a77313;
  border-radius: 50%;
  transform: rotate(-10deg);
}

.result-symbol span:nth-child(2) {
  background: var(--coral);
  border-color: #9e3532;
  transform: translateY(8px) rotate(12deg);
}

.result-symbol span:nth-child(3) {
  background: #57b9ae;
  border-color: #277c75;
  transform: rotate(18deg);
}

.result-modal > p {
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.final-score {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 14px;
  margin-bottom: 23px;
  background: #edf1eb;
  border-radius: 8px;
}

.final-score div span,
.final-score div strong {
  display: block;
}

.final-score div span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.final-score div strong {
  margin-top: 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.secondary-button {
  padding: 0 15px;
  font-weight: 800;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.secondary-button:hover {
  background: #edf1eb;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(340px, calc(100% - 36px));
  padding: 11px 14px;
  color: white;
  font-size: 13px;
  font-weight: 750;
  background: var(--teal);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(9, 43, 50, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pit-pulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 900px) {
  .app-shell,
  .header-inner {
    width: min(100% - 28px, 760px);
  }

  .sungka-board {
    grid-template-columns: 66px minmax(0, 6fr) 66px;
    grid-template-rows: repeat(2, 72px);
    gap: 10px 12px;
  }

  .pit-row {
    grid-template-columns: repeat(7, minmax(38px, 1fr));
    gap: 7px;
  }

  .shell {
    width: 13px;
    height: 10px;
  }

  .store-count {
    font-size: 28px;
  }
}

@media (max-width: 680px) {
  .header-inner {
    min-height: 68px;
  }

  .brand-mark {
    width: 40px;
    height: 30px;
  }

  .brand h1 {
    font-size: 27px;
  }

  .header-actions .icon-button:nth-child(2) {
    display: none;
  }

  .command-button {
    padding: 0 11px;
    font-size: 12px;
  }

  .game-controls {
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
  }

  .segmented-control {
    flex: 1 0 100%;
  }

  .segmented-control span {
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
  }

  .select-control {
    flex: 1 1 0;
    min-width: 0;
  }

  .select-control select {
    width: 100%;
    max-width: none;
    padding-left: 10px;
    font-size: 12px;
  }

  .shell-total {
    display: none;
  }

  .turn-strip {
    grid-template-columns: 1fr auto;
    min-height: 76px;
  }

  .turn-strip p {
    grid-column: 1 / 3;
    grid-row: 2;
    margin-top: 8px;
    text-align: left;
  }

  .turn-number {
    grid-column: 2;
    grid-row: 1;
  }

  .board-section {
    padding-top: 14px;
  }

  .board-frame {
    padding: 16px;
    border-width: 5px;
    border-radius: 42px;
  }

  .sungka-board {
    grid-template-columns: repeat(7, minmax(38px, 1fr));
    grid-template-rows: 42px 56px 56px 42px;
    gap: 7px 5px;
  }

  .pit-row {
    display: contents;
  }

  .top-row .pit {
    grid-row: 2;
  }

  .bottom-row .pit {
    grid-row: 3;
  }

  .pit {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    max-height: 56px;
    aspect-ratio: auto;
  }

  .top-row .pit:nth-child(1),
  .bottom-row .pit:nth-child(1) { grid-column: 1; }
  .top-row .pit:nth-child(2),
  .bottom-row .pit:nth-child(2) { grid-column: 2; }
  .top-row .pit:nth-child(3),
  .bottom-row .pit:nth-child(3) { grid-column: 3; }
  .top-row .pit:nth-child(4),
  .bottom-row .pit:nth-child(4) { grid-column: 4; }
  .top-row .pit:nth-child(5),
  .bottom-row .pit:nth-child(5) { grid-column: 5; }
  .top-row .pit:nth-child(6),
  .bottom-row .pit:nth-child(6) { grid-column: 6; }
  .top-row .pit:nth-child(7),
  .bottom-row .pit:nth-child(7) { grid-column: 7; }

  .store {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 16px;
    border-radius: 22px;
  }

  .store-left {
    grid-column: 1 / 8;
    grid-row: 1;
  }

  .store-right {
    grid-column: 1 / 8;
    grid-row: 4;
  }

  .store-count {
    margin-left: auto;
    font-size: 23px;
  }

  .store-label {
    margin-left: 6px;
  }

  .store-owner {
    max-width: 50%;
  }

  .shell-layer,
  .store-shells {
    opacity: 0.35;
  }

  .player-name-top {
    margin-left: 4px;
  }

  .player-name-bottom {
    margin-right: 4px;
  }

  .move-summary {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .event-list {
    justify-content: flex-start;
    overflow-x: auto;
  }
}

@media (max-width: 460px) {
  .app-shell,
  .header-inner {
    width: calc(100% - 20px);
  }

  .brand p,
  .header-actions > .icon-button:first-child {
    display: none;
  }

  .header-actions {
    gap: 2px;
  }

  .header-actions .command-button {
    width: 42px;
    padding: 0;
  }

  .header-actions .command-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .header-actions .command-button svg {
    display: block;
  }

  .game-controls {
    padding-bottom: 12px;
  }

  .segmented-control span {
    min-height: 36px;
    font-size: 11px;
  }

  .select-control select {
    min-height: 44px;
    max-width: none;
  }

  .turn-strip {
    margin-top: 13px;
    padding: 10px 12px;
  }

  .board-frame {
    padding: 12px 8px;
    border-radius: 31px;
  }

  .sungka-board {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
    grid-template-rows: 40px 52px 52px 40px;
    gap: 5px 3px;
  }

  .pit {
    min-height: 42px;
  }

  .pit-number {
    min-width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .shell {
    width: 10px;
    height: 8px;
  }

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

  .terms div + div {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .result-modal {
    padding: 26px 18px;
  }

  .result-actions {
    flex-direction: column-reverse;
  }
}
