:root{ color-scheme: dark; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #0b0f14;
  color: rgba(255,255,255,0.8);
  overflow: hidden;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

canvas {
  border-radius: 10px;
  max-width: 100vw;
  max-height: 100vh;
  touch-action: none; /* prevent scroll/zoom while playing */
  user-select: none;
  -webkit-user-select: none;
}

.hint, .credit {
  margin: 0;
  font-size: 14px;
  opacity: 0.75;
  text-align: center;
  padding: 0 12px;
}

.credit {
  font-style: italic;
  opacity: 0.5;
}

@media (max-width: 420px), (max-height: 520px) {
  .credit { display: none; }
  .hint { font-size: 12px; }
}

/* Difficulty overlay */
.overlay{
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 20;
}
.overlay.hidden{ display: none; }

.panel{
  width: min(420px, 100%);
  background: rgba(20, 26, 34, 0.92);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 18px 45px rgba(0,0,0,0.45);
}

.panel h2{
  margin: 0 0 12px;
  font-size: 24px;
  color: rgba(255,255,255,0.92);
}

.label{
  display:block;
  text-align:left;
  font-size: 14px;
  opacity: 0.8;
  margin-bottom: 6px;
}

.select, .btn{
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 16px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.92);
  background-color: rgba(20,26,34,0.92); /* force dark control background */
}

/* Make the <select> readable on all browsers (Firefox/Android/iOS) */
.select{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 44px; /* room for arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.85)' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px 18px;
}

.select:focus{
  outline: 2px solid rgba(86,240,165,0.55);
  outline-offset: 2px;
}

/* Dropdown list colours (supported on most desktop browsers) */
.select option{
  background-color: #141a22;
  color: rgba(255,255,255,0.92);
}
.btn{
  margin-top: 10px;
  cursor: pointer;
  font-weight: 700;
}

.btn:active{ transform: translateY(1px); }

.overlayHint{
  margin: 12px 0 0;
  font-size: 12px;
  opacity: 0.65;
}
