/* ==========================================================================
   K1 Unified Recipe Web — Official QR Recipes + YouTube Extractor
   Cohesive with K1 Packaging Palette (#F9F1E4 / #A92717) + Bitelabs BI
   ========================================================================== */
:root {
  --cream: #f9f1e4;
  --cream-card: #fbf6ee;
  --cream-deep: #efe2cd;
  --paper: #fffdf9;
  --k1-red: #a92717;
  --k1-red-deep: #7f1b0f;
  --k1-red-soft: rgba(169, 39, 23, 0.10);

  --f-bulgogi: #68351f;
  --f-tteokbokki: #ae2d18;
  --f-kimchi: #722039;

  --bl-midnight: #080d36;
  --bl-cobalt: #003cd4;

  --ink: #1a130f;
  --ink-75: rgba(26, 19, 15, 0.75);
  --ink-55: rgba(26, 19, 15, 0.55);
  --line: rgba(26, 19, 15, 0.13);
  --line-strong: rgba(26, 19, 15, 0.24);

  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-latin: "Space Grotesk", var(--font-sans);

  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 14px 36px -20px rgba(26, 19, 15, 0.22);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; max-width: 100%; overflow-x: hidden; }
body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  word-break: keep-all;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font-family: inherit; color: inherit; }
button { border: none; background: none; cursor: pointer; }
:focus-visible { outline: 3px solid var(--k1-red); outline-offset: 2px; border-radius: 6px; }

.wrap { width: min(1140px, 92%); margin: 0 auto; }

/* ---------- Header / Nav ---------- */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(249, 241, 228, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.app-nav-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  height: 66px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.app-brand .k1 {
  font-family: var(--font-latin);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--k1-red);
  letter-spacing: -0.03em;
}

.app-brand .sub {
  font-family: var(--font-latin);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink-55);
}

.mode-pills {
  display: inline-flex;
  gap: 0.3rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  padding: 0.25rem;
  border-radius: 999px;
}

.mode-pill {
  padding: 0.46rem 1rem;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-75);
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  transition: all 0.2s;
}

.mode-pill.active {
  background: var(--k1-red);
  color: #fff;
}

.mode-pill .yt-dot {
  color: #ef4444;
}

.mode-pill.active .yt-dot {
  color: #ffd5cc;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-75);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.home-link:hover { border-color: var(--ink); color: var(--ink); }

.lang-selector { position: relative; }
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 36px;
  padding: 0 0.72rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.8rem;
  font-weight: 700;
}

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 138px;
  padding: 0.35rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: 0.16s;
}
.lang-selector.open .lang-menu { opacity: 1; visibility: visible; transform: none; }
.lang-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  font-size: 0.83rem;
  color: var(--ink-75);
}
.lang-menu button:hover, .lang-menu button.active {
  background: var(--k1-red-soft);
  color: var(--k1-red);
  font-weight: 700;
}

/* Mobile Bottom Switcher */
.mobile-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  background: var(--paper);
  border-top: 1px solid var(--line-strong);
  padding: 0.45rem 0.6rem calc(0.45rem + env(safe-area-inset-bottom));
  grid-template-columns: repeat(3, 1fr);
  gap: 0.3rem;
}

.mobile-bar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  padding: 0.42rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-55);
}

.mobile-bar a.active {
  background: var(--k1-red-soft);
  color: var(--k1-red);
}

@media (max-width: 820px) {
  .mode-pills, .home-link, .lang-btn .lang-name { display: none; }
  .mobile-bar { display: grid; }
  body { padding-bottom: 68px; }
}

/* ---------- Main Container ---------- */
main { flex: 1; padding: 2rem 0 4rem; }

/* Feed Hero */
.feed-hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: clamp(1.4rem, 3.2vw, 2.2rem);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.6rem;
}

.feed-kicker {
  font-family: var(--font-latin);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--k1-red);
  margin-bottom: 0.5rem;
  display: block;
}

.feed-hero h1 {
  font-size: clamp(1.55rem, 3.2vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.18;
  margin-bottom: 0.55rem;
}

.feed-hero p { font-size: 0.92rem; color: var(--ink-75); }

.feed-cta-panel {
  background: var(--cream);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.feed-cta-panel > strong { font-size: 0.92rem; }
.feed-cta-panel > span { font-size: 0.8rem; color: var(--ink-55); }

@media (max-width: 820px) {
  .feed-hero { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.72rem 1.25rem;
  border-radius: 999px;
  transition: all 0.18s ease;
}
.btn-red { background: var(--k1-red); color: #fff; }
.btn-red:hover { background: var(--k1-red-deep); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--k1-red); }
.btn-outline { border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink); }
.btn-outline:hover { border-color: var(--k1-red); color: var(--k1-red); }

/* Search & Filter Toolbar */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.filter-chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.f-chip {
  padding: 0.48rem 0.92rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-75);
}
.f-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  min-width: 240px;
}
.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 0.86rem;
}

/* Recipe Grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.r-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.22s, box-shadow 0.22s;
}
.r-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.r-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--ink);
  overflow: hidden;
}

.r-thumb img.dish {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.r-thumb .grad-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 3rem;
}

.r-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 0.26rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: var(--k1-red);
}
.r-badge.yt { background: #dc2626; }
.r-badge.p2 { background: rgba(26, 19, 15, 0.78); }

.r-stick-mini {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 44px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.r-body {
  padding: 1.15rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.r-sauce-tag {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--k1-red);
  margin-bottom: 0.25rem;
}

.r-body h3 {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.r-body p {
  font-size: 0.84rem;
  color: var(--ink-75);
  margin-bottom: 0.95rem;
  flex: 1;
}

.r-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--ink-55);
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
}

@media (max-width: 960px) { .recipe-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .recipe-grid { grid-template-columns: 1fr; } }

/* ---------- Detail View ---------- */
.back-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: start;
}

.player-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.video-box {
  position: relative;
  padding-bottom: 56.25%;
  background: #120d0a;
}
.video-box iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.detail-meta {
  padding: 1.25rem 1.4rem;
}

.detail-meta h1 {
  font-size: clamp(1.3rem, 2.8vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0.35rem 0 0.5rem;
}

.detail-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.detail-pills span {
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--cream);
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  color: var(--ink-75);
}

/* K1 Stick Match Banner */
.stick-match-card {
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stick-match-card img {
  width: 58px;
  border-radius: 8px;
  flex-shrink: 0;
}

.stick-match-card strong { display: block; font-size: 0.96rem; color: #fff; margin-bottom: 0.2rem; }
.stick-match-card p { font-size: 0.8rem; color: rgba(249, 241, 228, 0.75); margin-bottom: 0.65rem; }

/* Detail Tabs */
.d-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.d-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  background: var(--cream);
  padding: 0.3rem;
  border-radius: 12px;
  margin-bottom: 1.15rem;
}

.d-tab {
  padding: 0.58rem 0.4rem;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-75);
}
.d-tab.active {
  background: #fff;
  color: var(--k1-red);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ing-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.ing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.62rem 0.8rem;
  border-radius: 10px;
  background: var(--cream-card);
  font-size: 0.88rem;
  cursor: pointer;
}
.ing-item input { accent-color: var(--k1-red); margin-right: 0.55rem; }
.ing-item.checked { opacity: 0.55; text-decoration: line-through; }

.step-list { display: flex; flex-direction: column; gap: 0.75rem; }
.step-item {
  background: var(--cream-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.9rem 1rem;
}
.step-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.step-idx {
  font-family: var(--font-latin);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--k1-red);
}
.ts-btn {
  font-family: var(--font-latin);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--k1-red-soft);
  color: var(--k1-red);
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
}
.ts-btn:hover { background: var(--k1-red); color: #fff; }
.step-item p { font-size: 0.86rem; color: var(--ink-75); }

.sub-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: var(--cream-card);
  border-radius: 10px;
  font-size: 0.86rem;
}
.sub-row .loc { color: var(--bl-cobalt); font-weight: 700; text-align: right; }

/* Comments & Like */
.social-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}
.like-btn {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.84rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.like-btn.liked { background: var(--k1-red-soft); border-color: var(--k1-red); color: var(--k1-red); }

.comment-form { display: flex; gap: 0.5rem; margin-bottom: 0.95rem; }
.comment-form input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.58rem 0.95rem;
  font-size: 0.85rem;
  background: #fff;
}
.comment-list { display: flex; flex-direction: column; gap: 0.65rem; }
.c-item {
  background: var(--cream-card);
  border-radius: 10px;
  padding: 0.72rem 0.9rem;
  font-size: 0.84rem;
}
.c-head { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--ink-55); margin-bottom: 0.25rem; }
.c-head b { color: var(--ink); }

@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* ---------- Integrated YouTube Importer View ---------- */
.import-shell {
  max-width: 860px;
  margin: 0 auto;
}

.import-hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: clamp(1.5rem, 3.5vw, 2.4rem);
  margin-bottom: 1.4rem;
}

.import-hero h1 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0.4rem 0 0.6rem;
}

.import-hero p { font-size: 0.92rem; color: var(--ink-75); margin-bottom: 1.25rem; }

.yt-input-bar {
  display: flex;
  gap: 0.5rem;
  background: var(--cream);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.35rem 0.35rem 0.35rem 1.1rem;
  margin-bottom: 1rem;
}
.yt-input-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.92rem;
  min-width: 0;
}

.sample-yt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-55);
}

.sample-yt-btn {
  padding: 0.38rem 0.82rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--cream-card);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-75);
}
.sample-yt-btn:hover { border-color: var(--k1-red); color: var(--k1-red); }

.status-banner {
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
  display: none;
}
.status-banner.info { display: block; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.status-banner.ok { display: block; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.status-banner.err { display: block; background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

.extract-result {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.extract-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.match-strip {
  background: var(--cream);
  border: 1px solid rgba(169, 39, 23, 0.25);
  border-radius: var(--r-md);
  padding: 0.9rem 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.match-strip-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.match-strip-left img {
  width: 44px;
  border-radius: 6px;
}

/* Footer */
.app-foot {
  background: var(--bl-midnight);
  color: rgba(255, 255, 255, 0.65);
  padding: 2rem 0;
  font-size: 0.8rem;
}
.app-foot-in {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.app-foot img { height: 22px; }
