:root {
  color-scheme: light;
  font-family: Inter, ui-rounded, "Segoe UI", system-ui, sans-serif;
  --ink: #27303f;
  --paper: #fff9ee;
  --paper-strong: #ffffff;
  --mint: #a8ddb5;
  --blue: #8ab6d6;
  --pink: #f4a6c1;
  --orange: #f7b267;
  --shadow: rgba(39, 48, 63, 0.18);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #8bcf94;
  color: var(--ink);
  touch-action: none;
  user-select: none;
}

button,
input {
  font: inherit;
}

#gameRoot {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #8bcf94;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

body.round-active #gameCanvas {
  cursor: none;
}

body.round-active,
body.round-active * {
  cursor: none;
}

button {
  cursor: pointer;
}

body.round-active button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.screen-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92vw, 500px);
  max-height: min(92vh, 620px);
  transform: translate(-50%, -50%);
  padding: clamp(20px, 4vw, 34px);
  border: 3px solid rgba(39, 48, 63, 0.12);
  border-radius: 8px;
  background: rgba(255, 249, 238, 0.94);
  box-shadow: 0 18px 40px var(--shadow);
  overflow: auto;
}

.logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(42px, 10vw, 72px);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  font-size: clamp(24px, 5vw, 34px);
  margin-bottom: 14px;
}

.logo-scope {
  position: relative;
  width: 58px;
  height: 58px;
  border: 4px solid var(--ink);
  border-radius: 50%;
  flex: 0 0 auto;
}

.logo-scope::before,
.logo-scope::after {
  content: "";
  position: absolute;
  background: var(--ink);
}

.logo-scope::before {
  left: 50%;
  top: -10px;
  width: 3px;
  height: 74px;
  transform: translateX(-50%);
}

.logo-scope::after {
  left: -10px;
  top: 50%;
  width: 74px;
  height: 3px;
  transform: translateY(-50%);
}

.menu-block {
  margin: 18px 0;
}

.label {
  margin-bottom: 8px;
  font-weight: 800;
}

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

.segmented button,
.primary-action,
.modal-actions button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 900;
  box-shadow: inset 0 -3px 0 rgba(39, 48, 63, 0.12);
}

.segmented button {
  background: #e8f1dc;
}

.segmented button.selected {
  background: var(--blue);
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 54px;
  margin: 16px 0 22px;
  font-weight: 800;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-ui {
  position: relative;
  width: 62px;
  height: 34px;
  border-radius: 999px;
  background: #d6dccd;
  box-shadow: inset 0 0 0 2px rgba(39, 48, 63, 0.1);
}

.toggle-ui::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 8px var(--shadow);
  transition: transform 0.18s ease;
}

.toggle-row input:checked + .toggle-ui {
  background: var(--mint);
}

.toggle-row input:checked + .toggle-ui::after {
  transform: translateX(28px);
}

.primary-action {
  width: 100%;
  min-height: 56px;
  background: var(--orange);
  font-size: 22px;
}

.control-help {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(168, 221, 181, 0.45);
  line-height: 1.45;
  font-weight: 700;
}

.control-help ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

.top-hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5;
}

.icon-btn,
.fire-btn {
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 249, 238, 0.92);
  color: var(--ink);
  font-weight: 1000;
  font-size: 22px;
  box-shadow: 0 7px 18px var(--shadow), inset 0 -3px 0 rgba(39, 48, 63, 0.12);
}

.timer-text {
  min-width: 58px;
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(255, 249, 238, 0.92);
  box-shadow: 0 7px 18px var(--shadow);
  text-align: center;
  font-weight: 1000;
}

.fire-btn {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 72px;
  height: 72px;
  z-index: 5;
  background: var(--pink);
}

.bullet-icon {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 38px;
  border-radius: 12px 12px 4px 4px;
  background: #f7f3e8;
  border: 3px solid var(--ink);
  transform: rotate(28deg);
}

.bullet-icon::before {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  bottom: -9px;
  height: 10px;
  border-radius: 3px;
  background: var(--orange);
  border: 3px solid var(--ink);
}

.portrait-warning {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(39, 48, 63, 0.82);
  color: #ffffff;
  text-align: center;
}

.portrait-warning div {
  display: grid;
  gap: 10px;
  max-width: 320px;
}

.portrait-warning strong {
  font-size: 30px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(39, 48, 63, 0.38);
}

.modal-card {
  width: min(92vw, 480px);
  max-height: 88vh;
  overflow: auto;
  padding: clamp(18px, 4vw, 28px);
  border-radius: 8px;
  background: var(--paper);
  border: 3px solid rgba(39, 48, 63, 0.13);
  box-shadow: 0 18px 42px rgba(39, 48, 63, 0.24);
}

.modal-card p {
  line-height: 1.48;
  font-weight: 700;
}

.target-preview-wrap {
  display: grid;
  place-items: center;
  margin: 8px 0 16px;
  min-height: 216px;
  border-radius: 8px;
  background: rgba(168, 221, 181, 0.4);
}

#targetPreview {
  width: 190px;
  height: 198px;
}

.modal-actions {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  background: var(--blue);
}

.modal-actions button.secondary {
  background: #e8f1dc;
}

@media (max-height: 430px) and (orientation: landscape) {
  .screen-panel {
    width: min(94vw, 680px);
    padding: 16px;
  }

  h1 {
    font-size: 46px;
  }

  .logo-row {
    margin-bottom: 12px;
  }

  .menu-block,
  .toggle-row {
    margin: 10px 0;
  }

  .control-help {
    margin-top: 10px;
    padding: 10px;
  }
}
