:root {
  --ink: #173746;
  --paper: #fff8df;
  --sun: #f2c84b;
  --coral: #e9504e;
  --forest: #24664a;
  --sky: #a8dcf0;
  --blue: #2877bf;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #102b27;
}

html.pan-enabled,
body.pan-enabled {
  overflow: auto;
  cursor: grab;
}

body.pan-enabled.dragging-page {
  cursor: grabbing;
}

body.pan-enabled .game {
  position: relative;
  width: max(100vw, 1180px);
  height: max(100vh, 340px);
}

body,
button {
  font-family: "YouYuan", "STKaiti", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button {
  color: inherit;
}

.game {
  position: fixed;
  inset: 0;
  min-width: 320px;
  min-height: 320px;
  overflow: hidden;
  color: var(--paper);
  background: var(--sky);
  user-select: none;
  -webkit-user-select: none;
}

.developer-access {
  position: absolute;
  z-index: 24;
  top: max(78px, calc(env(safe-area-inset-top) + 68px));
  right: max(18px, env(safe-area-inset-right));
  min-height: 34px;
  padding: 6px 10px;
  border: 2px solid rgba(255, 245, 198, 0.72);
  border-radius: 4px;
  color: #fff4c1;
  background: rgba(17, 57, 56, 0.82);
  box-shadow: 0 6px 14px rgba(5, 28, 27, 0.25);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
}

.developer-mode .developer-access {
  border-color: #ffe37a;
  color: #173746;
  background: #ffe37a;
}

.world,
.world canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.world canvas {
  display: block;
  touch-action: none;
}

.loading {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--ink);
  background: var(--sky);
  transition: opacity 260ms ease, visibility 260ms ease;
}

.loading.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading span {
  width: 46px;
  height: 46px;
  border: 5px solid rgba(23, 55, 70, 0.18);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: loading-spin 760ms linear infinite;
}

.loading strong {
  font-size: 16px;
}

.loading small {
  max-width: 340px;
  text-align: center;
}

.entrance {
  position: absolute;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff7d5;
  background: transparent;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.entrance[hidden] {
  display: none;
}

.barn-facade {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: transparent;
}

.barn-door {
  position: relative;
  overflow: hidden;
  border-top: 18px solid #39271f;
  border-bottom: 18px solid #39271f;
  background:
    repeating-linear-gradient(90deg, transparent 0 13%, rgba(42, 25, 20, 0.5) 13% 15%),
    linear-gradient(180deg, #8c4e33, #633824);
  box-shadow: inset 0 0 0 8px #4c2e23, inset 0 0 45px rgba(27, 17, 14, 0.4);
  transition: transform 920ms cubic-bezier(0.65, 0, 0.35, 1);
}

.barn-door-left {
  border-right: 5px solid #2f211b;
  transform-origin: left center;
}

.barn-door-right {
  border-left: 5px solid #2f211b;
  transform-origin: right center;
}

.barn-door i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 128%;
  height: 22px;
  background: #402a21;
  box-shadow: 0 4px 10px rgba(20, 12, 10, 0.28);
}

.barn-door i:first-child {
  transform: translate(-50%, -50%) rotate(32deg);
}

.barn-door i:last-child {
  transform: translate(-50%, -50%) rotate(-32deg);
}

.entrance-title {
  position: absolute;
  z-index: 2;
  top: max(24px, env(safe-area-inset-top));
  left: 50%;
  text-align: center;
  text-shadow: 0 4px 14px rgba(22, 12, 9, 0.55);
  transform: translateX(-50%);
  transition: opacity 180ms ease;
}

.entrance-title small {
  color: #ffdc6c;
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 900;
}

.entrance-title h1 {
  margin: 3px 0 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 42px;
  line-height: 1;
}

.character-settings-button {
  position: absolute;
  z-index: 12;
  min-height: 38px;
  padding: 7px 13px;
  border: 2px solid rgba(255, 244, 189, 0.76);
  border-radius: 4px;
  color: #fff4bd;
  background: rgba(17, 57, 56, 0.84);
  box-shadow: 0 5px 12px rgba(5, 28, 27, 0.24);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.entrance-character-button {
  top: max(18px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
}

.lobby-character-button {
  top: max(18px, env(safe-area-inset-top));
  left: calc(50% + 116px);
}

.history-button {
  position: absolute;
  z-index: 12;
  top: max(18px, env(safe-area-inset-top));
  right: calc(50% + 116px);
  min-height: 38px;
  padding: 7px 13px;
  border: 2px solid rgba(255, 244, 189, 0.76);
  border-radius: 4px;
  color: #fff4bd;
  background: rgba(17, 57, 56, 0.84);
  box-shadow: 0 5px 12px rgba(5, 28, 27, 0.24);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.rule-board {
  position: relative;
  z-index: 2;
  width: min(500px, calc(100% - 36px));
  margin-bottom: 54px;
  padding: 18px 24px 20px;
  border: 5px solid #ddb75c;
  border-radius: 4px;
  color: #f7edce;
  background: #173e38;
  box-shadow: 0 12px 0 #39271f, 0 26px 60px rgba(16, 9, 7, 0.4);
  transition: opacity 170ms ease, transform 260ms ease;
}

.rule-board > small {
  color: #ffda62;
  font-size: 10px;
  font-weight: 900;
}

.rule-board h2 {
  margin: 3px 0 12px;
  font-size: 25px;
}

.rule-board ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rule-board li {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.rule-board li b {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 2px solid #ffdc6c;
  border-radius: 50%;
  color: #ffdc6c;
  font-family: Georgia, serif;
}

.enter-game-button {
  position: absolute;
  z-index: 3;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  min-width: 240px;
  min-height: 72px;
  grid-template-columns: 1fr 34px;
  grid-template-rows: auto auto;
  align-content: center;
  padding: 10px 16px 10px 20px;
  border: 3px solid #fff0a8;
  border-radius: 5px;
  color: #fffdf0;
  background: var(--coral);
  box-shadow: 0 7px 0 #a52f34, 0 15px 28px rgba(22, 12, 9, 0.36);
  cursor: pointer;
  text-align: left;
  transform: translateX(-50%);
  transition: opacity 160ms ease, transform 160ms ease;
}

.enter-game-button small {
  grid-column: 1;
  font-size: 9px;
  font-weight: 800;
}

.enter-game-button strong {
  grid-column: 1;
  font-size: 22px;
}

.enter-game-button span {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  font-size: 28px;
}

.entrance.opening .barn-door-left {
  transform: translateX(-101%);
}

.entrance.opening .barn-door-right {
  transform: translateX(101%);
}

.entrance.opening .entrance-title,
.entrance.opening .rule-board,
.entrance.opening .enter-game-button {
  opacity: 0;
  pointer-events: none;
}

.entrance.opening .rule-board {
  transform: scale(0.96);
}

.entrance.opening .enter-game-button {
  transform: translate(-50%, 8px);
}

.game[data-phase="entrance"] .developer-access,
.game[data-phase="opening"] .developer-access {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.lobby {
  position: absolute;
  z-index: 5;
  inset: 0;
  opacity: 1;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.lobby::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(10, 49, 43, 0.42) 0%, transparent 27%, transparent 68%, rgba(10, 49, 43, 0.32) 100%),
    linear-gradient(90deg, rgba(10, 49, 43, 0.22) 0%, transparent 34%);
  pointer-events: none;
}

.lobby.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.lobby-title {
  position: absolute;
  top: max(26px, env(safe-area-inset-top));
  left: max(34px, env(safe-area-inset-left));
  text-shadow: 0 3px 14px rgba(4, 35, 31, 0.38);
}

.lobby-title span {
  display: block;
  margin-bottom: 4px;
  color: #ffdc6c;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 900;
}

.lobby-title h1 {
  margin: 0;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 52px;
  line-height: 1;
}

.lobby-title p {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 900;
}

.home-button {
  position: absolute;
  z-index: 8;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 2px solid rgba(255, 244, 189, 0.72);
  border-radius: 4px;
  color: #fff4bd;
  background: rgba(17, 57, 56, 0.8);
  box-shadow: 0 5px 12px rgba(5, 28, 27, 0.2);
  cursor: pointer;
  transform: translateX(-50%);
}

.home-button strong {
  font-size: 11px;
}

.nickname-button {
  display: inline-grid;
  min-width: 104px;
  min-height: 38px;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 5px 9px;
  border: 2px solid rgba(255, 244, 189, 0.72);
  border-radius: 4px;
  color: #fff4bd;
  background: rgba(17, 57, 56, 0.76);
  box-shadow: 0 5px 12px rgba(5, 28, 27, 0.2);
  cursor: pointer;
}

.nickname-button small {
  color: #cce8d8;
  font-size: 9px;
  font-weight: 900;
}

.nickname-button strong {
  max-width: 96px;
  overflow: hidden;
  color: #ffdc6c;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-status {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  right: max(28px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
}

.developer-mode .lobby-status::before {
  display: grid;
  height: 34px;
  place-items: center;
  padding: 0 9px;
  border: 2px solid #ffe37a;
  border-radius: 4px;
  color: #173746;
  background: #ffe37a;
  content: "DEV \221E";
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 900;
}

.lobby-status > span {
  display: flex;
  min-width: 70px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 2px solid rgba(255, 248, 218, 0.58);
  border-radius: 4px;
  color: #fff7d2;
  background: rgba(13, 48, 51, 0.76);
  box-shadow: 0 8px 20px rgba(5, 25, 28, 0.24);
  backdrop-filter: blur(8px);
}

.lobby-status i {
  color: #ffda62;
  font-style: normal;
}

.lobby-status button {
  width: 42px;
  height: 42px;
  border: 2px solid #fff0a8;
  border-radius: 50%;
  color: #fff8df;
  background: var(--coral);
  box-shadow: 0 5px 0 #a52f34;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

.horse-select {
  position: absolute;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(24px, env(safe-area-inset-left));
}

.stall-hotspots {
  position: absolute;
  z-index: 7;
  inset: 0;
  pointer-events: none;
}

.stall-hotspots button {
  position: absolute;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.stall-door-hotspot {
  z-index: 1;
  width: 11%;
  height: 24%;
  pointer-events: auto;
}

.stall-name-hotspot {
  z-index: 2;
  width: 12%;
  height: 10%;
  pointer-events: auto;
}

.stall-hotspots button:hover,
.stall-hotspots button:focus-visible {
  border: 2px solid #ffe37a;
  outline: 0;
  background: rgba(255, 227, 122, 0.12);
}

.horse-select-heading {
  display: flex;
  width: min(650px, 66%);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.horse-select-heading p {
  margin: 0 0 8px;
  color: #fff4bd;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(10, 38, 33, 0.45);
}

.horse-select-heading p {
  margin: 0;
}

.horse-select-heading button {
  flex: none;
  min-height: 28px;
  padding: 4px 9px;
  border: 2px solid rgba(255, 244, 189, 0.66);
  border-radius: 4px;
  color: #fff4bd;
  background: rgba(17, 57, 56, 0.76);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
}

.horse-tabs {
  display: grid;
  width: min(650px, 66%);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stable-care {
  position: absolute;
  right: 0;
  bottom: 108px;
  left: auto;
  display: grid;
  width: 276px;
  grid-template-columns: 118px 150px;
  gap: 8px;
}

.select-race-horse-button {
  position: absolute;
  z-index: 9;
  bottom: max(32px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  min-width: 210px;
  min-height: 72px;
  grid-template-columns: 1fr 28px;
  grid-template-rows: auto auto;
  align-content: center;
  padding: 10px 15px 10px 18px;
  border: 3px solid #fff1ad;
  border-radius: 5px;
  color: #fffdf0;
  background: #2f8a68;
  box-shadow: 0 7px 0 #1b5945, 0 14px 24px rgba(20, 34, 28, 0.3);
  cursor: pointer;
  text-align: left;
  transform: translateX(-50%);
}

.select-race-horse-button small,
.select-race-horse-button strong {
  grid-column: 1;
}

.select-race-horse-button strong {
  font-size: 20px;
}

.select-race-horse-button span {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  font-size: 25px;
}

.select-race-horse-button[hidden] {
  display: none;
}

.cancel-race-selection-button {
  position: absolute;
  z-index: 10;
  top: max(126px, calc(env(safe-area-inset-top) + 112px));
  right: max(22px, env(safe-area-inset-right));
  min-height: 38px;
  padding: 7px 12px;
  border: 2px solid #fff0ad;
  border-radius: 4px;
  color: #fff8dc;
  background: #a44445;
  box-shadow: 0 5px 0 #6f2b2d;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.cancel-race-selection-button[hidden] {
  display: none;
}

.grooming-hud {
  position: absolute;
  z-index: 20;
  top: auto;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  display: grid;
  width: min(300px, calc(100% - 36px));
  grid-template-columns: 1fr auto;
  gap: 9px 12px;
  padding: 14px 46px 14px 16px;
  border: 3px solid #ffe37a;
  border-radius: 5px;
  color: #fff8dc;
  background: rgba(17, 57, 56, 0.9);
  box-shadow: 0 14px 35px rgba(5, 28, 27, 0.34);
  transform: none;
}

.grooming-hud[hidden] {
  display: none;
}

.grooming-copy {
  display: grid;
  grid-column: 1 / -1;
  gap: 3px;
}

.grooming-copy small {
  color: #cce8d8;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
}

.grooming-tool-card {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 240, 173, 0.5);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.grooming-tool-art,
.grooming-brush {
  width: 52px;
  height: 24px;
  border: 2px solid #56331f;
  border-radius: 12px 5px 5px 12px;
  background: linear-gradient(#a96e43, #75452b);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.18), 0 3px 5px rgba(0, 0, 0, 0.22);
}

.grooming-tool-art {
  position: relative;
  flex: none;
}

.grooming-tool-art::after,
.grooming-brush::after {
  position: absolute;
  right: 5px;
  bottom: -10px;
  left: 10px;
  height: 11px;
  content: "";
  background: repeating-linear-gradient(90deg, #e8c887 0 3px, #9a7444 3px 5px);
  clip-path: polygon(0 0, 100% 0, 94% 100%, 4% 100%);
}

.grooming-tool-art[data-tool="sponge"],
.grooming-brush[data-tool="sponge"] {
  border-color: #8b6c2b;
  border-radius: 7px;
  background: #f0c94f;
}

.grooming-tool-art[data-tool="shampoo"] {
  position: relative;
  width: 30px;
  height: 48px;
  border-color: #2e6170;
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(90deg, #58aec1, #a8e2e8 52%, #5db3c4);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.25), 0 3px 5px rgba(0, 0, 0, 0.22);
}

.grooming-tool-art[data-tool="shampoo"]::before {
  position: absolute;
  top: -10px;
  left: 7px;
  width: 12px;
  height: 9px;
  border: 2px solid #2e6170;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  content: "";
  background: #e7f1eb;
}

.grooming-tool-art[data-tool="shampoo"]::after {
  position: absolute;
  top: 17px;
  right: 4px;
  bottom: 7px;
  left: 4px;
  display: block;
  height: auto;
  content: "";
  border: 1px solid rgba(46, 97, 112, 0.75);
  border-radius: 5px;
  background: radial-gradient(circle at 65% 35%, #ffffff 0 3px, transparent 4px), #f8f3d7;
  clip-path: none;
}

.grooming-brush[data-tool="shampoo"] {
  width: 72px;
  height: 48px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 17% 64%, #ffffff 0 10px, #bcebf3 11px 13px, transparent 14px),
    radial-gradient(circle at 38% 42%, #ffffff 0 14px, #c9f1f5 15px 17px, transparent 18px),
    radial-gradient(circle at 62% 61%, #ffffff 0 13px, #bcebf3 14px 16px, transparent 17px),
    radial-gradient(circle at 84% 43%, #ffffff 0 9px, #d7f4f6 10px 12px, transparent 13px);
  box-shadow: none;
  filter: drop-shadow(0 4px 4px rgba(32, 91, 103, 0.28));
}

.grooming-brush[data-tool="shampoo"]::before,
.grooming-brush[data-tool="shampoo"]::after {
  position: absolute;
  display: block;
  content: "";
  border: 2px solid rgba(207, 244, 248, 0.95);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
}

.grooming-brush[data-tool="shampoo"]::before {
  top: -5px;
  left: 9px;
  width: 15px;
  height: 15px;
}

.grooming-brush[data-tool="shampoo"]::after {
  top: 0;
  right: 6px;
  bottom: auto;
  left: auto;
  width: 10px;
  height: 10px;
  clip-path: none;
}

.grooming-tool-art[data-tool="hoofpick"],
.grooming-brush[data-tool="hoofpick"] {
  width: 54px;
  height: 13px;
  border-color: #3f4547;
  border-radius: 8px;
  background: #788486;
}

.grooming-tool-art[data-tool="sponge"]::after,
.grooming-tool-art[data-tool="hoofpick"]::after,
.grooming-brush[data-tool="sponge"]::after,
.grooming-brush[data-tool="hoofpick"]::after {
  display: none;
}

.grooming-progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
}

.grooming-progress-track b {
  display: block;
  width: 0;
  height: 100%;
  background: #79d99f;
}

.grooming-hud button {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 30px;
  height: 30px;
  border: 2px solid #fff0ad;
  border-radius: 50%;
  color: #fff8dc;
  background: transparent;
  cursor: pointer;
}

.grooming-brush {
  position: absolute;
  z-index: 21;
  pointer-events: none;
  transform: translate(-16%, -72%) rotate(-12deg);
  transition: filter 120ms ease, transform 120ms ease;
}

.grooming-brush[hidden] {
  display: none;
}

.grooming-target {
  position: absolute;
  z-index: 19;
  width: clamp(132px, 18vw, 210px);
  aspect-ratio: 1.45;
  border: 3px dashed rgba(255, 227, 122, 0.78);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 7px rgba(255, 227, 122, 0.1), inset 0 0 26px rgba(255, 227, 122, 0.08);
  animation: grooming-target-pulse 1.2s ease-in-out infinite;
}

.grooming-target[hidden] {
  display: none;
}

body.grooming-contact .grooming-target {
  border-color: #83e1a5;
  box-shadow: 0 0 0 9px rgba(131, 225, 165, 0.18), inset 0 0 32px rgba(131, 225, 165, 0.18);
}

body.grooming-contact .grooming-brush {
  filter: drop-shadow(0 0 7px rgba(131, 225, 165, 0.95));
  transform: translate(-16%, -72%) rotate(-18deg) scale(1.08);
}

@keyframes grooming-target-pulse {
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.05); }
}

.game[data-phase="lobby"] .world canvas,
.game[data-phase="lobby"] .lobby {
  cursor: grab;
  touch-action: none;
}

body.stable-dragging .world canvas,
body.stable-dragging .lobby {
  cursor: grabbing;
}

body.grooming-active .world canvas {
  cursor: none;
}

body.grooming-active .game {
  touch-action: none;
  user-select: none;
}

body.grooming-active .stall-hotspots,
body.grooming-active .stall-hotspots *,
body.grooming-active .horse-select,
body.grooming-active .horse-select *,
body.grooming-active .select-race-horse-button,
body.grooming-active .cancel-race-selection-button,
body.grooming-active .start-button {
  pointer-events: none !important;
}

.stable-care > span,
.stable-care > button {
  min-height: 66px;
  border: 2px solid rgba(255, 248, 223, 0.62);
  border-radius: 5px;
  color: var(--paper);
  background: rgba(16, 57, 55, 0.82);
  box-shadow: 0 8px 18px rgba(10, 38, 33, 0.2);
  backdrop-filter: blur(8px);
}

.stable-care > span {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 3px 6px;
  padding: 8px 10px;
}

.stable-care span small {
  color: #cce8d8;
  font-size: 10px;
  font-weight: 900;
}

.stable-care span strong {
  color: #ffdf62;
  font-family: Georgia, serif;
  font-size: 19px;
}

.stable-care span i {
  grid-column: 1 / 3;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(5, 29, 29, 0.52);
}

.stable-care span i b {
  display: block;
  width: 60%;
  height: 100%;
  background: #75d39b;
  transition: width 180ms ease;
}

.stable-care > button {
  display: grid;
  align-content: center;
  padding: 7px 11px;
  cursor: pointer;
  text-align: left;
}

.stable-care > button strong {
  font-size: 15px;
}

.stable-care > button small {
  margin-top: 3px;
  color: #ffdf62;
  font-size: 10px;
  font-weight: 900;
}

.stable-care > button.needs-brush small {
  color: #ffaaa2;
}

.horse-tab {
  display: grid;
  min-width: 0;
  min-height: 66px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 2px solid rgba(255, 248, 223, 0.52);
  border-radius: 5px;
  color: var(--paper);
  background: rgba(16, 57, 55, 0.72);
  box-shadow: 0 8px 18px rgba(10, 38, 33, 0.2);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.horse-tab:hover,
.horse-tab.selected {
  border-color: #ffe582;
  background: rgba(28, 83, 67, 0.94);
  transform: translateY(-4px);
}

.horse-tab:focus-visible,
.start-button:focus-visible,
.race-actions button:focus-visible,
.result button:focus-visible {
  outline: 3px solid #fff7c9;
  outline-offset: 3px;
}

.horse-tab > span {
  display: grid;
  min-width: 0;
  text-align: left;
}

.horse-tab strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horse-tab small {
  margin-top: 2px;
  color: #cce8d8;
  font-size: 11px;
  font-weight: 800;
}

.horse-tab em {
  margin-top: 2px;
  overflow: hidden;
  color: #ffdf62;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horse-tab.locked {
  border-style: dashed;
  filter: saturate(0.55);
}

.horse-tab.locked::after {
  color: #ffdf62;
  content: "\9501";
  font-size: 13px;
  font-weight: 900;
}

.coat {
  display: block;
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  box-shadow: inset 9px -9px 14px rgba(5, 20, 23, 0.28), 0 4px 8px rgba(0, 0, 0, 0.2);
}

.coat-chestnut {
  background: #8f4527;
}

.coat-black {
  background: #15181d;
}

.coat-bay {
  background: #b9652f;
}

.coat-grey {
  background: #c9d0d1;
}

.start-button {
  position: absolute;
  right: max(34px, env(safe-area-inset-right));
  bottom: max(34px, env(safe-area-inset-bottom));
  display: grid;
  width: 245px;
  min-height: 92px;
  grid-template-columns: 1fr 40px;
  grid-template-rows: auto auto;
  align-content: center;
  padding: 15px 16px 15px 20px;
  border: 3px solid #fff1ad;
  border-radius: 6px;
  color: #fffdf0;
  background: var(--coral);
  box-shadow: 0 8px 0 #a52f34, 0 16px 30px rgba(27, 35, 31, 0.34);
  cursor: pointer;
  text-align: left;
}

.start-button:disabled {
  cursor: wait;
  filter: grayscale(0.7);
}

.start-button small {
  grid-column: 1;
  font-size: 11px;
  font-weight: 800;
}

.start-button strong {
  grid-column: 1;
  font-size: 26px;
}

.start-button span {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  font-family: Georgia, serif;
  font-size: 38px;
}

.start-button:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 #a52f34, 0 9px 18px rgba(27, 35, 31, 0.3);
}

.stable-message {
  position: absolute;
  top: 29%;
  left: 50%;
  padding: 8px 14px;
  border: 2px solid rgba(255, 245, 194, 0.72);
  border-radius: 4px;
  color: #fff7ce;
  background: rgba(17, 57, 56, 0.88);
  box-shadow: 0 8px 18px rgba(4, 28, 25, 0.25);
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.stable-message.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.race-ui {
  position: absolute;
  z-index: 8;
  inset: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.race-ui.active {
  visibility: visible;
  opacity: 1;
}

.quit-race-button {
  position: absolute;
  z-index: 15;
  top: max(96px, calc(env(safe-area-inset-top) + 86px));
  left: max(18px, env(safe-area-inset-left));
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  align-content: center;
  border: 3px solid rgba(255, 247, 210, 0.82);
  border-radius: 50%;
  color: #fff9db;
  background: rgba(91, 55, 50, 0.88);
  box-shadow: 0 6px 0 rgba(54, 36, 32, 0.9), 0 12px 22px rgba(7, 30, 28, 0.28);
  cursor: pointer;
  pointer-events: auto;
}

.quit-race-button span {
  font-family: Georgia, serif;
  font-size: 25px;
  line-height: 0.85;
}

.quit-race-button small {
  font-size: 9px;
  font-weight: 900;
}

.quit-race-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(54, 36, 32, 0.9), 0 7px 14px rgba(7, 30, 28, 0.25);
}

.race-hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  left: max(16px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: 108px minmax(270px, 560px) 92px;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  pointer-events: none;
}

.rank,
.race-clock,
.progress-panel {
  border: 2px solid rgba(255, 248, 218, 0.58);
  color: var(--paper);
  background: rgba(13, 48, 51, 0.76);
  box-shadow: 0 8px 20px rgba(5, 25, 28, 0.24);
  backdrop-filter: blur(8px);
}

.rank {
  display: grid;
  min-height: 74px;
  align-content: center;
  padding: 7px 12px;
  border-radius: 5px;
}

.rank small,
.race-clock small {
  color: #bce8d2;
  font-size: 10px;
  font-weight: 900;
}

.rank strong {
  font-family: Georgia, serif;
  font-size: 38px;
  line-height: 0.92;
}

.rank i {
  margin-left: 4px;
  color: #ffda62;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-style: normal;
}

.race-clock {
  display: grid;
  min-height: 61px;
  align-content: center;
  padding: 8px 12px;
  border-radius: 5px;
}

.race-clock strong {
  color: #ffdf6d;
  font-family: Georgia, serif;
  font-size: 24px;
}

.progress-panel {
  padding: 8px 12px 11px;
  border-radius: 5px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 900;
}

.progress-meta b {
  color: #ffdf6d;
}

.progress-track {
  position: relative;
  height: 10px;
  margin: 0 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  background: rgba(8, 30, 34, 0.55);
}

.progress-track::before {
  position: absolute;
  inset: 2px;
  content: "";
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 3%, transparent 3% 6%);
}

.finish-mark {
  position: absolute;
  top: -5px;
  right: -3px;
  width: 4px;
  height: 16px;
  background: #fff4c6;
}

.race-marker {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 2px solid #fff8de;
  border-radius: 50%;
  background: #477d8c;
  transform: translate(-50%, -50%);
  transition: left 100ms linear;
}

.race-marker.player {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--ink);
  background: #ffdf62;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}

.rival-a {
  background: #e44c4f;
}

.rival-b {
  background: #3c7ed8;
}

.rival-c {
  background: #e0aa32;
}

.rival-d {
  background: #8b5ac4;
}

.rival-e {
  background: #3ca873;
}

.countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  color: #fff8df;
  font-family: Georgia, serif;
  font-size: 104px;
  font-weight: 900;
  text-shadow: 0 8px 0 rgba(21, 67, 60, 0.66), 0 14px 34px rgba(4, 28, 25, 0.42);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.72);
  pointer-events: none;
}

.countdown.pop {
  animation: countdown-pop 700ms ease-out both;
}

.countdown.go {
  color: #ffdf62;
  font-size: 86px;
}

@keyframes countdown-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
  }

  22% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.92);
  }

  72% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
}

.race-message {
  position: absolute;
  top: 31%;
  left: 50%;
  padding: 8px 14px;
  border: 2px solid rgba(255, 245, 194, 0.68);
  border-radius: 4px;
  color: #fff7ce;
  background: rgba(17, 57, 56, 0.82);
  box-shadow: 0 8px 18px rgba(4, 28, 25, 0.25);
  font-size: 14px;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.race-message.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.steer-zone {
  position: absolute;
  z-index: 2;
  top: 24%;
  right: 30%;
  bottom: 0;
  left: 0;
  touch-action: none;
  pointer-events: auto;
}

.steer-cursor {
  position: absolute;
  bottom: 44px;
  left: 50%;
  width: 46px;
  height: 46px;
  border: 3px solid rgba(255, 248, 214, 0.86);
  border-radius: 50%;
  background: rgba(31, 91, 76, 0.34);
  opacity: 0;
  transform: translateX(-50%) scale(0.75);
  transition: opacity 100ms ease, transform 100ms ease;
  pointer-events: none;
}

.steer-cursor.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.race-actions {
  position: absolute;
  z-index: 4;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 62px auto 110px;
  align-items: end;
  gap: 10px;
  pointer-events: none;
}

.race-actions button {
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 247, 210, 0.84);
  color: #fff9db;
  background: rgba(25, 85, 71, 0.9);
  box-shadow: 0 7px 0 rgba(10, 48, 43, 0.9), 0 13px 22px rgba(7, 30, 28, 0.28);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

.view-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

.view-button span {
  font-size: 23px;
  line-height: 1;
}

.view-button small,
.item-button small {
  font-size: 9px;
  font-weight: 900;
}

.view-button.active {
  color: var(--ink);
  background: #ffdf62;
  transform: translateY(5px);
}

.item-button {
  width: 70px;
  height: 70px;
  align-content: center;
  border-radius: 5px;
  transition: width 180ms ease, transform 140ms ease;
}

.item-button[data-count="2"] {
  width: 108px;
}

.item-button[data-count="3"] {
  width: 146px;
}

.item-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.item-slots i {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 2px solid rgba(255, 248, 218, 0.72);
  border-radius: 50%;
  color: #ffdf62;
  background: rgba(8, 47, 43, 0.56);
  font-size: 27px;
  font-style: normal;
  line-height: 1;
}

.item-button:disabled {
  filter: grayscale(1);
  opacity: 0.6;
}

.sprint-button {
  position: relative;
  width: 106px;
  height: 106px;
  align-content: center;
  border-radius: 50%;
  background: var(--coral) !important;
  box-shadow: 0 9px 0 #a52f34, 0 16px 26px rgba(42, 25, 22, 0.34) !important;
  overflow: hidden;
}

.sprint-button span {
  font-size: 21px;
  font-weight: 900;
}

.sprint-button i {
  position: absolute;
  right: 15px;
  bottom: 17px;
  left: 15px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(77, 24, 24, 0.42);
}

.sprint-button i b {
  display: block;
  width: 100%;
  height: 100%;
  background: #ffe16b;
  transition: width 90ms linear;
}

.sprint-button.active {
  transform: translateY(6px) scale(0.98);
  box-shadow: 0 3px 0 #a52f34, 0 9px 16px rgba(42, 25, 22, 0.3) !important;
}

.game.final-stretch::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  content: "";
  background: repeating-linear-gradient(100deg, transparent 0 48px, rgba(255, 255, 255, 0.15) 49px 51px, transparent 52px 90px);
  animation: speed-lines 320ms linear infinite;
  pointer-events: none;
}

@keyframes speed-lines {
  from {
    transform: translateX(-8%);
  }

  to {
    transform: translateX(8%);
  }
}

.finish-flash {
  position: absolute;
  z-index: 20;
  inset: 0;
  background: #fff9dc;
  opacity: 0;
  pointer-events: none;
}

.finish-flash.show {
  animation: finish-flash 720ms ease-out both;
}

@keyframes finish-flash {
  0% {
    opacity: 0;
  }

  12% {
    opacity: 0.94;
  }

  100% {
    opacity: 0;
  }
}

.result {
  position: absolute;
  z-index: 30;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(360px, calc(100% - 36px));
  justify-items: center;
  padding: 24px 28px 28px;
  border: 5px solid #fff0ad;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 24px 80px rgba(7, 33, 30, 0.48);
  visibility: hidden;
  opacity: 0;
  transform: translate(-50%, -44%) scale(0.92);
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
}

.result.show {
  visibility: visible;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.result p {
  margin: 0 0 4px;
  color: #2d8060;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 900;
}

.result strong {
  color: var(--coral);
  font-size: 48px;
}

.result > span {
  margin-top: 3px;
  color: #416170;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 900;
}

.result > small {
  margin-top: 7px;
  color: #416170;
  font-size: 12px;
  font-weight: 900;
}

.result-record {
  width: 100%;
  margin-top: 11px;
  padding: 9px 10px;
  border: 2px solid #e0ad41;
  border-radius: 4px;
  color: #7a461d;
  background: #ffe9a8;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.result-record[hidden] {
  display: none;
}

.result-actions {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr 1.35fr;
  gap: 8px;
  margin-top: 20px;
}

.result button {
  min-width: 0;
  padding: 12px 20px;
  border: 0;
  border-radius: 4px;
  color: #fff9df;
  background: var(--forest);
  box-shadow: 0 6px 0 #174636;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
}

.result-feed-button,
#resultFeedButton {
  color: var(--ink) !important;
  background: #ffdf62 !important;
  box-shadow: 0 6px 0 #bb8f25 !important;
}

.food-shop {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100dvh - 20px);
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 5px solid #fff0ad;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.food-shop::backdrop {
  background: rgba(8, 35, 32, 0.68);
  backdrop-filter: blur(4px);
}

.food-shop header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  color: #fff8dd;
  background: var(--forest);
}

.food-shop header small {
  color: #ffdf6b;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.food-shop h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.food-shop header button {
  width: 38px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  color: #fff8dd;
  background: transparent;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 25px;
}

.shop-balance {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin: 0;
  padding: 12px 20px;
  color: #365766;
  background: #e8f0da;
  font-size: 12px;
  font-weight: 900;
}

.shop-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 10px 20px 0;
}

.shop-tabs button {
  min-height: 36px;
  border: 2px solid #bed0b8;
  border-radius: 4px;
  color: #456557;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.shop-tabs button.selected {
  border-color: var(--forest);
  color: #fff8dd;
  background: var(--forest);
}

.shop-page[hidden] {
  display: none;
}

.food-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 20px 8px;
}

.food-options button {
  display: grid;
  min-width: 0;
  min-height: 88px;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 2px solid #bed0b8;
  border-radius: 5px;
  color: var(--ink);
  background: #f2f4de;
  cursor: pointer;
  text-align: left;
}

.food-options button:hover {
  border-color: #e1b63a;
  background: #fff2bd;
}

.food-options button.owned {
  border-color: #62a77a;
  background: #e4f1dc;
}

.coat-pinto {
  background: radial-gradient(circle at 28% 32%, #f3eee2 0 22%, transparent 23%), radial-gradient(circle at 72% 68%, #f3eee2 0 18%, transparent 19%), #7a432c;
}

.coat-dapple {
  background: radial-gradient(circle at 30% 35%, #dce1df 0 9%, transparent 10%), radial-gradient(circle at 68% 38%, #dce1df 0 8%, transparent 9%), radial-gradient(circle at 54% 72%, #dce1df 0 10%, transparent 11%), #858b8c;
}

.coat-palomino {
  background: linear-gradient(120deg, #f1dfae 0 25%, #c9954d 26% 100%);
}

.coat-roan {
  background: repeating-linear-gradient(45deg, #8c514a 0 5px, #bda9a0 5px 7px);
}

.coin-recharge-panel {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) repeat(3, auto);
  align-items: center;
  gap: 7px;
  margin: 9px 20px 12px;
  padding: 10px;
  border: 2px solid #d4b355;
  border-radius: 5px;
  color: #365766;
  background: #fff0bd;
}

.coin-recharge-panel div {
  display: grid;
}

.coin-recharge-panel small {
  font-size: 9px;
  font-weight: 800;
}

.coin-recharge-panel button {
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  color: #fff8dd;
  background: var(--coral);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
}

.food-options button.equipped {
  border-color: #e1b63a;
  background: #fff0af;
}

.food-options i {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff8df;
  background: var(--coral);
  font-style: normal;
  font-weight: 900;
}

.race-item-options .race-item-art {
  position: relative;
  border: 0;
  color: transparent;
  background: transparent;
}

.race-item-art.stopwatch {
  width: 38px;
  height: 38px;
  border: 4px solid #245c68;
  background:
    linear-gradient(32deg, transparent 47%, #e9504e 48% 53%, transparent 54%),
    linear-gradient(90deg, transparent 47%, #173746 48% 53%, transparent 54%),
    #fff8df;
  box-shadow: inset 0 0 0 3px #9ccbd0;
}

.race-item-art.stopwatch::before {
  position: absolute;
  top: -9px;
  left: 11px;
  width: 10px;
  height: 7px;
  border: 3px solid #245c68;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  content: "";
}

.race-item-art.mud-puddle {
  width: 42px;
  height: 27px;
  border-radius: 50% 45% 48% 42%;
  background:
    radial-gradient(circle at 26% 30%, #c39a63 0 8%, transparent 9%),
    radial-gradient(circle at 68% 60%, #6d4a31 0 12%, transparent 13%),
    #8b6240;
  box-shadow: 8px 3px 0 -3px #6d4a31, -7px 4px 0 -4px #a5774a;
}

.race-item-art.shield-art {
  width: 38px;
  height: 42px;
  border-radius: 4px 4px 16px 16px;
  background: #4ca8bd;
  box-shadow: inset 0 0 0 5px #d8f2ec, inset 0 -10px 0 rgba(24, 69, 78, 0.22);
  clip-path: polygon(50% 0, 96% 14%, 88% 66%, 50% 100%, 12% 66%, 4% 14%);
}

.race-item-art.crate-art {
  width: 40px;
  height: 36px;
  border: 4px solid #68452e;
  border-radius: 3px;
  background:
    linear-gradient(35deg, transparent 43%, #68452e 44% 54%, transparent 55%),
    linear-gradient(-35deg, transparent 43%, #68452e 44% 54%, transparent 55%),
    #bd8651;
}

.race-item-art.mixed-art {
  width: 42px;
  height: 42px;
  border: 4px solid #fff3c7;
  background: conic-gradient(#e9504e 0 33%, #4ca8bd 33% 66%, #8b6240 66%);
  box-shadow: 0 0 0 2px #49695e;
}

.food-options span {
  display: grid;
  min-width: 0;
}

.food-options strong {
  font-size: 15px;
}

.food-options small {
  margin-top: 3px;
  color: #52705c;
  font-size: 10px;
  font-weight: 900;
}

.shop-message {
  min-height: 35px;
  margin: 0;
  padding: 8px 20px 16px;
  color: #546d64;
  font-size: 11px;
  font-weight: 900;
}

.recharge-panel {
  margin: 7px 20px 0;
  padding: 10px;
  border: 2px solid #e1b63a;
  border-radius: 5px;
  background: #fff0bd;
}

.recharge-panel[hidden] {
  display: none;
}

.recharge-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: #684c1d;
}

.recharge-heading strong {
  font-size: 13px;
}

.recharge-heading small {
  font-size: 9px;
  font-weight: 900;
}

.recharge-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 8px;
}

.recharge-options button {
  display: grid;
  min-height: 45px;
  align-content: center;
  border: 2px solid #d69a2f;
  border-radius: 4px;
  color: #5b421c;
  background: #fff9df;
  cursor: pointer;
}

.recharge-options strong {
  font-size: 12px;
}

.recharge-options small {
  color: #b34b38;
  font-size: 10px;
  font-weight: 900;
}

.recharge-confirm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(114, 77, 22, 0.25);
}

.recharge-confirm[hidden] {
  display: none;
}

.recharge-confirm span {
  min-width: 0;
  color: #60451c;
  font-size: 10px;
  font-weight: 900;
}

.recharge-confirm button {
  min-height: 30px;
  padding: 4px 9px;
  border: 0;
  border-radius: 3px;
  color: #fff8dd;
  background: #7d7564;
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
}

#confirmRechargeButton {
  background: var(--coral);
}

.developer-dialog {
  width: min(390px, calc(100% - 28px));
  padding: 24px;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.developer-dialog::backdrop {
  background: rgba(8, 35, 32, 0.72);
  backdrop-filter: blur(4px);
}

.developer-dialog > small {
  color: #b78022;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.developer-dialog h2 {
  margin: 3px 0 8px;
  font-size: 27px;
}

.developer-dialog p {
  margin: 0 0 15px;
  color: #547063;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.developer-dialog label {
  display: block;
  margin-bottom: 5px;
  color: #426252;
  font-size: 11px;
  font-weight: 900;
}

.developer-dialog input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 2px solid #a8bea9;
  border-radius: 4px;
  color: var(--ink);
  background: #fffef3;
  font-family: Georgia, serif;
  font-size: 24px;
}

.developer-dialog input:focus {
  border-color: var(--forest);
  outline: 2px solid rgba(36, 102, 74, 0.2);
}

.developer-error {
  display: block;
  min-height: 20px;
  padding-top: 5px;
  color: #c4423f;
  font-size: 11px;
  font-weight: 900;
}

.developer-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.developer-dialog-actions button {
  min-height: 40px;
  border: 0;
  border-radius: 4px;
  color: #fff8dd;
  background: #7b7464;
  cursor: pointer;
  font-weight: 900;
}

#confirmDeveloperButton {
  grid-column: 2;
  background: var(--forest);
}

.developer-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 2px solid #95aa98;
  border-radius: 50%;
  color: #55705e;
  background: transparent;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 22px;
}

.exit-dialog {
  width: min(390px, calc(100% - 28px));
  padding: 24px;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.exit-dialog::backdrop {
  background: rgba(8, 35, 32, 0.74);
  backdrop-filter: blur(4px);
}

.exit-dialog > small {
  color: #b78022;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.exit-dialog h2 {
  margin: 3px 0 8px;
  color: #9e3437;
  font-size: 27px;
}

.exit-dialog p {
  margin: 0 0 14px;
  color: #547063;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.6;
}

.exit-dialog > strong {
  display: block;
  padding: 10px 12px;
  border-left: 4px solid var(--coral);
  color: #793c37;
  background: #f5e6c9;
  font-size: 13px;
}

.exit-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.exit-dialog-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  color: #fff8dd;
  background: var(--forest);
  cursor: pointer;
  font-weight: 900;
}

.nickname-dialog {
  width: min(390px, calc(100% - 28px));
  padding: 24px;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.nickname-dialog::backdrop {
  background: rgba(8, 35, 32, 0.72);
  backdrop-filter: blur(4px);
}

.nickname-dialog > small {
  color: #b78022;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.nickname-dialog h2 {
  margin: 3px 0 7px;
  font-size: 25px;
}

.nickname-dialog p {
  margin: 0 0 14px;
  color: #547063;
  font-size: 12px;
  font-weight: 800;
}

.nickname-dialog label {
  display: block;
  margin-bottom: 5px;
  color: #426252;
  font-size: 11px;
  font-weight: 900;
}

.nickname-dialog input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 2px solid #a8bea9;
  border-radius: 4px;
  color: var(--ink);
  background: #fffef3;
  font-size: 18px;
  font-weight: 900;
}

.nickname-dialog input + label {
  margin-top: 10px;
}

.nickname-error {
  display: block;
  min-height: 20px;
  padding-top: 5px;
  color: #c4423f;
  font-size: 11px;
  font-weight: 900;
}

.save-nickname-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  color: #fff8dd;
  background: var(--forest);
  cursor: pointer;
  font-weight: 900;
}

.nickname-dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 2px solid #95aa98;
  border-radius: 50%;
  color: #55705e;
  background: transparent;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 22px;
}

#confirmExitButton {
  background: var(--coral);
}

.purchase-horse-dialog {
  width: min(380px, calc(100% - 28px));
  padding: 24px;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.purchase-horse-dialog::backdrop {
  background: rgba(8, 35, 32, 0.72);
  backdrop-filter: blur(4px);
}

.purchase-horse-dialog > small {
  color: #b78022;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.purchase-horse-dialog h2 {
  margin: 3px 0 8px;
  font-size: 25px;
}

.purchase-horse-dialog p {
  color: #547063;
  font-size: 12px;
  font-weight: 800;
}

.purchase-horse-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.purchase-horse-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  color: #fff8dd;
  background: #7b7464;
  cursor: pointer;
  font-weight: 900;
}

#confirmHorsePurchaseButton {
  background: var(--forest);
}

.equipment-dialog {
  width: min(720px, calc(100% - 28px));
  max-height: min(90vh, 650px);
  padding: 0;
  overflow: auto;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.equipment-dialog::backdrop {
  background: rgba(8, 35, 32, 0.74);
  backdrop-filter: blur(4px);
}

.equipment-dialog > header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px 12px;
  color: #fff8dc;
  background: #173e38;
}

.equipment-dialog > header small {
  color: #ffda62;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.equipment-dialog > header h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.equipment-dialog > header button {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 244, 189, 0.72);
  border-radius: 50%;
  color: #fff4bd;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
}

.equipment-dialog > p:not(.equipment-message) {
  margin: 14px 18px 10px;
  color: #547063;
  font-size: 12px;
  font-weight: 800;
}

.equipment-levels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 0 18px 12px;
}

.equipment-levels button {
  min-height: 34px;
  border: 2px solid #9bb4a2;
  border-radius: 4px;
  color: #426252;
  background: #fffef3;
  cursor: pointer;
  font-weight: 900;
}

.equipment-levels button.selected {
  border-color: #1f6a50;
  color: #fff8dc;
  background: #2f8a68;
}

.equipment-kind {
  padding: 0 18px 13px;
}

.equipment-kind h3 {
  margin: 0 0 7px;
  color: #355b4a;
  font-size: 13px;
}

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.equipment-grid button {
  display: grid;
  min-height: 72px;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 2px solid #a9bba9;
  border-radius: 4px;
  color: #355b4a;
  background: #fffef3;
  cursor: pointer;
  text-align: left;
}

.equipment-grid button.selected {
  border-color: #d2a52f;
  outline: 2px solid #ffe37a;
  background: #fff7cf;
}

.equipment-grid button.unowned {
  border-style: dashed;
  color: #725c47;
  background: #f3ead7;
}

.equipment-grid button.borrowed {
  border-style: dashed;
  border-color: #d2a933;
  color: #315b4a;
  background: #fff3bd;
}

.equipment-grid i {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #fff7d8;
  background: #77503a;
  font-style: normal;
  font-weight: 900;
}

.equipment-grid span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.equipment-grid strong {
  font-size: 12px;
}

.equipment-grid small {
  color: #88704e;
  font-size: 9px;
  font-weight: 900;
}

.equipment-empty {
  grid-column: 1 / -1;
  padding: 14px;
  color: #75877a;
  background: #eee8d7;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.equipment-message {
  min-height: 22px;
  margin: 0 18px 8px;
  color: #b74440;
  font-size: 11px;
  font-weight: 900;
}

.equipment-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(83, 111, 96, 0.22);
  background: #fff9e8;
}

.equipment-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 4px;
  color: #fff8dc;
  background: #746d5f;
  cursor: pointer;
  font-weight: 900;
}

#confirmRaceEquipmentButton {
  background: #2f8a68;
}

#confirmRaceEquipmentButton:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.groom-tool-dialog {
  width: min(560px, calc(100% - 28px));
  padding: 0;
  overflow: hidden;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.groom-tool-dialog::backdrop {
  background: rgba(8, 35, 32, 0.74);
  backdrop-filter: blur(4px);
}

.groom-tool-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px 12px;
  color: #fff8dc;
  background: #173e38;
}

.groom-tool-dialog > header small {
  color: #ffda62;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.groom-tool-dialog > header h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.groom-tool-dialog > header button {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 244, 189, 0.72);
  border-radius: 50%;
  color: #fff4bd;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
}

.groom-tool-dialog > p:not(.groom-tool-message) {
  margin: 13px 18px 9px;
  color: #547063;
  font-size: 12px;
  font-weight: 800;
}

.groom-tool-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px 10px;
}

.groom-tool-options button {
  display: grid;
  min-height: 62px;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 2px solid #a9bba9;
  border-radius: 4px;
  color: #355b4a;
  background: #fffef3;
  cursor: pointer;
  text-align: left;
}

.groom-tool-options i {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: #fff8dc;
  background: #2f8a68;
  font-style: normal;
  font-weight: 900;
}

.groom-tool-options button[data-groom-tool="shampoo"] > i,
.food-options button[data-shop-item="shampoo"] > i {
  position: relative;
  width: 26px;
  height: 36px;
  justify-self: center;
  overflow: visible;
  border: 2px solid #2e6170;
  border-radius: 5px 5px 8px 8px;
  color: transparent;
  background: linear-gradient(90deg, #58aec1, #a8e2e8 52%, #5db3c4);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.28), 0 3px 5px rgba(27, 72, 79, 0.25);
  font-size: 0;
}

.groom-tool-options button[data-groom-tool="shampoo"] > i::before,
.food-options button[data-shop-item="shampoo"] > i::before {
  position: absolute;
  top: -9px;
  left: 6px;
  width: 10px;
  height: 8px;
  border: 2px solid #2e6170;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  content: "";
  background: #eff7f2;
}

.groom-tool-options button[data-groom-tool="shampoo"] > i::after,
.food-options button[data-shop-item="shampoo"] > i::after {
  position: absolute;
  top: 13px;
  right: 4px;
  bottom: 5px;
  left: 4px;
  content: "";
  border: 1px solid rgba(46, 97, 112, 0.7);
  border-radius: 4px;
  background: radial-gradient(circle at 66% 34%, #ffffff 0 2px, transparent 3px), #fff4cb;
}

.groom-tool-options span {
  display: grid;
  gap: 2px;
}

.groom-tool-options strong {
  font-size: 12px;
}

.groom-tool-options small {
  color: #708477;
  font-size: 9px;
  font-weight: 900;
}

.groom-tool-message {
  min-height: 20px;
  margin: 0 18px 8px;
  color: #b74440;
  font-size: 11px;
  font-weight: 900;
}

.groom-tool-shop {
  width: calc(100% - 36px);
  min-height: 40px;
  margin: 0 18px 16px;
  border: 0;
  border-radius: 4px;
  color: #fff8dc;
  background: #746d5f;
  cursor: pointer;
  font-weight: 900;
}

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

  .equipment-levels {
    grid-template-columns: repeat(2, 1fr);
  }

  .groom-tool-options {
    grid-template-columns: 1fr;
  }
}

.character-dialog {
  width: min(430px, calc(100% - 28px));
  padding: 24px;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.character-dialog::backdrop {
  background: rgba(8, 35, 32, 0.72);
  backdrop-filter: blur(4px);
}

.character-dialog > small {
  color: #b78022;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.character-dialog h2 {
  margin: 3px 0 16px;
  font-size: 25px;
}

.character-dialog label {
  display: block;
  margin: 12px 0 6px;
  color: #426252;
  font-size: 11px;
  font-weight: 900;
}

.character-segments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.character-segments button {
  min-height: 44px;
  border: 2px solid #a8bea9;
  border-radius: 4px;
  color: #426252;
  background: #fffef3;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
}

.character-segments button.selected {
  border-color: #1f6a50;
  color: #fff8dd;
  background: #2f8a68;
}

.outfit-swatches {
  display: grid;
  grid-template-columns: repeat(8, minmax(32px, 1fr));
  gap: 7px;
  margin-bottom: 18px;
}

.outfit-swatches button {
  aspect-ratio: 1;
  min-width: 0;
  border: 3px solid #fff9e8;
  border-radius: 50%;
  outline: 2px solid #a8bea9;
  cursor: pointer;
  box-shadow: inset 0 -7px 12px rgba(18, 42, 36, 0.18);
}

.outfit-swatches button.selected {
  outline: 4px solid #173746;
  outline-offset: 2px;
}

.outfit-swatches [data-outfit="red"] { background: #e84f5f; }
.outfit-swatches [data-outfit="green"] { background: #42a47a; }
.outfit-swatches [data-outfit="blue"] { background: #2a74dc; }
.outfit-swatches [data-outfit="yellow"] { background: #f0b93b; }
.outfit-swatches [data-outfit="purple"] { background: #8056b2; }
.outfit-swatches [data-outfit="black"] { background: #27313a; }
.outfit-swatches [data-outfit="white"] { background: #e9e5d8; }
.outfit-swatches [data-outfit="pink"] { background: #e58aad; }

.history-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(88vh, 660px);
  padding: 0;
  overflow: hidden;
  border: 5px solid #ffe37a;
  border-radius: 6px;
  color: var(--ink);
  background: #fff9e8;
  box-shadow: 0 26px 90px rgba(5, 30, 28, 0.52);
}

.history-dialog::backdrop {
  background: rgba(8, 35, 32, 0.72);
  backdrop-filter: blur(4px);
}

.history-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  color: #fff7d5;
  background: #173e38;
}

.history-dialog > header small {
  color: #ffda62;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: 900;
}

.history-dialog > header h2 {
  margin: 2px 0 0;
  font-size: 24px;
}

.history-dialog > header button {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 244, 189, 0.72);
  border-radius: 50%;
  color: #fff4bd;
  background: transparent;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 22px;
}

.history-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 128px;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-bottom: 2px solid #e4d6af;
  color: #426252;
  background: #f3e8c9;
  font-size: 11px;
  font-weight: 900;
}

.history-toolbar select {
  height: 34px;
  padding: 0 8px;
  border: 2px solid #9bb39d;
  border-radius: 4px;
  color: #234b40;
  background: #fffef3;
  font-weight: 900;
}

.history-list {
  display: grid;
  max-height: min(62vh, 500px);
  gap: 9px;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.history-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 20px;
  color: #587264;
  font-weight: 900;
  text-align: center;
}

.history-list article {
  padding: 12px;
  border: 2px solid #d8c99f;
  border-left: 5px solid #2f8a68;
  border-radius: 5px;
  background: #fffef3;
}

.history-list article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-list article > header div {
  display: grid;
  gap: 2px;
}

.history-list article > header small {
  color: #718679;
  font-size: 9px;
  font-weight: 800;
}

.history-list article > header strong {
  font-size: 17px;
}

.history-list article > header b {
  color: #b04443;
  font-size: 20px;
}

.history-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.history-metrics span {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 7px 8px;
  border-left: 3px solid #e0ad41;
  background: #f5ecd2;
}

.history-metrics small {
  color: #718679;
  font-size: 9px;
  font-weight: 900;
}

.history-metrics strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list details {
  margin-top: 8px;
  color: #426252;
  font-size: 11px;
  font-weight: 900;
}

.history-list summary {
  cursor: pointer;
}

.history-list ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  overflow: hidden;
  padding: 5px 7px;
  background: #edf0df;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list li.player {
  color: #7b3b35;
  background: #ffe9ad;
}

@media (max-height: 560px) {
  .entrance-title {
    top: max(8px, env(safe-area-inset-top));
  }

  .entrance-title h1 {
    font-size: 30px;
  }

  .rule-board {
    position: absolute;
    top: max(66px, calc(env(safe-area-inset-top) + 58px));
    margin: 0;
    padding: 10px 20px 12px;
  }

  .rule-board h2 {
    margin-bottom: 7px;
    font-size: 21px;
  }

  .rule-board ol {
    gap: 4px;
  }

  .enter-game-button {
    bottom: max(17px, env(safe-area-inset-bottom));
    min-height: 64px;
  }

  .lobby-title {
    top: max(16px, env(safe-area-inset-top));
  }

  .lobby-title h1 {
    font-size: 42px;
  }

  .lobby-status {
    top: max(12px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
  }

  .food-shop {
    max-height: calc(100% - 16px);
    overflow-y: auto;
  }

  .developer-access {
    top: max(62px, calc(env(safe-area-inset-top) + 52px));
  }

  .recharge-panel {
    margin: 4px 16px 0;
    padding: 7px;
  }

  .recharge-heading small {
    display: none;
  }

  .food-shop header {
    padding: 10px 16px;
  }

  .food-shop h2 {
    font-size: 20px;
  }

  .shop-balance {
    padding: 8px 16px;
  }

  .food-options {
    padding: 10px 16px 5px;
  }

  .shop-tabs {
    padding: 7px 16px 0;
  }

  .food-options button {
    min-height: 72px;
  }

  .stable-care {
    right: 0;
    bottom: 112px;
    left: auto;
    width: 218px;
    grid-template-columns: 84px 126px;
  }

  .stable-care > span,
  .stable-care > button {
    min-height: 58px;
  }

  .horse-select {
    bottom: max(14px, env(safe-area-inset-bottom));
  }

  .horse-select-heading,
  .horse-tabs {
    width: calc(100% - 270px);
  }

  .start-button {
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    width: 218px;
    min-height: 80px;
  }

  .start-button strong {
    font-size: 22px;
  }

  .race-hud {
    top: max(7px, env(safe-area-inset-top));
  }

  .quit-race-button {
    top: max(76px, calc(env(safe-area-inset-top) + 68px));
    width: 50px;
    height: 50px;
  }

  .race-actions {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(11px, env(safe-area-inset-bottom));
    grid-template-columns: 54px 62px 92px;
    gap: 8px;
  }

  .view-button {
    width: 52px;
    height: 52px;
  }

  .item-button {
    width: 60px;
    height: 60px;
  }

  .sprint-button {
    width: 88px;
    height: 88px;
  }
}

@media (orientation: portrait) and (max-width: 700px) {
  .home-button {
    top: max(10px, env(safe-area-inset-top));
    min-height: 34px;
    padding: 5px 10px;
  }

  .history-button,
  .lobby-character-button {
    top: max(10px, env(safe-area-inset-top));
    width: 82px;
    min-height: 34px;
    padding: 5px 7px;
    font-size: 10px;
  }

  .history-button {
    right: auto;
    left: 8px;
  }

  .lobby-character-button {
    right: 8px;
    left: auto;
  }

  .grooming-hud {
    top: auto;
    bottom: 108px;
    left: 12px;
    width: min(270px, calc(100% - 24px));
    transform: none;
  }

  .lobby-title {
    top: 104px;
    left: 12px;
  }

  .lobby-title h1 {
    font-size: 32px;
  }

  .lobby-status {
    top: 56px;
    right: 8px;
    gap: 4px;
  }

  .lobby-status > span {
    min-width: 48px;
    height: 34px;
    gap: 4px;
    padding: 0 5px;
    font-size: 10px;
  }

  .lobby-status button {
    width: 34px;
    height: 34px;
  }

  .developer-mode .lobby-status::before {
    height: 30px;
    padding: 0 6px;
  }

  .developer-access {
    top: 105px;
    right: 8px;
    max-width: 128px;
    min-height: 30px;
    padding: 5px 7px;
    font-size: 9px;
  }

  .food-options {
    grid-template-columns: 1fr;
  }

  .horse-select {
    right: 14px;
    bottom: 122px;
    left: 14px;
  }

  .horse-tabs {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stable-care {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    width: 100%;
    margin-top: 7px;
    grid-template-columns: 1fr 1fr;
  }

  .start-button {
    right: 14px;
    bottom: 18px;
    left: 14px;
    width: auto;
    min-height: 82px;
  }

  .race-hud {
    right: 8px;
    left: 8px;
    grid-template-columns: 82px minmax(150px, 1fr) 70px;
    gap: 6px;
  }

  .rank {
    min-height: 62px;
    padding: 6px 8px;
  }

  .rank strong {
    font-size: 31px;
  }

  .race-clock {
    padding: 6px 7px;
  }

  .race-clock strong {
    font-size: 18px;
  }

  .progress-panel {
    padding: 7px 7px 10px;
  }

  .quit-race-button {
    top: 82px;
    left: 10px;
    width: 48px;
    height: 48px;
  }

  .steer-zone {
    right: 38%;
  }

  .race-actions {
    grid-template-columns: 52px 58px 88px;
    gap: 6px;
  }

  .view-button {
    width: 50px;
    height: 50px;
  }

  .item-button {
    width: 56px;
    height: 56px;
  }

  .sprint-button {
    width: 86px;
    height: 86px;
  }
}
