@charset "UTF-8";
:root {
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --accent: #00a7c8;
  --bg: #eef4fb;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #607085;
  --border: #d8e4f2;
  --soft: #f6f9fd;
  --danger: #b3261e;
  --ok: #137333;
  --shadow: 0 10px 28px rgba(21, 101, 192, 0.10);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  background: radial-gradient(circle at top left, #ffffff 0, #eef7ff 32%, var(--bg) 72%);
  color: var(--text);
}

a { color: inherit; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }

.app-shell {
  width: min(1080px, calc(100% - 24px));
  margin: 18px auto 0;
}

.hero {
  background: linear-gradient(135deg, rgba(21,101,192,0.98), rgba(0,167,200,0.90));
  color: #fff;
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3.8vw, 2.55rem);
  letter-spacing: 0.02em;
}

.hero p {
  margin: 0;
  line-height: 1.8;
  max-width: 760px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.card {
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: #143b67;
}

.drop-area {
  border: 2px dashed #8cbbe7;
  background: linear-gradient(180deg, #ffffff, #f4faff);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
  transition: 0.18s ease;
}

.drop-area.dragover {
  border-color: var(--primary);
  background: #eaf5ff;
  transform: translateY(-1px);
}

.file-input-wrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
}

.file-input-wrap input[type="file"] {
  max-width: 100%;
}

.file-name {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.settings {
  display: grid;
  gap: 14px;
}

.control-group {
  display: grid;
  gap: 7px;
}

.control-group label {
  font-weight: 700;
  color: #203b57;
  font-size: 0.94rem;
}

.control-group .value {
  color: var(--muted);
  font-size: 0.88rem;
}

select, input[type="range"] {
  width: 100%;
}

select {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(21,101,192,0.20);
}

.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: #607d9b; }
.btn.secondary:hover { background: #48617a; }
.btn.ghost { background: #e7f1fb; color: #134f8e; box-shadow: none; }
.btn.ghost:hover { background: #d9eafa; }

.status-box {
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  min-height: 48px;
  color: #324760;
  line-height: 1.7;
}

.progress-wrap {
  margin-top: 12px;
  height: 12px;
  border-radius: 999px;
  background: #dfeaf6;
  overflow: hidden;
  border: 1px solid #c9dbef;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.18s ease;
}

.players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.player-card {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
}

.player-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: #143b67;
}

audio {
  width: 100%;
  display: block;
}

.wave-card {
  margin-top: 16px;
}

#waveCanvas {
  width: 100%;
  height: 150px;
  display: block;
  background: linear-gradient(180deg, #f7fbff, #ffffff);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.info-list {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  line-height: 1.8;
  font-size: 0.94rem;
}

.result-actions {
  display: none;
  margin-top: 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.result-actions.show { display: flex; }

.small-note {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
  margin-top: 10px;
}

.app-footer {
  text-align: center;
  color: #1565c0;
  background: rgba(255,255,255,0.82);
  border-top: 1px solid #d7e6f8;
  margin-top: 14px;
  padding: 9px 8px 14px;
  font-size: 0.9rem;
}

.app-footer a {
  color: #1565c0;
  text-decoration: none;
  font-weight: 700;
}

.app-footer a:hover { color: #0d47a1; }

.ad-panel {
  width: min(1080px, calc(100% - 24px));
  margin: 14px auto 0;
  padding: 0;
  border: 1px solid #d7e6f8;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.ad-panel[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.ad-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: #f4f8ff;
  border-bottom: 1px solid #d7e6f8;
}

.ad-label,
.ad-wait {
  font-size: 0.72rem;
  color: #4f6f91;
  line-height: 1.3;
}

.ad-wait { margin-left: auto; }

.ad-close-btn {
  margin: 0 !important;
  padding: 3px 8px !important;
  min-height: 0;
  line-height: 1.2;
  border: none;
  border-radius: 999px;
  background: #1565c0;
  color: #fff;
  font-size: 0.72rem !important;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.ad-close-btn:hover { background: #0d47a1; }

.ad-body {
  padding: 8px;
  background: #fff;
}

@media (max-width: 860px) {
  .main-grid { grid-template-columns: 1fr; }
  .players { grid-template-columns: 1fr; }
  .hero, .card { border-radius: 16px; }
}

@media (max-width: 520px) {
  .app-shell { width: min(100% - 16px, 1080px); margin-top: 8px; }
  .hero { padding: 18px; }
  .card { padding: 14px; }
  .button-row { flex-direction: column; }
  .btn { width: 100%; }
}
