:root {
  --safe-area-inset-top: env(safe-area-inset-top, 20px);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 20px);
  --color-bg: #0a0a0a;
  --color-surface: #1a1a1a;
  --color-primary: #4fc3f7;
  --color-error: #ef5350;
  --color-text: #ffffff;
  --radius: 16px;
  --transition: 0.2s ease;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;            /* Prevent pull-to-refresh / scroll */
  touch-action: manipulation; /* Disable double-tap zoom */
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding:
    var(--safe-area-inset-top)
    1rem
    var(--safe-area-inset-bottom);
}

.container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

.header h1 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  text-align: center;
  letter-spacing: -0.02em;
}

.canvas-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.btn {
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 3rem;
  background: var(--color-primary);
  color: #000;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn:active {
  background: #29b6f6;
}

.error {
  color: var(--color-error);
  font-size: 0.9rem;
  text-align: center;
  min-height: 1.5em;
}
.hidden {
  visibility: hidden;
}

.freq-display {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-primary);
  letter-spacing: -0.02em;
  margin-top: 0.5rem;
  font-variant-numeric: tabular-nums;  /* stable width so the number doesn’t jump */
}

.freq-display span {
  /* optional: the number itself can have a slightly different colour */
  color: #ffffff;
}