/* ================================================================
   KKTI Key — v6 検索メイン + 5 母音テスト + 母音別マッチング
   ================================================================ */

:root {
  --bg: #0A0A0A;
  --bg-elev: #141414;
  --bg-card: #1A1A1A;
  --bg-card2: #222;
  --fg: #FFFFFF;
  --fg-2: #B8B8B8;
  --fg-3: #707070;
  --fg-4: #404040;
  --yellow: #FFD43B;
  --yellow-dark: #F4B400;
  --green: #4ADE80;
  --orange: #FF9F45;
  --red: #FF6B6B;
  --border: rgba(255,255,255,0.08);
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: 'palt';
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img { display: block; max-width: 100%; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ========== HEADER ========== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 50;
  border-bottom: 1px solid var(--border);
}
.logo-box { display: flex; align-items: center; }
.logo-img { height: 28px; width: auto; }

.icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--fg);
  border-radius: 50%;
  transition: background 0.2s;
}
.icon-btn:active { background: rgba(255,255,255,0.1); }

/* ========== HERO ========== */
.hero {
  position: relative;
  padding: 28px 20px 24px;
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  overflow: hidden;
}

.hero-decorations {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.hero > *:not(.hero-decorations) {
  position: relative;
  z-index: 1;
}
.hero-orb {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(80px);
}
.hero-orb-yellow {
  top: -120px;
  right: -100px;
  background: var(--yellow);
  opacity: 0.18;
  animation: orbFloat1 18s ease-in-out infinite;
}
.hero-orb-pink {
  bottom: -140px;
  left: -80px;
  background: #FF6B9E;
  opacity: 0.12;
  animation: orbFloat2 22s ease-in-out infinite;
}
@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, 20px); }
}
@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, -25px); }
}
.hero-grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
}
.hero-noise {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, transparent 0, rgba(255,255,255,0.5) 1px, transparent 2px),
    repeating-radial-gradient(circle at 70% 60%, transparent 0, rgba(255,255,255,0.3) 1px, transparent 2px);
  background-size: 4px 4px, 6px 6px;
}

.hero-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--yellow);
  padding: 4px 10px;
  border: 1px solid var(--yellow);
  border-radius: 4px;
  margin-bottom: 18px;
}

.hero-title {
  font-family: 'Anton', 'Noto Sans JP', sans-serif;
  font-size: 44px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  position: relative;
}
.hero-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  margin-top: 14px;
  background: linear-gradient(90deg, var(--yellow), transparent);
  border-radius: 2px;
}

.hero-sub {
  font-size: 14px;
  color: var(--fg-2);
  line-height: 1.6;
  margin-bottom: 22px;
}

/* ========== PROFILE CHIP ========== */
.profile-chip { display: none; }
.profile-chip.measured {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(255,212,59,0.12), rgba(244,180,0,0.06));
  border: 1px solid rgba(255,212,59,0.3);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  cursor: pointer;
  transition: transform 0.15s;
}
.profile-chip.measured:active { transform: scale(0.98); }
.profile-chip-label {
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
}
.profile-chip-range {
  font-family: 'Anton', sans-serif;
  font-size: 22px;
  color: var(--yellow);
  letter-spacing: 0.02em;
  flex: 1;
  text-align: center;
}
.profile-chip-action {
  font-size: 11px;
  color: var(--fg-2);
  background: rgba(255,255,255,0.08);
  padding: 4px 10px;
  border-radius: 12px;
}

/* ========== CTA ========== */
.cta-measure {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--yellow);
  color: #000;
  font-weight: 900;
  font-size: 17px;
  padding: 18px 24px;
  border-radius: 14px;
  letter-spacing: 0.02em;
  transition: transform 0.15s;
  box-shadow: 0 8px 24px rgba(255,212,59,0.3);
  margin-bottom: 14px;
}
.cta-measure:active { transform: scale(0.98); }
.cta-icon { font-size: 20px; }

/* ========== 検索（インライン） ========== */
.hero-search-wrap {
  margin-top: 8px;
}
.hero-search {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color 0.2s;
}
.hero-search:focus-within {
  border-color: var(--yellow);
}
.hero-search svg { color: var(--fg-2); flex-shrink: 0; }
.hero-search-text {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-size: 15px;
  font-family: inherit;
  min-width: 0;
}
.hero-search-text::placeholder {
  color: var(--fg-3);
}
.search-clear {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-2);
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  font-size: 13px;
  flex-shrink: 0;
}

.search-results-inline {
  margin-top: 12px;
  display: none;
}
.search-results-inline.show {
  display: block;
}

/* ========== BLOCK ========== */
.block { margin-bottom: 32px; }
.block-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--fg-3);
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}
.block-title {
  font-family: 'Anton', sans-serif;
  font-size: 24px;
  letter-spacing: 0.01em;
}
.block-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--fg-3);
}

/* ========== GENRE GRID ========== */
.genre-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.genre-grid::-webkit-scrollbar { display: none; }

.genre-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all 0.2s;
  min-width: 80px;
}
.genre-card.active {
  background: linear-gradient(135deg, var(--g1, var(--yellow)), var(--g2, var(--yellow-dark)));
  color: #000;
  border-color: transparent;
}
.genre-all.active {
  background: var(--fg);
  color: #000;
}
.genre-en {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}
.genre-jp { font-size: 12px; font-weight: 700; }

/* ========== SONG LIST（v10 原型に戻し） ========== */
.popular-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.song-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  transition: all 0.15s;
  cursor: pointer;
}
.song-card:active {
  transform: scale(0.98);
  background: var(--bg-card2);
}

.song-rank {
  font-family: 'Anton', sans-serif;
  font-size: 20px;
  color: var(--fg-3);
  letter-spacing: -0.02em;
  min-width: 34px;
  text-align: center;
}

.song-meta { flex: 1; min-width: 0; }
.song-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-card-artist {
  font-size: 12px;
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 推奨キーバッジ */
.song-rec-badge {
  font-family: 'Anton', sans-serif;
  font-size: 16px;
  font-weight: 900;
  padding: 6px 10px;
  border-radius: 8px;
  min-width: 50px;
  text-align: center;
  letter-spacing: -0.02em;
}
.song-rec-badge.fit {
  background: rgba(74,222,128,0.15);
  color: var(--green);
  border: 1px solid rgba(74,222,128,0.3);
}
.song-rec-badge.tight {
  background: rgba(255,159,69,0.12);
  color: var(--orange);
  border: 1px solid rgba(255,159,69,0.3);
}
.song-rec-badge.shift {
  background: rgba(255,212,59,0.12);
  color: var(--yellow);
  border: 1px solid rgba(255,212,59,0.25);
}
.song-rec-badge.far {
  background: rgba(255,107,107,0.12);
  color: var(--red);
  border: 1px solid rgba(255,107,107,0.25);
}

/* ========== SEARCH RESULT ITEMS ========== */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-card);
  margin-bottom: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.search-result-item:active { background: var(--bg-card2); }
.search-result-main { flex: 1; min-width: 0; }
.search-result-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}
.search-result-artist {
  font-size: 12px;
  color: var(--fg-3);
}
.search-result-rec {
  font-family: 'Anton', sans-serif;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: 8px;
}
.search-result-rec.fit {
  color: var(--green);
  background: rgba(74,222,128,0.15);
}
.search-result-rec.tight {
  color: var(--orange);
  background: rgba(255,159,69,0.12);
}
.search-result-rec.shift {
  color: var(--yellow);
  background: rgba(255,212,59,0.12);
}
.search-result-rec.far {
  color: var(--red);
  background: rgba(255,107,107,0.12);
}
.search-result-empty {
  padding: 24px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
}

/* ========== BACK BUTTON ========== */
.back-btn {
  margin: 20px 0 24px;
  font-size: 13px;
  color: var(--fg-2);
  display: inline-block;
  padding: 6px 0;
}

/* ========== VOICE TEST ========== */
.test-container {
  text-align: center;
  padding-top: 0;
}

.test-progress-wrap {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 0 24px;
}
.test-progress-bar {
  height: 100%;
  background: var(--yellow);
  width: 0%;
  transition: width 0.2s linear;
  border-radius: 2px;
}

.test-header { margin-bottom: 20px; }
.test-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--yellow);
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}
.test-status {
  font-size: 11px;
  color: var(--fg-3);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 1px;
}

/* 大きい母音表示 */
.test-vowel-big {
  font-family: 'Anton', sans-serif;
  font-size: 160px;
  line-height: 1;
  color: var(--yellow);
  text-align: center;
  margin: 12px 0 16px;
  min-height: 160px;
  text-shadow: 0 8px 32px rgba(255,212,59,0.4);
  letter-spacing: -0.04em;
}

.test-instr {
  font-size: 17px;
  color: var(--fg);
  font-weight: 700;
  margin-bottom: 6px;
  min-height: 24px;
}
.test-subtext {
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 20px;
  min-height: 18px;
}

/* ヒントテキスト */
.test-hint {
  font-size: 11px;
  color: var(--fg-3);
  text-align: center;
  margin-top: 10px;
}

/* 方向別の母音色 */
.test-vowel-big[data-direction="up"] {
  color: var(--yellow);
  text-shadow: 0 8px 32px rgba(255,212,59,0.4);
}
.test-vowel-big[data-direction="down"] {
  color: var(--green);
  text-shadow: 0 8px 32px rgba(74,222,128,0.4);
}

.test-pitch-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card2));
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.test-pitch-label {
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 1px;
  font-family: 'JetBrains Mono', monospace;
}
.test-pitch-value {
  font-family: 'Anton', sans-serif;
  font-size: 44px;
  color: var(--yellow);
  letter-spacing: 0.01em;
}

.test-range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.test-range-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  text-align: left;
}
.test-range-label {
  display: block;
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 1px;
  margin-bottom: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.test-range-value {
  font-family: 'Anton', sans-serif;
  font-size: 24px;
  color: var(--fg);
  letter-spacing: 0.01em;
}

/* ========== TEST RESULT ========== */
.test-result-block {
  text-align: center;
  padding: 40px 20px 20px;
}
.result-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--yellow);
  font-weight: 700;
  display: block;
  margin-bottom: 14px;
}
.test-result-range {
  font-family: 'Anton', sans-serif;
  font-size: 56px;
  letter-spacing: 0.01em;
  color: var(--fg);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  margin-bottom: 6px;
}
.test-result-sep { color: var(--fg-4); font-size: 32px; }
.test-result-low, .test-result-high { color: var(--yellow); }
.test-result-octaves {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--fg-2);
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.test-result-stable {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.test-result-stable-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--fg-3);
}
.test-result-stable-value {
  font-family: 'Anton', sans-serif;
  font-size: 20px;
  color: var(--fg);
}

/* 母音別グリッド */
.test-result-vowels {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vowel-row {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  gap: 16px;
}
.vowel-char {
  font-family: 'Anton', sans-serif;
  font-size: 28px;
  color: var(--yellow);
  min-width: 32px;
  text-align: center;
}
.vowel-range {
  flex: 1;
  font-family: 'Anton', sans-serif;
  font-size: 16px;
  color: var(--fg);
  text-align: right;
  letter-spacing: 0.01em;
}

.test-result-msg {
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.7;
  padding: 0 16px;
  margin-bottom: 24px;
}

/* ========== SONG DETAIL ========== */
.song-detail { padding: 8px 0 40px; }

.song-genre {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 700;
  color: var(--yellow);
  padding: 4px 10px;
  border: 1px solid var(--yellow);
  border-radius: 4px;
  margin-bottom: 14px;
}
.song-title {
  font-family: 'Anton', sans-serif;
  font-size: 36px;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.song-artist {
  font-size: 14px;
  color: var(--fg-2);
  margin-bottom: 24px;
}

.song-rec-box {
  display: none;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 24px;
  text-align: center;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
}
.song-rec-box.show { display: flex; }
.song-rec-box.hide { display: none; }
.song-rec-box.fit {
  background: linear-gradient(135deg, rgba(74,222,128,0.18), rgba(74,222,128,0.04));
  border-color: rgba(74,222,128,0.3);
}
.song-rec-box.tight {
  background: linear-gradient(135deg, rgba(255,159,69,0.15), rgba(255,159,69,0.04));
  border-color: rgba(255,159,69,0.3);
}
.song-rec-box.shift {
  background: linear-gradient(135deg, rgba(255,212,59,0.15), rgba(244,180,0,0.05));
  border-color: rgba(255,212,59,0.3);
}
.song-rec-box.far {
  background: linear-gradient(135deg, rgba(255,107,107,0.12), rgba(255,107,107,0.04));
  border-color: rgba(255,107,107,0.3);
}

.rec-box-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--fg-3);
  font-weight: 700;
}
.rec-box-key {
  font-family: 'Anton', sans-serif;
  font-size: 64px;
  color: var(--yellow);
  letter-spacing: -0.02em;
  line-height: 1;
}
.song-rec-box.fit .rec-box-key { color: var(--green); }
.song-rec-box.tight .rec-box-key { color: var(--orange); }
.song-rec-box.far .rec-box-key { color: var(--red); }

.rec-box-comment {
  font-size: 13px;
  color: var(--fg-2);
  margin-top: 4px;
}

.no-profile-cta {
  background: var(--bg-card);
  border: 1px dashed var(--fg-4);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 24px;
  text-align: center;
}
.no-profile-cta p {
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}
.info-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.info-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--fg-3);
  font-family: 'JetBrains Mono', monospace;
  display: block;
  margin-bottom: 4px;
}
.info-value {
  font-family: 'Anton', sans-serif;
  font-size: 20px;
  color: var(--fg);
  letter-spacing: 0.01em;
}

/* ========== SHARE BUTTONS ========== */
.share-row {
  display: flex;
  gap: 10px;
  margin: 16px 0 12px;
}
.share-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.15s, opacity 0.2s;
  border: 1px solid var(--border);
}
.share-btn:active { transform: scale(0.97); }
.share-x {
  background: #000;
  color: #FFF;
  border-color: rgba(255,255,255,0.15);
}
.share-line {
  background: #06C755;
  color: #FFF;
  border-color: rgba(0,0,0,0.1);
}

/* ========== PRIMARY BUTTON ========== */
.primary-btn {
  width: 100%;
  background: var(--yellow);
  color: #000;
  font-weight: 900;
  font-size: 16px;
  padding: 18px 24px;
  border-radius: 14px;
  letter-spacing: 0.02em;
  transition: transform 0.15s;
  box-shadow: 0 6px 20px rgba(255,212,59,0.25);
}
.primary-btn:active { transform: scale(0.98); }

/* ========== LEGAL ========== */
.legal-note {
  font-size: 11px;
  color: var(--fg-3);
  line-height: 1.7;
  text-align: center;
  padding: 24px 16px;
}

/* ========== MAIN FOOTER ========== */
.main-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 28px 20px 24px;
  margin-top: 20px;
}
.main-footer-inner {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.main-footer-brand {
  margin-bottom: 16px;
}
.main-footer-logo {
  height: 22px;
  margin: 0 auto 6px;
}
.main-footer-tag {
  font-size: 11px;
  color: var(--fg-3);
  margin: 0;
}
.main-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 16px;
}
.main-footer-nav a {
  font-size: 12px;
  color: var(--fg-2);
  text-decoration: none;
  transition: color 0.2s;
}
.main-footer-nav a:hover {
  color: var(--yellow);
}
.main-footer-copy {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 1px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ========== MEDIA QUERIES ========== */
@media (min-width: 600px) {
  .hero-title { font-size: 56px; }
  .test-vowel-big { font-size: 200px; min-height: 200px; }
  .test-pitch-value { font-size: 56px; }
  .test-result-range { font-size: 72px; }
}
