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

html,
body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #f7f7ff;
  background: radial-gradient(circle at top left, #17162a 0, #050514 50%, #050308 100%);
  overflow: hidden;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(125, 112, 255, 0.35) 0, transparent 55%),
    radial-gradient(circle at 90% 10%, rgba(255, 116, 193, 0.3) 0, transparent 55%),
    radial-gradient(circle at 15% 85%, rgba(90, 245, 255, 0.25) 0, transparent 45%);
  mix-blend-mode: screen;
  opacity: 0.7;
  pointer-events: none;
  filter: blur(2px);
}

.app-container {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.ui-chrome {
  opacity: 1;
  transition: opacity 0.35s ease-out;
}

.ui-chrome.ui-hidden {
  opacity: 0;
  pointer-events: none;
}

/* コントロールエリアは常にクリック可能 */
.app-header {
  pointer-events: auto !important;
}

.app-header * {
  pointer-events: auto !important;
}

/* ファイル選択ボタンは特に確実にクリック可能にする */
label[for="audioFile"],
label[for="audioFile"] *,
#audioFile {
  pointer-events: auto !important;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
  tap-highlight-color: rgba(255, 255, 255, 0.2);
}

.app-header {
  position: fixed;
  top: 16px;
  left: 20px;
  right: 20px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 10px 14px;
  border-radius: 4px;
  background: rgba(10, 10, 20, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  flex-shrink: 0;
  min-width: 0;
}

.app-header h1 {
  font-size: clamp(16px, 2vw, 22px);
  letter-spacing: 0.02em;
  font-weight: 500;
  color: #ffffff;
  line-height: 1.3;
  margin: 0;
}

.subtitle {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  line-height: 1.4;
  font-weight: 300;
}

.header-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.controls {
  display: contents;
}

.file-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  position: relative;
}

.file-input-group input[type="file"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.file-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  max-width: 180px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-weight: 300;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.2s ease-out, background 0.2s ease-out;
  user-select: none;
}

.btn.primary {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn.primary:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.playback-controls {
  display: grid;
  grid-template-columns: auto 1fr 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 300;
}

.slider-group span {
  min-width: 50px;
  white-space: nowrap;
}

.slider-group input[type="range"] {
  width: 100%;
  min-width: 80px;
  accent-color: rgba(255, 255, 255, 0.5);
}

.mode-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-group span {
  min-width: 50px;
  white-space: nowrap;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 300;
}

.mode-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 4px 20px 4px 8px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 10px;
  font-weight: 300;
  cursor: pointer;
  min-width: 80px;
}

.mode-select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
}

.visual-section {
  position: relative;
  position: fixed;
  inset: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  border: none;
  background: radial-gradient(circle at center, rgba(18, 26, 60, 0.8), rgba(2, 3, 10, 0.98));
}

#visualizer {
  width: 100%;
  height: 100%;
  display: block;
}

.visual-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  pointer-events: none;
  background: transparent;
}

.visual-overlay p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 300;
}

.app-footer {
  position: fixed;
  bottom: 16px;
  left: 20px;
  right: 20px;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 4px;
  background: rgba(10, 10, 20, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 300;
}

@media (max-width: 720px) {
  .app-header {
    flex-direction: column;
    gap: 12px;
  }

  .header-left {
    width: 100%;
  }

  .header-right {
    width: 100%;
  }

  .playback-controls {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .slider-group {
    width: 100%;
  }

  .slider-group input[type="range"] {
    min-width: 120px;
  }

  .file-name {
    max-width: 150px;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}


