/* ---------- 홈 (시안 C) ---------- */
.home { gap: var(--gap); }

/* 상단 */
.home-top { display: flex; align-items: center; gap: var(--gap); position: relative; z-index: 5; }
.home-logo {
  position: relative; width: 120px; height: 52px; flex: none;
  background: var(--team); color: var(--team-on);
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  display: grid; place-items: center;
}
.home-logo .num { font-size: 34px; }
.home-me {
  flex: none; height: 52px; padding: 0 26px; background: var(--ink); color: #fff;
  font-weight: 800; font-size: 16px;
}

.search { position: relative; flex: 1; min-width: 0; }
.search input {
  width: 100%; height: 52px; padding: 0 18px 0 50px; border-radius: var(--r-sm);
  background: var(--panel); color: var(--ink); border: 0; outline: none;
  border-left: 6px solid var(--team);
  font-size: 17px; font-weight: 600;
}
.search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--ink-2); display: flex; }
.search-icon svg { width: 20px; height: 20px; }
.search-placeholder {
  position: absolute; left: 52px; right: 18px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 17px; font-weight: 500; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-placeholder.swap { animation: ph-swap 0.4s var(--ease-out); }
@keyframes ph-swap { from { opacity: 0; transform: translateY(20%); } }

/* NEXT 띠 */
.next-bar { display: flex; align-items: stretch; gap: 6px; height: 44px; flex: none; }
.next-bar .nb-tag {
  background: var(--team-deep); color: #fff; font-size: 24px; padding: 0 26px;
  display: grid; place-items: center;
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.next-bar .nb-main {
  flex: 1; min-width: 0; background: var(--ink); color: #fff;
  display: flex; align-items: center; padding: 0 28px; font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.next-bar .nb-hot {
  background: var(--hot); color: var(--ink); display: grid; place-items: center;
  padding: 0 24px; font-size: 14px; font-weight: 800; flex: none;
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}

/* 사진 타일 4개 */
.home-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: var(--gap); }
.tile {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  text-align: left; transition: transform 0.2s var(--ease-out);
}
.tile:active { transform: scale(0.985); }
.tile .tile-photo { position: absolute; inset: 0; transition: transform 0.25s var(--ease-out); }
.tile:active .tile-photo { transform: scale(1.04); }
.tile .tile-en {
  position: absolute; left: 0; top: 24px; background: var(--ink); color: #fff;
  padding: 7px 24px 7px 14px; font-size: 14px;
}
.tile .tile-name {
  position: absolute; left: 0; bottom: 0; background: var(--ink); color: #fff;
  padding: 16px 64px 18px 24px; font-size: clamp(30px, 5.4vmin, 56px);
  clip-path: polygon(0 0, 100% 0, calc(100% - 28px) 100%, 0 100%);
}
.tile .tile-info {
  position: absolute; right: 16px; bottom: 22px; background: var(--team); color: var(--team-on);
  padding: 9px 22px; font-size: 13px; font-weight: 800; max-width: 62%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@media (orientation: portrait) {
  .home-top { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .home-me { margin-left: auto; }
  .home-grid { grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); }
  .tile .tile-name { font-size: 34px; padding: 12px 48px 14px 18px; }
  .next-bar .nb-hot { display: none; }
}

/* 통합검색 결과 패널 */
.search-panel {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  max-height: min(70vh, 560px); overflow: auto;
  background: #fff; border-radius: var(--r-lg); padding: 14px; box-shadow: 0 18px 50px rgba(15, 20, 30, 0.22);
  border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px;
}
.sp-head { display: flex; align-items: center; gap: 8px; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip.ai { background: #f1e8ff; color: #6b3fd4; }
.sp-close { width: 36px; height: 36px; flex: none; font-size: 14px; }
.sp-matches { display: flex; flex-direction: column; gap: 6px; }
.sp-match {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; align-items: center;
  padding: 10px 14px; border-radius: var(--r-md); background: var(--bg-2);
}
.sp-match small { grid-column: 1 / -1; color: var(--text-3); }
.sp-vs { font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sp-result { display: flex; align-items: center; gap: 6px; }
.sp-score { font-family: var(--font-display); font-weight: 400; font-size: 20px; }
.sp-card { padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-2); }
.sp-card p { margin: 4px 0; }
.sp-rank { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-rank li { display: grid; grid-template-columns: 40px auto 1fr; gap: 8px; align-items: baseline; padding: 4px 6px; border-radius: 8px; }
.sp-rank li b { color: var(--ink); }
.sp-rank li small { color: var(--text-3); text-align: right; }
.sp-rank li.is-focus { background: #fff; outline: 2px solid var(--ink); }
.sp-links { display: flex; flex-wrap: wrap; gap: 6px; }
.home-top { position: relative; z-index: 5; }
.sp-head > b { flex: 1; }
.sp-sub { margin: 4px 2px 0; font-size: 13px; font-weight: 800; color: var(--text-3); }
.sp-matches.is-similar .sp-match { background: #fff; border: 1px dashed var(--line); }

/* 검색 패널: 결과 + 오른쪽 바로가기 */
.sp-body { display: grid; grid-template-columns: 1fr 190px; gap: 16px; align-items: start; }
.sp-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sp-go { border-left: 1px solid var(--line); padding-left: 16px; display: flex; flex-direction: column; }
.sp-go b { font-size: 13px; font-weight: 800; color: var(--text-3); padding: 2px 0 6px; }
.sp-go button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: 0; padding: 9px 2px; cursor: pointer; text-align: left;
  font-size: 16px; font-weight: 800; color: var(--text);
}
.sp-go button span { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.sp-go button i { font-style: normal; color: var(--text-3); }
.sp-go button:hover span { color: var(--team-ink); }
.sp-go .is-current span { color: var(--team-ink); }
@media (orientation: portrait) {
  .sp-body { grid-template-columns: 1fr; }
  .sp-go { border-left: 0; border-top: 1px solid var(--line); padding: 8px 0 0; }
}

/* 홈 화면 앱 설치 안내 띠 */
.install-bar {
  position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 12px; width: min(560px, calc(100% - 32px));
  background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 10px 12px 10px 10px;
  box-shadow: var(--shadow); animation: sheet-up 0.3s var(--ease-out);
}
.install-bar img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-bar b { font-size: 15px; white-space: nowrap; }
.install-bar span { font-size: 13px; color: var(--ink-3); flex: 1; min-width: 0; }
.install-bar .chip { background: var(--hot); color: var(--ink); margin-left: auto; }
.install-x { color: var(--ink-3); font-size: 16px; padding: 6px; flex: none; }
.ios-share {
  display: inline-block; width: 12px; height: 14px; vertical-align: -2px; margin: 0 2px;
  border: 2px solid var(--ink-3); border-top: 0; border-radius: 0 0 3px 3px; position: relative;
}
.ios-share::before { content: "↑"; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); font-size: 11px; font-style: normal; line-height: 1; }
