:root {
  color-scheme: dark;
  --bg: #07100d;
  --case: #151917;
  --case-2: #232a26;
  --screen: #060b08;
  --text: #f2f7ef;
  --muted: #aeb9ad;
  --accent: #7fb069;
  --danger: #d84d3f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.app,
.game-root,
.play-surface,
.touch-controls,
canvas,
button {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 50% 0%, #1c3028, var(--bg) 44%);
  color: var(--text);
  overscroll-behavior: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(#303934, #171d1a);
  color: var(--text);
  min-height: 42px;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08), 0 2px 5px rgba(0, 0, 0, 0.28);
}

button:focus {
  outline: none;
}

button:focus-visible {
  outline: 2px solid rgba(127, 176, 105, 0.72);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
}

.primary {
  border-color: rgba(127, 176, 105, 0.7);
  background: linear-gradient(#456d57, #243f33);
}

.app {
  min-height: 100svh;
}

.auth {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(3, 10, 8, 0.34), rgba(3, 10, 8, 0.76)),
    url("/assets/generated/locations/location_lake_1.png") center / cover;
}

.auth-box {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(7, 16, 13, 0.93);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.auth-box h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.auth-box p {
  margin: 0 0 14px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 12px;
  background: #0c1714;
  color: var(--text);
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  background: #0c1714;
  color: var(--text);
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

.error {
  min-height: 20px;
  margin-top: 10px;
  color: #ffaaa2;
}

.game-root {
  min-height: 100svh;
  height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
  justify-items: center;
  gap: 5px;
  padding: max(4px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.game-root.no-controls {
  grid-template-rows: minmax(0, 1fr);
}

.play-surface {
  position: relative;
  width: min(100%, 620px);
  height: 100%;
  max-width: 620px;
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #07100d;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

.bug-report-form {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 25%;
  display: grid;
  gap: 8px;
  padding: 0;
}

.bug-report-form .field {
  margin: 0;
}

.bug-report-form input,
.bug-report-form textarea {
  min-height: 36px;
  border-radius: 7px;
  background: rgba(5, 13, 10, 0.94);
}

.bug-report-form textarea {
  min-height: 96px;
}

.bug-report-form button {
  min-height: 38px;
}

.bug-report-form .error {
  min-height: 18px;
  margin-top: 0;
  font-size: 12px;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 10px;
  background: var(--screen);
  image-rendering: auto;
  touch-action: none;
}

.touch-controls {
  width: min(100%, 620px);
  display: grid;
  gap: 8px;
  align-items: center;
}

.touch-controls.count-1 {
  grid-template-columns: minmax(120px, 240px);
  justify-content: center;
}

.touch-controls.count-2 {
  grid-template-columns: repeat(2, minmax(112px, 1fr));
}

.touch-controls.count-3 {
  grid-template-columns: minmax(76px, 0.85fr) minmax(132px, 1.7fr) minmax(80px, 1fr);
}

.touch-controls .action {
  min-height: 52px;
  font-weight: 700;
}

@media (max-width: 520px) {
  .game-root {
    gap: 4px;
  }

  .play-surface {
    width: 100%;
    height: 100%;
    min-width: 0;
    border-radius: 8px;
  }

  .touch-controls {
    gap: 6px;
  }

  .touch-controls.count-3 {
    grid-template-columns: minmax(64px, 0.8fr) minmax(118px, 1.6fr) minmax(70px, 0.9fr);
  }

  button {
    min-height: 39px;
    border-radius: 7px;
    font-size: 13px;
  }
}

@media (max-height: 720px) {
  .touch-controls .action {
    min-height: 40px;
  }
}
