* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;          /* no pull-to-refresh */
  touch-action: none;                 /* no scroll/zoom gestures */
  background: #008080;                 /* classic 90s teal */
  font-family: "Verdana", "Geneva", "Tahoma", system-ui, sans-serif;
  position: fixed;                     /* lock the page in place */
  inset: 0;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* transparent overlay for animated ripples & explosions */
#fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 5;
}

/* ---- Tool bars (chunky Win95 silver panels) ---- */
.bar {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px calc(env(safe-area-inset-left) + 8px) 8px calc(env(safe-area-inset-right) + 8px);
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: auto;
  background: #c0c0c0;
}

.bar-top {
  top: 0;
  padding-top: calc(env(safe-area-inset-top) + 8px);
  border-bottom: 3px solid #404040;
  box-shadow: inset 0 2px 0 #ffffff;   /* raised top edge */
}

.bar-bottom {
  bottom: 0;
  flex-wrap: wrap-reverse;            /* overflow wraps UP, never off-screen */
  padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
  border-top: 3px solid #ffffff;
  box-shadow: inset 0 -2px 0 #404040; /* raised bottom edge */
}

/* ---- Color swatches (square clip-art color chips) ---- */
.swatch {
  width: 44px;
  height: 44px;
  border-radius: 0;
  border: 3px solid #000;
  box-shadow: 2px 2px 0 #000;
  flex: 0 0 auto;
  transition: transform 0.06s steps(2);
}
.swatch.active {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #000;
}

/* ---- Tool buttons (beveled gray toolbar buttons) ---- */
.tool {
  width: 46px;
  height: 46px;
  border-radius: 3px;
  background: #d9d6cc;
  border: 2px solid;
  border-color: #ffffff #5a5a5a #5a5a5a #ffffff;  /* raised bevel */
  box-shadow: 1px 1px 0 #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex: 0 0 auto;
  line-height: 1;
}

/* the "Max" name button — WordArt rainbow with a hard black outline */
.tool.maxbtn {
  font-family: "Impact", "Arial Black", "Haettenschweiler", sans-serif;
  font-size: 18px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(90deg,#e53935,#fb8c00,#fdd835,#43a047,#1e88e5,#8e24aa);
  -webkit-text-stroke: 1px #000;
  text-shadow: 1px 1px 0 #000;
}

/* pressed / selected = sunken bevel + bright highlight */
.tool:active,
.tool.active {
  border-color: #5a5a5a #ffffff #ffffff #5a5a5a;
  background: #ffe600;
  box-shadow: inset 1px 1px 0 #000;
  transform: translate(1px, 1px);
}
.tool.maxbtn:active,
.tool.maxbtn.active {
  background: linear-gradient(90deg,#e53935,#fb8c00,#fdd835,#43a047,#1e88e5,#8e24aa);
}

/* hold-to-clear visual ring */
#clearHint {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,80,80,0.25);
  pointer-events: none;
  z-index: 9;
  transition: width 0.05s linear, height 0.05s linear;
}

/* ---- Start gate (cheesy 90s splash) ---- */
#startGate {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background-color: #008080;
  background-image:
    radial-gradient(circle at 50% 42%, #00c2c2 0%, #008080 62%),
    repeating-conic-gradient(from 0deg at 50% 42%, rgba(255,255,255,0.10) 0deg 11deg, transparent 11deg 22deg);
}
#startGate.hidden { display: none; }
.gate-card {
  text-align: center;
  animation: pop 0.4s steps(4);
  background: #c0c0c0;
  padding: 24px 30px 28px;
  border: 4px solid;
  border-color: #ffffff #404040 #404040 #ffffff;
  box-shadow: 6px 6px 0 #000;
}
.gate-emoji { font-size: 92px; animation: wiggle 0.9s steps(6) infinite; }
.gate-title {
  font-family: "Impact", "Arial Black", "Haettenschweiler", sans-serif;
  font-size: 56px;
  font-style: italic;
  letter-spacing: 1px;
  margin-top: 6px;
  color: #ffe600;
  -webkit-text-stroke: 2px #000;
  text-shadow: 4px 4px 0 #e5005a, 7px 7px 0 #000;
}
.gate-sub {
  font-family: "Impact", "Arial Black", sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
  color: #000;
  margin-top: 12px;
}

@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes wiggle { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

/* ---- Handwriting practice page ---- */
.hidden { display: none !important; }
.wordbtn {
  height: 46px;
  padding: 0 14px;
  border-radius: 3px;
  background: #d9d6cc;
  border: 2px solid;
  border-color: #ffffff #5a5a5a #5a5a5a #ffffff;
  box-shadow: 1px 1px 0 #000;
  font-family: "Verdana", system-ui, sans-serif;
  font-size: 19px;
  font-weight: 800;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.wordbtn:active,
.wordbtn.active {
  border-color: #5a5a5a #ffffff #ffffff #5a5a5a;
  background: #ffe600;
  box-shadow: inset 1px 1px 0 #000;
  transform: translate(1px, 1px);
}

/* ---- "Blow up the screen" clear effects ---- */
#flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
}
#flash.go { animation: flashfade 0.35s ease-out; }
@keyframes flashfade { from { opacity: 0.92; } to { opacity: 0; } }

#canvas.shake { animation: shake 0.5s ease; }
@keyframes shake {
  10%, 90% { transform: translate(-3px, 0); }
  20%, 80% { transform: translate(5px, 0); }
  30%, 50%, 70% { transform: translate(-9px, 0); }
  40%, 60% { transform: translate(9px, 0); }
}
