
:root {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-alt: #f4f2fe;
  --color-border: #e8e5f9;
  --color-text: #16162b;
  --color-muted: #6b6b85;
  --color-primary: #5b4fe8;
  --color-primary-dark: #4436c9;
  --color-primary-soft: #efedff;
  --color-accent: #ff5d8f;
  --color-accent-dark: #e8437a;
  --color-danger: #e11d48;
  --color-danger-soft: #ffe4ea;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 6px rgba(22, 22, 43, 0.08);
  --shadow-md: 0 14px 30px -10px rgba(91, 79, 232, 0.28);
  --shadow-lg: 0 28px 56px -18px rgba(91, 79, 232, 0.32);
  font-family: 'Inter', 'Pretendard Variable', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--color-primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--color-accent-dark); text-decoration: underline; }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 1.6rem; margin-top: 0; }
h2 { font-size: 1.2rem; }

.site-header {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.95rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand:hover { text-decoration: none; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.main-nav a { color: var(--color-muted); font-weight: 600; font-size: 0.95rem; }
.main-nav a:hover { color: var(--color-text); text-decoration: none; }

.nav-logout { display: inline; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: color 0.15s ease;
}
.link-button:hover { color: var(--color-text); text-decoration: none; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4.5rem;
}

.site-footer {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
  padding: 2.5rem 1rem;
}

/* === Landing page (src/routes/home.js) — Airbnb-style: plain background, ===
   === the search pill and card rows carry the page, color used sparingly === */
.landing-hero {
  text-align: center;
  padding: 2.75rem 1rem 1.25rem;
}
.landing-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 1.6rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  margin: 0 0 0.9rem;
}

.pill-search {
  display: flex;
  align-items: stretch;
  max-width: 700px;
  margin: 0 auto 0.9rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: 0 12px 32px -16px rgba(22, 22, 43, 0.22), var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.pill-search:focus-within { box-shadow: 0 16px 36px -14px rgba(22, 22, 43, 0.26), 0 0 0 2px var(--color-text); }
/* Used on /listings (routes/listings.js): the same search pill as the
   landing page, but left-aligned and full-width instead of centered — a
   results-page filter bar, not a hero centerpiece. */
.pill-search-compact { max-width: none; margin: 0 0 1.5rem; }
.pill-segment {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
  padding: 0.55rem 1.3rem;
  text-align: left;
}
.pill-segment-grow { flex: 1.6; }
.pill-label { font-size: 0.7rem; font-weight: 800; color: var(--color-text); }
.pill-segment select,
.pill-segment input {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
  width: 100%;
}
.pill-segment select:focus, .pill-segment input:focus { outline: none; box-shadow: none; }
.pill-divider { width: 1px; background: var(--color-border); margin: 0.55rem 0; flex-shrink: 0; }
.pill-search-submit {
  flex-shrink: 0;
  align-self: center;
  margin-right: 0.4rem;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 50%;
  padding: 0;
  font-size: 1.05rem;
  background: var(--color-accent);
  box-shadow: none;
}
.pill-search-submit:hover { background: var(--color-accent-dark); transform: scale(1.04); box-shadow: none; }
@media (max-width: 640px) {
  .pill-search { flex-wrap: wrap; border-radius: var(--radius-lg); }
  .pill-divider { display: none; }
  /* flex-basis, not just width — a bare width:100% on a flex item with
     flex:1/1.6 still lets it shrink to fit three-in-a-row instead of
     wrapping, which is what actually happened here before this fix. */
  .pill-segment { flex: 1 1 100%; width: 100%; border-bottom: 1px solid var(--color-border); }
  .pill-search-submit { margin: 0.6rem auto; }
}

.category-icons {
  overflow-x: auto;
  padding: 1.4rem 0.25rem 1.1rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: none;
}
.category-icons::-webkit-scrollbar { display: none; }
/* Centers the row when it's narrower than the viewport (desktop: all 10 fit)
   without the clipped-first-item bug that "justify-content: center" gets on
   an overflow-x:auto container once it's wide enough to need scrolling
   (mobile) — margin:auto on a max-content inner row just resolves to 0 in
   that case instead of hiding anything. */
.category-icons-track {
  display: flex;
  gap: 1.9rem;
  width: max-content;
  margin: 0 auto;
}
.category-icon-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid transparent;
  opacity: 0.8;
}
.category-icon-item .category-icon { font-size: 1.4rem; }
.category-icon-item:hover { color: var(--color-text); text-decoration: none; opacity: 1; border-color: var(--color-border); }

.card-section { margin: 2.25rem 0; }
.card-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-section-head h2 { font-size: 1.2rem; margin: 0; }
.card-section-head a { font-size: 0.85rem; font-weight: 700; flex-shrink: 0; }
.card-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 0.4rem;
  margin: 0 -0.1rem;
  scrollbar-width: none;
}
.card-row::-webkit-scrollbar { display: none; }
.card-row .listing-card { flex: 0 0 210px; scroll-snap-align: start; }

.landing-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  margin: 2.5rem 0;
}
.landing-banner h2 { margin: 0.25rem 0 0; font-size: 1.3rem; }
.promo-eyebrow { font-weight: 700; color: var(--color-accent-dark); margin: 0; font-size: 0.9rem; }

.uni-strip {
  margin: 2.5rem 0;
  padding: 1.6rem 0 1.75rem;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.uni-strip-head { padding: 0 1.75rem; margin-bottom: 1.15rem; }
.uni-strip h2 { font-size: 1.2rem; margin: 0 0 0.25rem; }
.uni-strip-sub { margin: 0; color: var(--color-muted); font-size: 0.85rem; }
.uni-marquee {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent);
}
.uni-marquee::-webkit-scrollbar { display: none; }
.uni-track {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: max-content;
  animation: uni-scroll 80s linear infinite;
}
/* Travels left to right; the duplicated half makes the reset invisible. */
@keyframes uni-scroll {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}
/* Pausing on hover is what makes a moving tile clickable. */
.uni-marquee:hover .uni-track,
.uni-marquee:focus-within .uni-track { animation-play-state: paused; }

.uni-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.05rem 0.55rem 0.55rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.uni-item:hover,
.uni-item:focus-visible {
  text-decoration: none;
  color: var(--color-text);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}
.uni-item:hover .uni-mark { transform: scale(1.06); }
.uni-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1rem;
  transition: transform 0.18s ease;
}
.uni-mark-2 { font-size: 0.85rem; }
.uni-mark-3 { font-size: 0.7rem; }
.uni-mark-4 { font-size: 0.58rem; }

@media (max-width: 640px) {
  .uni-strip-head { padding: 0 1.25rem; }
  .uni-item { font-size: 0.76rem; padding: 0.45rem 0.9rem 0.45rem 0.45rem; }
  .uni-mark { width: 34px; height: 34px; font-size: 0.88rem; }
}
@media (prefers-reduced-motion: reduce) {
  .uni-track { animation: none; }
}

.trending-section { margin: 2.5rem 0; }
.trending-section h2 { font-size: 1.15rem; margin-bottom: 0.85rem; }
.trending-list {
  list-style: none;
  counter-reset: rank;
  padding: 0;
  margin: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.trending-list li {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
}
.trending-list li:last-child { border-bottom: none; }
.trending-list li:hover { background: var(--color-surface-alt); }
.trending-list li::before {
  content: counter(rank);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.8rem;
}
.trending-list a { color: var(--color-text); font-weight: 600; }
.trending-meta {
  margin-left: auto;
  color: var(--color-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

/* Also used by the tutor profile page's specialty tags (routes/tutors.js) —
   not landing-page-specific despite living in this section historically. */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.chip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.42rem 0.95rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.chip:hover {
  background: #ffe9f1;
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(201, 134, 44, 0.22);
}
textarea { resize: vertical; }

button, .button {
  display: inline-block;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.3rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
button:hover, .button:hover {
  background: linear-gradient(135deg, var(--color-accent-dark), var(--color-primary-dark));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: #fff;
}
button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  box-shadow: none;
}
button.secondary:hover { background: var(--color-surface-alt); color: var(--color-text); transform: none; box-shadow: none; }

.filter-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) {
  .filter-form { grid-template-columns: 1fr; }
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
}

.listing-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.listing-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.listing-card-link { display: block; color: inherit; }
.listing-card-link:hover { text-decoration: none; }
.listing-card-tutor { padding: 0 1rem 1.1rem; margin: -0.3rem 0 0; }
.listing-card-tutor a { color: var(--color-muted); font-weight: 600; }
.listing-card-tutor a:hover { color: var(--color-accent-dark); }

.listing-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: var(--color-surface-alt);
}
.listing-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.listing-card-body { padding: 1rem; }
.listing-card-body h3 { margin: 0.3rem 0; font-size: 1.05rem; }

.listing-detail-img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

/* Airbnb-style listing detail: description on the left, a sticky booking
   card on the right — instead of the booking form just sitting inline
   under the description (src/routes/listings.js). */
.listing-detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
  align-items: start;
}
.listing-detail { min-width: 0; }
.booking-panel { position: sticky; top: 5.5rem; }
.booking-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}
.booking-card-price { font-size: 1.4rem; margin: 0 0 1.1rem; }
.booking-card .button { width: 100%; }
@media (max-width: 860px) {
  .listing-detail-layout { grid-template-columns: 1fr; }
  .booking-panel { position: static; }
}

.badge {
  display: inline-block;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.price { font-weight: 800; }
.tutor-name { color: var(--color-muted); font-size: 0.9rem; }

.pagination {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.form-page {
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.stack-form fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}
.stack-form .radio { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 400; margin-right: 1rem; }

.budget-row { display: flex; align-items: center; gap: 0.5rem; }
.budget-row span { color: var(--color-muted); }

.error { color: var(--color-danger); font-weight: 600; }
.notice { color: var(--color-muted); font-style: italic; }
.success { color: #15803d; font-weight: 600; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-muted);
}

.inline-form { display: inline-block; margin-right: 0.5rem; }

.booking-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.65rem;
  color: var(--color-text);
  flex-wrap: wrap;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.booking-row:hover {
  border-color: var(--color-accent);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.booking-meta { color: var(--color-muted); font-size: 0.9rem; }

.status-requested { background: #fff2cf; color: #8a6100; }
.status-accepted { background: #dcfaec; color: #147a4a; }
.status-declined { background: var(--color-danger-soft); color: #c2185b; }
.status-cancelled { background: var(--color-surface-alt); color: var(--color-muted); }
.status-paid { background: #e2f4ff; color: #1a5fa0; }
.status-completed { background: var(--color-primary-soft); color: var(--color-primary-dark); }

.booking-detail dl { display: grid; grid-template-columns: 100px 1fr; gap: 0.5rem 1rem; }
.booking-detail dt { color: var(--color-muted); }
.actions { margin-top: 1.4rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }

.payment-page { max-width: 480px; margin: 0 auto; }
#payment-method, #agreement { margin: 1rem 0; }

.community-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1rem; }
.community-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.community-row:hover {
  border-color: var(--color-accent);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.community-meta { color: var(--color-muted); font-size: 0.85rem; margin-left: auto; }

/* --- ranked post feed: voting, sort tabs, hot-post spotlight -------------- */
/* (src/lib/postFeed.js, src/lib/ranking.js) */
.post-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.post-row:hover { border-color: var(--color-accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.post-row-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  color: var(--color-text);
}
.post-row-link:hover { text-decoration: none; }
.post-row-link strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vote-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  padding: 0.5rem 0.8rem;
  background: var(--color-surface-alt);
  flex-shrink: 0;
}
.vote-btn {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0.1rem;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.15s ease, transform 0.1s ease;
}
.vote-btn:hover { background: none; color: var(--color-text); transform: none; box-shadow: none; }
.vote-btn.vote-up.active { color: var(--color-accent); }
.vote-btn.vote-down.active { color: var(--color-primary); }
.vote-score { font-weight: 800; font-size: 0.88rem; min-width: 1.5em; text-align: center; }

.sort-tabs { display: flex; gap: 0.4rem; margin: 1.1rem 0 0.6rem; }
.sort-tab {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-muted);
  background: var(--color-surface-alt);
}
.sort-tab:hover { text-decoration: none; color: var(--color-text); }
.sort-tab.active { background: var(--color-primary); color: #fff; }

.hot-post-card {
  margin: 1rem 0 1.4rem;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--color-primary-soft), var(--color-surface) 60%);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hot-post-eyebrow {
  margin: 0;
  padding: 0.6rem 1.2rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--color-accent-dark);
}
.hot-post-main { display: flex; align-items: stretch; gap: 0; }
.hot-post-main .vote-widget { background: transparent; }
.hot-post-main > div { padding: 0 1.2rem 0.9rem 0; flex: 1; min-width: 0; }
.hot-post-main h2 { margin: 0.3rem 0 0.2rem; font-size: 1.15rem; }
.hot-post-main h2 a { color: var(--color-text); }
.hot-post-comments { border-top: 1px solid var(--color-border); padding: 0.9rem 1.2rem 1.1rem; background: var(--color-surface); }
.hot-post-comment { padding: 0.5rem 0; border-bottom: 1px dashed var(--color-border); font-size: 0.9rem; }
.hot-post-comment:last-of-type { border-bottom: none; }
.hot-post-comment strong { font-size: 0.85rem; }
.hot-post-comment p { margin: 0.15rem 0 0; color: var(--color-muted); }
.hot-post-more { display: inline-block; margin-top: 0.5rem; font-size: 0.85rem; font-weight: 700; }

.post-detail-head { display: flex; align-items: center; gap: 1rem; margin-top: 0.6rem; }
.post-detail-head .vote-widget { border-radius: var(--radius-sm); }
.post-detail-head h1 { margin: 0; }
.post-detail-head .tutor-name { margin: 0.2rem 0 0; }

.post-detail .content { margin-top: 1rem; white-space: pre-wrap; }
.comments { margin-top: 2rem; }
.comment { border-top: 1px solid var(--color-border); padding: 0.85rem 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-value {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-label { color: var(--color-muted); font-size: 0.85rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.admin-table th, .admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}
.admin-table th {
  background: var(--color-surface-alt);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-muted);
}
.admin-table tr:last-child td { border-bottom: none; }

.quick-links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }

.star-rating { color: var(--color-accent-dark); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }

.review-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-sm);
}
.review-card p { margin: 0.4rem 0; }

.tutor-profile { margin-bottom: 2rem; }

.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.profile-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--color-surface);
}
.profile-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  font-size: 2.2rem;
  font-weight: 800;
}
.profile-header-text { flex: 1; min-width: 220px; }
.profile-header-text h1 { margin-bottom: 0.3rem; }
.profile-headline { color: var(--color-text); font-weight: 600; font-size: 1.05rem; margin: 0 0 0.4rem; }
.profile-meta { color: var(--color-muted); font-size: 0.92rem; margin: 0 0 0.6rem; }
.profile-specialties { justify-content: flex-start; margin-bottom: 0; }
.profile-bio { margin-top: 1rem; white-space: pre-wrap; line-height: 1.75; }

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.section-heading-row h2 { margin: 0; }

.profile-credentials { margin: 2rem 0; }
.credential-group { margin-bottom: 1.5rem; }
.credential-group h3 { font-size: 1rem; color: var(--color-muted); margin: 0 0 0.6rem; }
.credential-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.credential-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.credential-main {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.credential-org { color: var(--color-muted); }
.credential-period { color: var(--color-muted); font-size: 0.85rem; margin-left: auto; white-space: nowrap; }
.credential-desc { margin: 0.4rem 0 0; color: var(--color-text); }
.credential-item .link-button { font-size: 0.82rem; color: var(--color-muted); margin-top: 0.4rem; }
.credential-item .link-button:hover { color: var(--color-danger); }

.stack-form .checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: 400;
  font-size: 0.9rem;
}
.checkbox-row input[type="checkbox"] { width: auto; margin-top: 0.2rem; }

.legal-page { max-width: 720px; margin: 0 auto; line-height: 1.75; }
.legal-page h2 { margin-top: 1.75rem; }
.legal-page .notice { display: block; margin-bottom: 1.5rem; }

.message-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
}
.message-row { gap: 0.85rem; }
.message-row-body { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; min-width: 0; }
.message-preview {
  color: var(--color-muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  margin-left: 0.3rem;
  vertical-align: middle;
}

.chat-page {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--color-border);
}
.chat-header h1 { font-size: 1.1rem; margin: 0; }
.chat-header .profile-headline { font-size: 0.85rem; margin: 0.15rem 0 0; }
.chat-header .notice { margin: 0.15rem 0 0; }
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  min-height: 320px;
  max-height: 55vh;
  overflow-y: auto;
  background: var(--color-bg);
}
.chat-bubble-row { display: flex; flex-direction: column; max-width: 78%; }
.chat-bubble-row.mine { align-self: flex-end; align-items: flex-end; }
.chat-bubble-row.theirs { align-self: flex-start; align-items: flex-start; }
.chat-bubble {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.chat-bubble-row.mine .chat-bubble {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble-row.theirs .chat-bubble {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}
.chat-bubble-time { font-size: 0.72rem; color: var(--color-muted); margin-top: 0.2rem; }
.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border);
}
.chat-input-row input { flex: 1; }
.chat-status { text-align: center; font-size: 0.8rem; padding: 0 1.25rem 0.75rem; margin: 0; }

/* --- floating 관리자 문의 widget (src/lib/supportWidget.js) --------------- */
/* These all set an explicit display, which beats the browser's built-in
   [hidden] rule — without this the panel and the unread badge would render
   permanently instead of only when opened. */
.support-widget[hidden],
.support-panel[hidden],
.support-badge[hidden] { display: none; }

.support-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.7rem;
}
.support-launcher {
  height: 56px;
  padding: 0 1.25rem 0 1.05rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 38px -12px rgba(22, 22, 43, 0.45), 0 4px 12px rgba(22, 22, 43, 0.18);
}
.support-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 46px -12px rgba(22, 22, 43, 0.5), 0 6px 14px rgba(22, 22, 43, 0.2);
}
.support-launcher-icon { display: flex; align-items: center; }
.support-launcher-label { white-space: nowrap; }
/* One quiet ring that draws the eye on arrival, then gets out of the way. */
.support-launcher::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  border: 2px solid var(--color-accent);
  opacity: 0;
  pointer-events: none;
  animation: support-launcher-ring 2.4s ease-out 3;
}
@keyframes support-launcher-ring {
  0% { transform: scale(0.94); opacity: 0.75; }
  70% { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .support-launcher::before { animation: none; }
  .support-launcher:hover { transform: none; }
}
.support-badge {
  position: absolute;
  top: -7px;
  right: -5px;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.support-panel {
  width: min(360px, calc(100vw - 2.5rem));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
}
.support-header-text { display: flex; flex-direction: column; }
.support-header-text strong { font-size: 0.95rem; }
.support-header-text span { font-size: 0.76rem; opacity: 0.85; }
.support-close {
  background: transparent;
  box-shadow: none;
  padding: 0.1rem 0.4rem;
  font-size: 1rem;
  line-height: 1;
}
.support-close:hover { background: rgba(255, 255, 255, 0.18); transform: none; box-shadow: none; }
.support-log {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  height: 320px;
  max-height: 46vh;
  overflow-y: auto;
  background: var(--color-bg);
}
.support-empty {
  margin: auto 0;
  text-align: center;
  font-size: 0.84rem;
  color: var(--color-muted);
  line-height: 1.5;
}
.support-bubble-row { display: flex; flex-direction: column; max-width: 84%; }
.support-bubble-row.mine { align-self: flex-end; align-items: flex-end; }
.support-bubble-row.theirs { align-self: flex-start; align-items: flex-start; }
.support-bubble {
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.89rem;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
}
.support-bubble-row.mine .support-bubble {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.support-bubble-row.theirs .support-bubble {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}
.support-bubble-who { font-size: 0.7rem; font-weight: 700; color: var(--color-primary); margin-bottom: 0.15rem; }
.support-bubble-time { font-size: 0.68rem; color: var(--color-muted); margin-top: 0.15rem; }
.support-input-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem;
  border-top: 1px solid var(--color-border);
}
.support-input-row input { flex: 1; padding: 0.55rem 0.75rem; }
.support-input-row button { padding: 0.55rem 0.95rem; }
.support-status {
  margin: 0;
  padding: 0 0.75rem 0.6rem;
  min-height: 1rem;
  text-align: center;
  font-size: 0.74rem;
  color: var(--color-muted);
}
.support-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.5rem;
  max-height: 46vh;
  overflow-y: auto;
  background: var(--color-bg);
}
.support-admin-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem;
  border-radius: var(--radius);
  color: var(--color-text);
}
.support-admin-row:hover { background: var(--color-surface-alt); text-decoration: none; color: var(--color-text); }
.support-admin-row .message-avatar { width: 34px; height: 34px; font-size: 0.95rem; }
.support-admin-row-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.support-admin-row-body strong { font-size: 0.88rem; }
.support-admin-row-meta { font-size: 0.76rem; color: var(--color-muted); }
.support-admin-all {
  display: block;
  padding: 0.7rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
}
.support-count {
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-count[hidden] { display: none; }
.support-status-chip {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: middle;
}
.support-status-chip.closed { background: var(--color-surface-alt); color: var(--color-muted); }
.support-inbox-row { align-items: center; }

/* --- topic communities (src/routes/communities.js) ------------------------ */
.community-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.community-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.2rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.community-card:hover {
  border-color: var(--color-accent);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.community-card h3 { margin: 0 0 0.35rem; font-size: 1.02rem; }
.community-card .notice {
  font-style: normal;
  font-size: 0.86rem;
  margin: 0 0 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.community-card-meta { color: var(--color-muted); font-size: 0.78rem; }

.community-header {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.community-header h1 { margin-bottom: 0.3rem; }
a.badge:hover { text-decoration: none; background: var(--color-primary); color: #fff; }

.support-guest { padding: 1.35rem 1.25rem 1.5rem; background: var(--color-bg); }
.support-guest-title { margin: 0 0 0.4rem; font-weight: 800; font-size: 1rem; }
.support-guest-text { margin: 0 0 1.1rem; font-size: 0.86rem; color: var(--color-muted); }
.support-guest-actions { display: flex; gap: 0.5rem; }
.support-guest-actions .button { flex: 1; padding: 0.6rem 0.8rem; font-size: 0.9rem; }

@media (max-width: 640px) {
  .support-widget { right: 0.85rem; bottom: 0.85rem; }
  .support-panel { width: calc(100vw - 1.7rem); }
  .support-log, .support-admin-list { max-height: 55vh; }
}
/* Only the very narrowest phones drop the label — at 375px (the common
   iPhone width) the labelled pill still fits comfortably. */
@media (max-width: 340px) {
  .support-launcher { padding: 0; width: 56px; justify-content: center; }
  .support-launcher-label { display: none; }
}

/* --- AI listing search (src/routes/aiSearch.js) --------------------------- */
.ai-search-cta {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0.85rem 0 0;
}
.ai-search-cta a { color: inherit; }

.ai-search-page { max-width: 720px; margin: 0 auto; }
.ai-search-page textarea {
  resize: vertical;
  min-height: 5rem;
}
#ai-search-status { min-height: 1.4rem; }
.ai-match-card { position: relative; }
.ai-reason {
  margin: 0;
  padding: 0.6rem 1rem 1rem;
  font-size: 0.85rem;
  color: var(--color-primary-dark);
  background: var(--color-primary-soft);
  border-top: 1px solid var(--color-border);
}
