/* ═══════════════════════════════════════════════════════════
   말빛 파인더 (Malbit Finder) — 사전 화면 스타일
   DESIGN SYSTEM : 한지(韓紙) × 먹빛 — Hanji & Ink, refined
   © 말빛 Kedu (Malbit Kedu)
═══════════════════════════════════════════════════════════ */

:root {
  /* ── 지면(紙) ── */
  --paper: #faf7f1;
  --paper2: #f2ede3;
  --paper3: #ebe4d7;
  --card: #fffdfa;
  --white: #ffffff;

  /* ── 먹(墨) ── */
  --ink: #181310;
  --ink2: #453c33;
  --ink3: #6f645a;
  --muted: #a2988a;
  --line: #e4dccf;
  --line2: #d6cbb8;

  /* ── 오방 강조색 ── */
  --accent: #b2452f; /* 붉은먹 — 브랜드 / 속담·관용구 */
  --accent-s: #f8ece8;
  --accent-d: #8c3020;
  --gold: #9a7420; /* 금  — TOPIK */
  --gold-s: #faf2df;
  --jade: #3f6b4a; /* 옥  — 문법·표현 */
  --jade-s: #eaf2ec;
  --indigo: #33557f; /* 남  — 복합 명사 */
  --indigo-s: #e9eff7;

  --danger: #b2452f;
  --success: #3f6b4a;

  /* ── 하위 호환 별칭 (기존 인라인 style 유지용) ── */
  --primary: #b2452f;
  --border: #e4dccf;
  --accent2: #9a7420;
  --accent3: #33557f;
  --accent4: #3f6b4a;

  /* ── 형태 ── */
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 15px;
  --shadow-1: 0 2px 10px rgba(24, 19, 16, 0.05);
  --shadow-2: 0 4px 18px rgba(24, 19, 16, 0.07);
  --shadow-3: 0 10px 34px rgba(24, 19, 16, 0.13);

  --serif: "Noto Serif KR", serif;
  --sans: "Noto Sans KR", sans-serif;
}

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

html {
  height: 100%;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  background:
    radial-gradient(
      110% 60% at 50% 0%,
      rgba(178, 69, 47, 0.05) 0%,
      rgba(178, 69, 47, 0) 58%
    ),
    var(--paper);
  color: var(--ink);
  line-height: 1.65;
}

::selection {
  background: rgba(178, 69, 47, 0.16);
}

/* 스크롤바 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ─────────────────────────────────────────
   알림 메시지
───────────────────────────────────────── */
#messageBox {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 22px;
  border-radius: 99px;
  z-index: 10050;
  display: none;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  box-shadow: var(--shadow-3);
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
#messageBox.show {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#messageBox.green {
  background: var(--jade);
}

/* ─────────────────────────────────────────
   메인 래퍼
───────────────────────────────────────── */
.main-wrap {
  flex: 1;
  max-width: 940px;
  width: 100%;
  margin: 0 auto;
  padding: 26px 20px 44px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ─────────────────────────────────────────
   헤더 카드
───────────────────────────────────────── */
.dict-header {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 22px 20px;
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.dict-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    #d4863c 42%,
    var(--gold) 72%,
    var(--jade) 100%
  );
  opacity: 0.9;
}

/* ── 타이틀 바 (사전 · 대시보드 공통) ── */
.page-title-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  margin-bottom: 16px;
}
.dict-header > .page-title-bar:last-child {
  margin-bottom: 0;
}

.dict-title-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  text-decoration: none;
}

/* 로고 — 프레임 없는 스파크 심볼 */
.dict-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 5px rgba(224, 176, 70, 0.35));
}

.dict-title-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-heading,
.dict-title-text {
  font-family: var(--serif);
  font-size: clamp(17px, 3.6vw, 25px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* '빛' 한 글자에 빛 그라데이션 */
.title-glow {
  background: linear-gradient(100deg, #b2452f 8%, #d4863c 55%, #9a7420 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.dict-title-sub {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  text-transform: uppercase;
  margin-top: -1px;
}

/* ── 사전 ⇄ 대시보드 이동 버튼 ── */
.nav-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--paper2);
  color: var(--ink3);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-pill-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(24, 19, 16, 0.18);
}
.nav-pill-btn.pull-right {
  margin-left: auto;
}

@media (max-width: 620px) {
  .page-title-bar {
    gap: 9px;
  }
  .dict-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }
  .dict-title-sub {
    display: none;
  }
  .nav-pill-btn {
    padding: 7px 13px;
    font-size: 12px;
    gap: 5px;
  }
}

/* ─────────────────────────────────────────
   검색 폼
───────────────────────────────────────── */
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lang-select {
  flex-shrink: 0;
  height: 46px;
  padding: 0 34px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper2);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f645a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 14px;
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink2);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.18s;
  max-width: 190px;
}
.lang-select:hover {
  border-color: var(--line2);
}
.lang-select:focus {
  border-color: var(--accent);
  background-color: var(--white);
  box-shadow: 0 0 0 3px rgba(178, 69, 47, 0.1);
}

.search-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: all 0.18s;
}
.search-input:hover {
  border-color: var(--line2);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(178, 69, 47, 0.1);
}
.search-input::placeholder {
  color: var(--muted);
  font-size: 13px;
}

.search-btn {
  flex-shrink: 0;
  height: 46px;
  padding: 0 28px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(24, 19, 16, 0.2);
}
.search-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-d));
  transform: translateX(-101%);
  transition: transform 0.28s ease;
}
.search-btn:hover::before {
  transform: translateX(0);
}
.search-btn:hover {
  box-shadow: 0 6px 20px rgba(178, 69, 47, 0.34);
  transform: translateY(-1px);
}
.search-btn:active {
  transform: translateY(0);
}
.search-btn span {
  position: relative;
  z-index: 1;
}

@media (max-width: 620px) {
  .search-form {
    flex-direction: column;
    align-items: stretch;
  }
  .lang-select,
  .search-input,
  .search-btn {
    width: 100%;
    max-width: none;
  }
  .search-btn {
    text-align: center;
  }
}

/* ─────────────────────────────────────────
   문장 분석 결과 (번역 바)
───────────────────────────────────────── */
#sentence_result:empty {
  display: none;
}
#sentence_result .corrected-box {
  background: linear-gradient(
    100deg,
    var(--accent-s) 0%,
    rgba(248, 236, 232, 0.32) 100%
  );
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 13px 18px;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.8;
}
.corrected-box strong {
  color: var(--accent);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  margin-right: 6px;
}
#current_sentence_val {
  color: var(--ink);
  font-weight: 500;
}

/* ─────────────────────────────────────────
   안내 텍스트
───────────────────────────────────────── */
.guide-text {
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  color: var(--muted);
  font-family: var(--sans);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.guide-text::before,
.guide-text::after {
  content: "";
  width: 34px;
  height: 1px;
  background: var(--line2);
}

/* ─────────────────────────────────────────
   형태소 버튼 영역
───────────────────────────────────────── */
#button_container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}
#button_container:empty {
  display: none;
}

.morpheme-button {
  padding: 8px 16px;
  background: var(--card);
  color: var(--ink2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(24, 19, 16, 0.04);
  line-height: 1.5;
}
.morpheme-button:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(24, 19, 16, 0.22);
}
.morpheme-button:active {
  transform: translateY(0);
}

/* ─────────────────────────────────────────
   4갈래 특별 버튼 영역
───────────────────────────────────────── */
.special-buttons-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: stretch;
}

.special-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 12px 16px;
  box-shadow: var(--shadow-1);
  min-height: 108px;
  transition:
    box-shadow 0.2s,
    border-color 0.2s;
}
.special-section:hover {
  box-shadow: var(--shadow-2);
}

.special-label {
  width: 100%;
  text-align: center;
  font-size: 12.5px;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.01em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.special-button-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.empty-msg {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  opacity: 0.75;
}

.badge-count {
  font-size: 0.8em;
  opacity: 0.72;
  margin-left: 3px;
  font-weight: 600;
}

.btn-idiom,
.btn-topik,
.btn-phrase,
.btn-grammar {
  padding: 6px 13px;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid;
  line-height: 1.55;
}
.btn-idiom:hover,
.btn-topik:hover,
.btn-phrase:hover,
.btn-grammar:hover {
  transform: translateY(-2px);
  color: var(--white);
}

/* 문법·표현 — 옥(玉) */
.btn-grammar {
  border-color: #bcd0c1;
  color: #33583e;
  background: var(--jade-s);
}
.btn-grammar:hover {
  background: var(--jade);
  border-color: var(--jade);
  box-shadow: 0 5px 14px rgba(63, 107, 74, 0.3);
}

/* 복합 명사 — 남(藍) */
.btn-phrase {
  border-color: #c3d3e6;
  color: #2c4c74;
  background: var(--indigo-s);
}
.btn-phrase:hover {
  background: var(--indigo);
  border-color: var(--indigo);
  box-shadow: 0 5px 14px rgba(51, 85, 127, 0.3);
}

/* 속담·관용구 — 붉은먹 */
.btn-idiom {
  border-color: #e6c4bb;
  color: #9c3a26;
  background: var(--accent-s);
}
.btn-idiom:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 5px 14px rgba(178, 69, 47, 0.3);
}

/* TOPIK — 금(金) */
.btn-topik {
  border-color: #e0cfa4;
  color: #856219;
  background: var(--gold-s);
}
.btn-topik:hover {
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 5px 14px rgba(154, 116, 32, 0.3);
}

/* ─────────────────────────────────────────
   로딩 스피너
───────────────────────────────────────── */
.spinner {
  display: none;
  margin: 18px auto;
  border: 3px solid rgba(24, 19, 16, 0.09);
  border-left-color: var(--accent);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 0.85s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─────────────────────────────────────────
   안내 모달
───────────────────────────────────────── */
.guide-modal {
  position: fixed;
  inset: 0;
  background: rgba(24, 19, 16, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.guide-modal.show {
  opacity: 1;
  pointer-events: auto;
}
.guide-modal-content {
  position: relative;
  background: var(--card);
  padding: 34px 32px 28px;
  border-radius: 18px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(24, 19, 16, 0.3);
  max-width: 520px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  transform: translateY(18px) scale(0.985);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.guide-modal-content::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(
    90deg,
    var(--accent),
    #d4863c 45%,
    var(--gold) 72%,
    var(--jade)
  );
}
.guide-modal.show .guide-modal-content {
  transform: translateY(0) scale(1);
}
.guide-modal-title {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.guide-modal-text {
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.85;
  margin-bottom: 24px;
  text-align: left;
  background: var(--paper2);
  padding: 20px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.guide-modal-text strong {
  color: var(--ink);
  font-weight: 700;
}
.btn-guide-close {
  background: var(--ink);
  color: var(--paper);
  padding: 13px 42px;
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(24, 19, 16, 0.2);
}
.btn-guide-close:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(178, 69, 47, 0.32);
}

/* ── 이름 입력 시작 화면 (이름이 없을 때만 표시) ── */
.name-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(24, 19, 16, 0.5);
  backdrop-filter: blur(4px);
}
.name-gate.show {
  display: flex;
}
.name-gate-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(24, 19, 16, 0.28);
}
.name-gate-icon {
  font-size: 34px;
  margin-bottom: 10px;
}
.name-gate-title {
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.name-gate-desc {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink3);
  margin-bottom: 20px;
}
.name-gate-input {
  width: 100%;
  padding: 13px 15px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line2);
  border-radius: var(--r-md);
  outline: none;
  margin-bottom: 16px;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}
.name-gate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(178, 69, 47, 0.14);
}
.name-gate-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 14px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.name-gate-btn:hover {
  background: var(--accent-d);
  transform: translateY(-1px);
}

/* ─────────────────────────────────────────
   결과 표시 영역
───────────────────────────────────────── */
#result_display_hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink3);
  background: var(--gold-s);
  border: 1px solid #ecdcb8;
  border-radius: var(--r-md);
  padding: 10px 14px;
  line-height: 1.7;
}

#result_display {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  min-height: 210px;
  overflow-y: auto;
  box-shadow: var(--shadow-1);
}
#result_display:empty::before {
  content: "검색한 어휘의 뜻풀이가 이곳에 나타납니다. · Word details appear here.";
  display: block;
  padding: 62px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ── 표제어 카드 ── */
.entry-box {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: inset 0 1px 3px rgba(24, 19, 16, 0.03);
  margin-bottom: 16px;
}
.entry-box:last-child {
  margin-bottom: 0;
}
.entry-box.border-amber-300,
.entry-box[class*="amber"] {
  background: linear-gradient(180deg, var(--gold-s), var(--paper) 42%);
  border-color: #ecdcb8;
}
.entry-box.border-indigo-300,
.entry-box[class*="indigo"] {
  background: linear-gradient(180deg, var(--indigo-s), var(--paper) 42%);
  border-color: #d3dfee;
}

/* 표제어 줄 */
.entry-box > p:first-child {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
  font-family: var(--serif);
  line-height: 1.7;
}

/* 표제어 글자 자체 */
.entry-box > p:first-child .text-indigo-700,
.entry-box > p:first-child .text-amber-700,
.entry-box > p:first-child .text-blue-700 {
  font-family: var(--serif) !important;
  font-size: 23px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  letter-spacing: -0.025em;
}

/* 발음 */
.entry-box > p:first-child .text-gray-600 {
  color: var(--ink3) !important;
  font-weight: 400 !important;
  font-size: 14px !important;
}
.speak-pronunciation-btn {
  color: var(--accent) !important;
  cursor: pointer;
  margin-left: 5px;
  transition:
    transform 0.15s,
    color 0.15s;
}
.speak-pronunciation-btn:hover {
  transform: scale(1.16);
  color: var(--accent-d) !important;
}

/* 품사·난이도·출처 배지화 */
.entry-box > p:first-child > span.text-sm,
.entry-box > p:first-child > span.text-xs {
  display: inline-block;
  border-radius: 6px;
  padding: 3px 9px !important;
  font-family: var(--sans) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em;
  line-height: 1.6 !important;
  margin-left: 0 !important;
  white-space: nowrap;
}
.entry-box > p:first-child > span.text-sm {
  background: var(--indigo-s);
  color: #2c4c74 !important;
  border: 1px solid #c3d3e6;
}
.entry-box > p:first-child > span.text-gray-400 {
  background: var(--gold-s);
  color: #856219 !important;
  border: 1px solid #e0cfa4;
}
.entry-box > p:first-child > span.source-label {
  background: var(--paper2) !important;
  color: var(--muted) !important;
  border: 1px solid var(--line);
}

/* 저장하기 버튼 */
.save-history-btn {
  margin-left: auto !important;
  background: var(--accent);
  color: #fff !important;
  border: none !important;
  border-radius: var(--r-sm) !important;
  padding: 8px 15px !important;
  font-family: var(--sans) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(178, 69, 47, 0.26);
  transition: all 0.18s;
}
.save-history-btn:hover {
  background: var(--accent-d);
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(178, 69, 47, 0.34);
}

/* 구분선 */
.divider {
  border: none;
  border-top: 1px dashed var(--line2);
  margin: 14px 0 4px;
}

/* 의미 라벨 */
.sense-item {
  display: flex;
  align-items: flex-start;
  margin: 16px 0 7px;
  gap: 6px;
}
.sense-item strong {
  font-family: var(--sans) !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  color: var(--accent) !important;
  letter-spacing: 0.01em;
  flex-shrink: 0;
  line-height: 1.7;
}

/* 뜻풀이·예문 줄 */
.translation-item {
  margin-left: 4px;
  margin-bottom: 6px;
  padding-left: 14px;
  border-left: 2px solid var(--paper3);
}
.translation-item:hover {
  border-left-color: var(--line2);
}

.sense-item a,
.translation-item a,
#result_display a {
  display: inline !important;
  white-space: nowrap;
  font-size: 13px;
  color: var(--gold);
  text-decoration: none;
  margin-left: 6px;
  font-family: var(--sans);
}
#result_display a:hover {
  text-decoration: underline;
  color: var(--accent);
}

.sense-item br,
.translation-item br {
  display: none;
}

/* 인라인 번역 버튼 */
.translation-item button.translate-inline-btn,
button.translate-inline-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--gold);
  background: var(--gold-s);
  border: 1px solid #ecdcb8;
  padding: 2px 9px;
  margin-left: 7px;
  cursor: pointer;
  font-family: var(--sans);
  border-radius: 6px;
  vertical-align: 2px;
  transition: all 0.16s;
}
button.translate-inline-btn:hover:not(:disabled) {
  color: #fff;
  background: var(--gold);
  border-color: var(--gold);
}
button.translate-inline-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.translated-text-box {
  margin-top: 7px;
  padding: 9px 13px;
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.75;
}

/* 결과 없음 / 오류 */
.no-result {
  text-align: center;
  padding: 44px 20px;
  font-size: 14px;
  color: var(--ink3);
  background: var(--paper2);
  border: 1px dashed var(--line2);
  border-radius: var(--r-md);
  line-height: 1.8;
}
.text-gray-500 {
  color: var(--muted) !important;
}
.text-red-500 {
  color: var(--danger) !important;
}

/* 결과 영역 공통 타이포 */
#result_display p,
#result_display span,
#result_display li,
#result_display div {
  font-size: 13.5px !important;
  font-family: var(--sans) !important;
  line-height: 1.8 !important;
  color: var(--ink2);
}
.entry-box > p:first-child,
.entry-box > p:first-child span {
  font-size: 15px !important;
  font-family: var(--serif) !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
}
.entry-box > p:first-child span.source-label {
  color: var(--muted) !important;
}
#result_display strong {
  font-size: inherit !important;
  font-family: var(--sans) !important;
  font-weight: 600 !important;
  color: var(--ink2) !important;
}

/* ─────────────────────────────────────────
   푸터
───────────────────────────────────────── */
footer {
  position: relative;
  background: var(--ink);
  text-align: center;
  padding: 34px 18px 30px;
  font-size: 12.5px;
  font-family: var(--sans);
  color: rgba(250, 247, 241, 0.48);
  letter-spacing: 0.01em;
  line-height: 1.9;
}
footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--accent),
    #d4863c 45%,
    var(--gold) 72%,
    var(--jade)
  );
  opacity: 0.65;
}
footer a {
  color: rgba(250, 247, 241, 0.7);
  text-decoration: none;
}
footer a:hover {
  color: var(--paper);
}
.footer-brand {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: rgba(250, 247, 241, 0.9);
  letter-spacing: -0.01em;
  margin-bottom: 3px;
  display: block;
}
.footer-brand em {
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: rgba(250, 247, 241, 0.38);
  margin-left: 8px;
  text-transform: uppercase;
}
.footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-meta s {
  text-decoration: none;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(250, 247, 241, 0.25);
}

/* 대시보드 버튼 (푸터) */
.btn-dashboard-home {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-d));
  color: #fff !important;
  padding: 13px 30px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 99px;
  text-decoration: none;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 6px 20px rgba(178, 69, 47, 0.34);
}
.btn-dashboard-home:hover {
  background: var(--paper);
  color: var(--ink) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(250, 247, 241, 0.22);
}
.btn-dashboard-home i {
  font-size: 15px;
}

/* ─────────────────────────────────────────
   위로 가기 버튼
───────────────────────────────────────── */
#back-to-top {
  position: fixed;
  right: 26px;
  bottom: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(24, 19, 16, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.3s ease,
    background 0.2s;
  z-index: 999;
}
#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#back-to-top:hover {
  background: var(--accent);
  box-shadow: 0 8px 24px rgba(178, 69, 47, 0.42);
  transform: translateY(-3px);
}
#back-to-top svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#back-to-top::after {
  content: "맨 위로";
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  padding: 5px 11px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#back-to-top:hover::after {
  opacity: 1;
}

/* ─────────────────────────────────────────
   반응형
───────────────────────────────────────── */
@media (max-width: 860px) {
  .special-buttons-container {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 470px) {
  .main-wrap {
    padding: 18px 14px 34px;
  }
  .dict-header {
    padding: 15px 16px 17px;
  }
  .special-buttons-container {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .special-section {
    min-height: 0;
  }
  #result_display {
    padding: 16px 15px;
  }
  .entry-box {
    padding: 16px 15px;
  }
  .entry-box > p:first-child .text-indigo-700,
  .entry-box > p:first-child .text-amber-700,
  .entry-box > p:first-child .text-blue-700 {
    font-size: 20px !important;
  }
  .save-history-btn {
    margin-left: 0 !important;
  }
  .guide-modal-content {
    padding: 26px 20px 22px;
  }
  #back-to-top {
    right: 16px;
    bottom: 20px;
    width: 42px;
    height: 42px;
  }
}

/* 모션 최소화 선호 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
