/* ═══════════════════════════════════════════════════════
   뭐먹지 — 공통 디자인 시스템
   테마: 심야 포장마차 / 홍콩 레트로 카페 감성
   ═══════════════════════════════════════════════════════ */

/* ── CSS 변수 ───────────────────────────────────────── */
:root {
  --bg:          #1A1A18;
  --surface:     #242420;
  --surface-2:   #2E2E2A;
  --primary:     #FF6B2B;
  --accent:      #E8C547;
  --cream:       #F5F0E8;
  --text-main:   #F5F0E8;
  --text-muted:  #B0A898;
  --border:      #3A3A35;
  --warn:        #8B1A1A;

  --font-head: 'Black Han Sans', 'Noto Sans KR', sans-serif;
  --font-body: 'Noto Sans KR', sans-serif;

  --max-content: 680px;
  --transition:  0.18s ease;
}

/* ── 리셋 & 기본 ────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  /* 페이퍼 노이즈 텍스처 (CSS only) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition);
}

a:hover {
  opacity: 0.75;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
}

fieldset {
  border: none;
}

/* ── 헤더 ────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  color: var(--cream);
}

.logo-main {
  font-family: var(--font-head);
  font-size: 1.6rem;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-size: 0.88rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  transition: color var(--transition);
}

.site-nav a:hover {
  color: var(--cream);
  opacity: 1;
}

/* ── 레이아웃 ────────────────────────────────────────── */
.main-layout {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1.5rem 1rem 3rem;
  max-width: 1100px;
  margin: 0 auto;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: var(--max-content);
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .main-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem;
    padding: 2.5rem 2rem 4rem;
  }

  .main-content {
    flex: 1;
    margin: 0;
  }

  .sidebar-ad {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    min-height: 250px;
    background: var(--surface);
    border: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
  }
}

/* ── 필터 패널 ───────────────────────────────────────── */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-group legend {
  font-family: var(--font-head);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.filter-chip.active {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
  font-weight: 700;
}

.filter-chip:hover {
  border-color: var(--primary);
}

.chip-all {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  background: transparent;
  transition: background var(--transition), color var(--transition);
}

.chip-all:hover {
  background: var(--accent);
  color: var(--bg);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.filter-inline {
  flex: 1;
  min-width: 160px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 0.35rem;
}

.radio-label input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* ── 슬롯 머신 ───────────────────────────────────────── */
.roulette-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.roulette-label {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.slot-frame {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.slot-tape {
  height: 8px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0px,
    var(--accent) 12px,
    transparent 12px,
    transparent 20px
  );
  opacity: 0.6;
}

.slot-display {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--cream);
  letter-spacing: 0.04em;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.05s ease;
}

.slot-flash {
  filter: brightness(1.5);
}

/* ── 스핀 버튼 ───────────────────────────────────────── */
.spin-btn {
  font-family: var(--font-head);
  font-size: 1.8rem;
  color: var(--bg);
  background: var(--primary);
  padding: 0.85rem 3.5rem;
  letter-spacing: 0.06em;
  /* 평행사변형 모양 */
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  transition: background var(--transition), transform var(--transition), clip-path var(--transition);
  min-width: 200px;
  min-height: 60px;
}

.spin-btn:hover {
  background: #ff824a;
}

.spin-btn:active {
  transform: scale(0.97);
}

.spin-btn[data-state="spinning"] {
  background: var(--accent);
  color: var(--bg);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transform: scale(0.96);
  cursor: not-allowed;
  letter-spacing: 0.18em;
  font-size: 1.2rem;
}

.spin-btn[data-state="warn"] {
  background: var(--warn);
  color: var(--cream);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* ── 결과 카드 ───────────────────────────────────────── */
@keyframes stampIn {
  0%   { transform: scale(0.6) rotate(-4deg); opacity: 0; }
  65%  { transform: scale(1.06) rotate(1deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg);    opacity: 1; }
}

.result-card {
  position: relative;
  background: var(--surface);
  border: 3px dashed var(--accent);
  padding: 2rem 1.75rem;
  text-align: center;
}

/* 코너 스테이플 마크 */
.result-card::before,
.result-card::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
}

.result-card::before {
  top: 8px; left: 8px;
  border-top: 3px solid var(--primary);
  border-left: 3px solid var(--primary);
}

.result-card::after {
  bottom: 8px; right: 8px;
  border-bottom: 3px solid var(--primary);
  border-right: 3px solid var(--primary);
}

.result-card.hidden {
  display: none;
}

.result-card.visible {
  display: block;
  animation: stampIn 0.45s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.result-stamp {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 0.15rem 0.6rem;
  transform: rotate(-2deg);
  margin-bottom: 1rem;
}

.result-emoji {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.result-name {
  font-family: var(--font-head);
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--cream);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.result-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-style: italic;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

/* 공유 버튼 (결과 카드) */
.btn-share {
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  background: #FEE500;
  color: #3A1D1D;
  font-weight: 700;
  border-radius: 0;
  transition: opacity var(--transition);
}
.btn-share:hover { opacity: 0.85; }

/* 공유 패널 드롭다운 */
.share-panel {
  position: relative;
  margin-top: 0.75rem;
}
.share-panel.hidden { display: none; }

.share-panel-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1rem;
}

.share-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 1.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  min-width: 72px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.share-option:hover {
  color: var(--cream);
  border-color: var(--accent);
  background: var(--surface-2);
}
.share-icon { font-size: 1.5rem; }

.share-copied {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--accent);
  text-align: center;
}
.share-copied.hidden { display: none; }

/* 구 btn-kakao 스타일 유지 (혹시 참조 시) */
.btn-kakao {
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  background: #FEE500;
  color: #3A1D1D;
  font-weight: 700;
  border-radius: 0;
  transition: opacity var(--transition);
}

.btn-kakao:hover {
  opacity: 0.85;
}

.btn-retry {
  padding: 0.65rem 1.4rem;
  font-size: 0.9rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: color var(--transition), border-color var(--transition);
}

.btn-retry:hover {
  color: var(--cream);
  border-color: var(--cream);
}

/* AdSense 슬롯 (결과 하단) */
.ad-slot {
  margin-top: 1.5rem;
  min-height: 0;
}

.ad-result {
  text-align: center;
}

/* ── 최근 메뉴 ───────────────────────────────────────── */
.recent-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.recent-title {
  font-family: var(--font-head);
  font-size: 0.95rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.recent-hint {
  font-size: 0.78rem;
  font-family: var(--font-body);
  color: var(--border);
  font-weight: 400;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-left: 3px solid var(--border);
}

.recent-emoji {
  font-size: 1.2rem;
}

.recent-name {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.recent-delete {
  font-size: 0.75rem;
  color: var(--border);
  padding: 0.2rem 0.4rem;
  transition: color var(--transition);
}

.recent-delete:hover {
  color: var(--primary);
}

.recent-empty {
  font-size: 0.85rem;
  color: var(--border);
  padding: 0.5rem 0;
}

/* ── 푸터 ────────────────────────────────────────────── */
.site-footer {
  border-top: 2px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 1.5rem;
  text-align: center;
}

.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.75rem;
}

.footer-nav a {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-nav a:hover {
  color: var(--cream);
  opacity: 1;
}

.footer-copy {
  font-size: 0.76rem;
  color: var(--border);
}

/* ═══════════════════════════════════════════════════════
   보조 페이지 공통 레이아웃
   ═══════════════════════════════════════════════════════ */
.page-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.page-wrap h1 {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--cream);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.page-wrap h2 {
  font-family: var(--font-head);
  font-size: 1.25rem;
  color: var(--accent);
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.02em;
}

.page-wrap h3 {
  font-size: 1rem;
  color: var(--cream);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.page-wrap p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.page-wrap ul,
.page-wrap ol {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.page-wrap ol {
  list-style: decimal;
}

.page-wrap li {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 0.35rem;
}

.page-wrap a {
  text-decoration: underline;
}

.page-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* 연락처 강조 */
.contact-email {
  display: inline-block;
  font-size: 1.1rem;
  color: var(--primary);
  font-weight: 700;
  margin: 0.75rem 0;
}

/* ── 모바일 미세 조정 ─────────────────────────────────── */
@media (max-width: 480px) {
  .site-header {
    padding: 0.85rem 1rem;
  }

  .logo-main {
    font-size: 1.3rem;
  }

  .spin-btn {
    font-size: 1.5rem;
    padding: 0.75rem 2.5rem;
    min-width: 160px;
    min-height: 54px;
  }

  .result-name {
    font-size: 2rem;
  }

  .filter-row {
    flex-direction: column;
  }
}
