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

body {
  background: #0f0f13;
  color: #e0dfe8;
  font-family: 'Courier New', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 40px 20px;
  gap: 24px;
}

a {
  color: #7c6af7;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid #7c6af7;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

a:hover {
  background: #7c6af7;
  color: #fff;
}

.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 720px;
}

.header a {
  justify-self: end;
}

#partition-select {
  width: fit-content;
  background: #1e1c2a;
  color: #e0dfe8;
  border: 1px solid #2e2b45;
  border-radius: 6px;
  padding: 4px 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

#partition-select:hover,
#partition-select:focus {
  border-color: #7c6af7;
}


#beat-dot {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7c6af7;
  box-shadow: 0 0 8px #7c6af7;
  transform: scale(1);
  opacity: 0.3;
  pointer-events: none;
}

h1 {
  font-size: 1.1rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #7c6af7;
  opacity: 0.85;
}

#partition {
  width: 100%;
  max-width: 720px;
  height: 260px;
  background: #16151e;
  color: #c8f7a0;
  border: 1px solid #2e2b45;
  border-radius: 8px;
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

#partition:focus {
  border-color: #7c6af7;
}

#partition-display {
  width: 100%;
  max-width: 720px;
  height: 260px;
  background: #16151e;
  color: #c8f7a0;
  border: 1px solid #2e2b45;
  border-radius: 8px;
  padding: 16px;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-y: auto;
  display: none;
}

#partition-display mark {
  background: rgba(124, 106, 247, 0.25);
  color: #fff;
  font-weight: bold;
  border-radius: 3px;
  padding: 0 2px;
  text-shadow: 0 0 8px rgba(124, 106, 247, 0.6);
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tempo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tempo input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 3px;
  background: #2e2b45;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.tempo input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #7c6af7;
  cursor: pointer;
  transition: background 0.15s;
}

.tempo input[type="range"]::-webkit-slider-thumb:hover {
  background: #fff;
}

#tempo-label {
  font-size: 0.8rem;
  color: #7c6af7;
  min-width: 60px;
}

@media (max-width: 600px) {
  button[onclick="downloadPartition();"] {
    display: none;
  }

  body {
    padding: 24px 16px;
    gap: 16px;
  }

  #partition,
  #partition-display {
    height: 180px;
    font-size: 0.8rem;
  }

  .controls {
    flex-wrap: wrap;
    justify-content: center;
  }

  button {
    padding: 12px 18px;
    font-size: 0.8rem;
    flex: 1;
    min-width: 80px;
  }

  .tempo {
    width: 100%;
    justify-content: center;
  }

  .tempo input[type="range"] {
    width: 140px;
  }

  #partition-select {
    font-size: 0.75rem;
    max-width: 90px;
  }
}

button {
  background: none;
  color: #7c6af7;
  border: none;
  border-radius: 6px;
  padding: 12px 20px;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.15s, transform 0.1s, text-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:hover {
  color: #a99fff;
}

button:active {
  color: #fff;
  transform: scale(0.9);
  text-shadow: 0 0 20px #7c6af7, 0 0 40px #7c6af7;
}
