* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0d3b66;
  color: #fff;
  font-family: "Press Start 2P", system-ui, monospace;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none; /* без зума и прокрутки жестами */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 20, 40, 0.55);
  z-index: 10;
}
.hidden { display: none !important; }

.panel {
  touch-action: pan-y; /* длинное меню на маленьком экране можно прокрутить */
  width: 100%;
  max-width: 380px;
  max-height: 100%;
  overflow-y: auto;
  padding: 24px 20px;
  background: #3b2614;
  border: 4px solid #1e1207;
  box-shadow: inset 0 0 0 4px #7a5230, 0 8px 0 rgba(0, 0, 0, 0.4);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

h1 {
  font-size: 30px;
  line-height: 1.25;
  color: #ffe14d;
  text-shadow: 4px 4px 0 #b3401a, 6px 6px 0 #000;
}
h2 { font-size: 18px; line-height: 1.4; color: #ffe14d; text-shadow: 3px 3px 0 #000; }
.sub { font-size: 10px; color: #7dff6a; margin-top: -6px; }
.label { font-size: 11px; color: #ffe9c4; }
.hint { font-size: 10px; line-height: 1.8; color: #ffe9c4; }
.hint b { color: #ffe14d; }
.status { font-size: 9px; line-height: 1.7; color: #bfe6ff; min-height: 2em; }

.bigcode {
  font-size: 44px;
  letter-spacing: 8px;
  color: #ffe14d;
  background: #1e1207;
  padding: 16px 0;
  text-shadow: 3px 3px 0 #b3401a;
}

.btn {
  font-family: inherit;
  font-size: 12px;
  padding: 16px 12px;
  border: none;
  color: #1e1207;
  background: #e0c08a;
  box-shadow: inset -4px -4px 0 #a07c45, inset 4px 4px 0 #fff0cc;
  cursor: pointer;
  touch-action: manipulation;
}
.btn:active { box-shadow: inset 4px 4px 0 #a07c45; transform: translateY(2px); }
.btn.primary { background: #58d36b; box-shadow: inset -4px -4px 0 #2f8f3f, inset 4px 4px 0 #a9f5b4; }
.btn.primary:active { box-shadow: inset 4px 4px 0 #2f8f3f; }
.btn.ghost { background: transparent; color: #ffe9c4; box-shadow: inset 0 0 0 3px #7a5230; font-size: 10px; padding: 12px; }

.join { display: flex; gap: 8px; }
.join input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 20px;
  text-align: center;
  letter-spacing: 6px;
  text-transform: uppercase;
  padding: 10px 4px;
  border: none;
  background: #1e1207;
  color: #ffe14d;
  outline: 3px solid #7a5230;
  user-select: text;
  -webkit-user-select: text;
}
.join input::placeholder { color: #6b4626; }
.join .btn { flex: 0 0 auto; }

.howto {
  text-align: left;
  font-size: 9px;
  line-height: 1.8;
  color: #e8d3b0;
  background: rgba(0, 0, 0, 0.25);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.howto b { color: #ffe14d; }

.chest-options { display: flex; flex-direction: column; gap: 10px; }
.chest-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-family: inherit;
  padding: 10px 12px;
  border: none;
  background: #e0c08a;
  color: #1e1207;
  box-shadow: inset -4px -4px 0 #a07c45, inset 4px 4px 0 #fff0cc;
  cursor: pointer;
  touch-action: manipulation;
}
.chest-opt:active { transform: translateY(2px); }
.chest-opt .ico { font-size: 30px; font-family: system-ui, "Apple Color Emoji", "Segoe UI Emoji", sans-serif; }
.chest-opt .t { font-size: 10px; line-height: 1.5; }
.chest-opt .d { font-size: 8px; line-height: 1.6; color: #5a3a1c; margin-top: 4px; }
#chest { background: rgba(5, 20, 40, 0.35); }
#chest h2 { animation: pulse 0.8s ease-in-out infinite; }

.bigcode.shells { font-size: 22px; letter-spacing: 2px; padding: 10px 0; }
.shop-item .txt { flex: 1; }
.shop-item .price { font-size: 9px; white-space: nowrap; color: #1e1207; }
.shop-item.selected { background: #9be0a6; box-shadow: inset -4px -4px 0 #4f9a5c, inset 4px 4px 0 #d8ffe0; }
.shop-item.done { background: #b9a27a; box-shadow: inset 0 0 0 3px #7a5230; }

.track-row { display: flex; gap: 8px; align-items: center; }
.track-name { flex: 1; font-size: 9px; line-height: 1.6; color: #ffe9c4; text-align: center; }
.btn.small { padding: 10px 14px; font-size: 11px; }
#pause { background: rgba(5, 20, 40, 0.7); }

.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.shake { animation: shake 0.35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
