:root {
  color-scheme: light;
  --bg: #f7f2ea;
  --frame: #1b1b1b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top, #fff8ef, #f2e6d6 65%, #e8d6bf 100%);
  font-family: "Georgia", "Times New Roman", serif;
}

.stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
}

.game-wrap {
  position: relative;
  display: inline-block;
  touch-action: manipulation;
}

.help-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #3c3c3c;
  background: rgba(253, 248, 241, 0.95);
  color: #1b1b1b;
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(27, 27, 27, 0.18);
}

.help-button:active {
  transform: scale(0.98);
}

#game {
  width: min(96vw, 1100px);
  height: auto;
  max-height: 86vh;
  border: 2px solid var(--frame);
  background: #fdf8f1;
  box-shadow: 0 12px 32px rgba(27, 27, 27, 0.18);
  touch-action: manipulation;
}

.name-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(27, 27, 27, 0.5);
  z-index: 10;
}

.name-overlay.show {
  display: flex;
}

.name-card {
  background: #fdf8f1;
  border: 2px solid var(--frame);
  padding: 16px 18px;
  min-width: min(80vw, 280px);
  display: grid;
  gap: 10px;
  text-align: center;
}

.tutorial-card {
  background: #fdf8f1;
  border: 2px solid var(--frame);
  padding: 14px 16px 16px;
  width: min(88vw, 420px);
  display: grid;
  gap: 12px;
  text-align: center;
}

.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tutorial-title {
  font-size: 18px;
  text-align: left;
}

.tutorial-close {
  width: 28px;
  height: 28px;
  border: 1px solid #3c3c3c;
  background: #ffffff;
  font-size: 18px;
  cursor: pointer;
}

.tutorial-canvas {
  width: 100%;
  height: auto;
  border: 1px solid #3c3c3c;
  background: #fdf8f1;
}

.tutorial-text {
  font-size: 13px;
  color: #1b1b1b;
}

.name-title {
  font-size: 16px;
}

.name-input {
  padding: 8px 10px;
  border: 1px solid #3c3c3c;
  font-family: inherit;
  font-size: 16px;
}

.name-submit {
  padding: 8px 10px;
  border: 1px solid #3c3c3c;
  background: #ffffff;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.name-note {
  font-size: 12px;
  color: #b33a2f;
  min-height: 14px;
}

@media (max-width: 640px) {
  .stage {
    padding: 8px;
  }

  #game {
    width: 98vw;
    max-height: 88vh;
  }
}
