:root {
  --nd-navy: #192b59;
  --nd-navy-dark: #122044;
  --nd-green: #03c75a;
  --nd-blue-link: #0046a8;
  --nd-blue-accent: #2557d6;
  --nd-bg: #f4f6f8;
  --nd-surface: #ffffff;
  --nd-border: #e3e6eb;
  --nd-divider: #edf0f4;
  --nd-text: #222222;
  --nd-sub: #666666;
  --nd-muted: #888888;
}

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

body {
  font-family: "Pretendard Variable", Pretendard, "Malgun Gothic", -apple-system, sans-serif;
  background: var(--nd-bg);
  color: var(--nd-text);
  line-height: 1.55;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.nd-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Naver Dict Top Header */
.nd-header {
  background: var(--nd-navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.nd-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  padding-bottom: 10px;
}

.nd-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
}

.nd-logo-box {
  width: 24px;
  height: 24px;
  background: var(--nd-green);
  color: #fff;
  font-weight: 900;
  font-size: 0.86rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nd-service-sub {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 500;
}

.nd-service-title {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nd-top-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
}

.nd-top-meta strong {
  color: #fff;
}

.nd-voice-switch {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
}

.nd-voice-opt {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.nd-voice-opt.active {
  background: #fff;
  color: var(--nd-navy);
  font-weight: 800;
}

.nd-detail-pron-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nd-pron-mini.playing,
.nd-pron-btn.playing {
  background: #e8f0fe;
  border-color: var(--nd-blue-accent);
  color: var(--nd-blue-accent);
}

/* Search Bar inside Navy Header */
.nd-search-wrap {
  padding-bottom: 18px;
}

.nd-search-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  height: 48px;
  padding: 0 6px 0 16px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.14);
}

#searchInput {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.03rem;
  font-weight: 500;
  color: var(--nd-text);
  font-family: inherit;
  background: transparent;
}

#searchInput::placeholder {
  color: #9aa1ad;
  font-weight: 400;
}

.nd-clear-btn {
  background: #e9ecf2;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.72rem;
  color: #555;
  cursor: pointer;
  margin-right: 6px;
}

.nd-search-btn {
  width: 40px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--nd-navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nd-search-btn svg {
  width: 21px;
  height: 21px;
}

/* White Sub-Nav Category Bar */
.nd-lnb {
  background: #fff;
  border-bottom: 1px solid var(--nd-border);
}

.nd-lnb-list {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nd-lnb-list::-webkit-scrollbar {
  display: none;
}

.nd-lnb-item {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 11px 2px 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.nd-lnb-item:hover {
  color: var(--nd-navy);
}

.nd-lnb-item.active {
  color: var(--nd-navy);
  font-weight: 800;
  border-bottom-color: var(--nd-navy);
}

.nd-lnb-item span {
  font-size: 0.78rem;
  color: #888;
  font-weight: 500;
  margin-left: 3px;
}

.nd-lnb-item.active span {
  color: var(--nd-blue-accent);
}

/* 2-Column Main Layout */
.nd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  padding-top: 22px;
  padding-bottom: 60px;
  align-items: start;
}

.nd-main-col {
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  border-radius: 8px;
  padding: 22px 26px;
}

/* Stem Notice */
.nd-stem-notice {
  background: #f5f8ff;
  border: 1px solid #d5e1fb;
  border-radius: 6px;
  padding: 12px 15px;
  margin-bottom: 18px;
  font-size: 0.92rem;
  color: #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nd-stem-notice strong {
  color: var(--nd-blue-link);
}

.nd-stem-link {
  background: none;
  border: none;
  color: var(--nd-blue-link);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
}

/* Section Head */
.nd-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #222;
}

.nd-section-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: #111;
}

.nd-section-title span {
  color: var(--nd-blue-accent);
}

.nd-sort-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nd-dot {
  color: #ccc;
  font-size: 0.8rem;
}

.nd-sort-btn {
  background: none;
  border: none;
  font-size: 0.83rem;
  color: var(--nd-muted);
  cursor: pointer;
  font-family: inherit;
}

.nd-sort-btn.active {
  color: #111;
  font-weight: 700;
}

/* Entry List (Naver Dictionary Style) */
.nd-entry-list {
  list-style: none;
}

.nd-entry-item {
  padding: 18px 2px;
  border-bottom: 1px solid var(--nd-divider);
}

.nd-entry-item:last-child {
  border-bottom: none;
}

.nd-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.nd-headword-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nd-headword {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--nd-blue-link);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  text-align: left;
}

.nd-headword:hover {
  text-decoration: underline;
}

.nd-pron-mini {
  background: #f5f7fa;
  border: 1px solid #e1e5ec;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.76rem;
  color: #555;
  cursor: pointer;
  font-family: inherit;
}

.nd-pron-mini:hover {
  background: #eaeff7;
  color: var(--nd-blue-link);
}

.nd-row-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.12s;
}

.nd-entry-item:hover .nd-row-actions {
  opacity: 1;
}

.nd-row-action-btn {
  background: none;
  border: 1px solid var(--nd-border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.75rem;
  color: var(--nd-sub);
  cursor: pointer;
  font-family: inherit;
}

.nd-row-action-btn:hover {
  color: #111;
  border-color: #bbb;
}

.nd-meaning-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 0.96rem;
  color: #222;
}

.nd-pos-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #3f63a8;
  background: #eef3fc;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.nd-conj-inline {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--nd-muted);
}

.nd-conj-inline span {
  color: #444;
  font-weight: 600;
}

/* Detail View */
.nd-detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--nd-border);
  margin-bottom: 20px;
}

.nd-link-btn {
  background: none;
  border: none;
  color: var(--nd-sub);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.nd-link-btn:hover {
  color: var(--nd-blue-link);
  text-decoration: underline;
}

.nd-detail-actions {
  display: flex;
  gap: 6px;
}

.nd-mini-btn {
  background: #fff;
  border: 1px solid var(--nd-border);
  border-radius: 5px;
  padding: 5px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.nd-mini-btn.danger {
  color: #d93025;
  border-color: #f3c6c3;
}

.nd-detail-headword-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.nd-detail-word {
  font-size: 2rem;
  font-weight: 800;
  color: #111;
}

.nd-pron-btn {
  background: #f4f6fa;
  border: 1px solid #dce1ea;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  font-family: inherit;
}

.nd-pron-btn:hover {
  border-color: var(--nd-blue-link);
  color: var(--nd-blue-link);
}

.nd-detail-meaning-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 16px 0 22px;
  border-bottom: 1px solid var(--nd-divider);
}

.nd-detail-meaning {
  font-size: 1.12rem;
  color: #111;
}

.nd-num {
  margin-right: 4px;
}

.nd-detail-conj {
  padding-top: 20px;
}

.nd-sub-heading {
  font-size: 0.95rem;
  font-weight: 800;
  color: #222;
  margin-bottom: 12px;
}

.nd-conj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.nd-conj-table tr {
  border-bottom: 1px solid var(--nd-divider);
}

.nd-conj-table th {
  text-align: left;
  width: 170px;
  padding: 10px 8px;
  color: var(--nd-sub);
  font-weight: 600;
  background: #fafbfd;
}

.nd-conj-table td {
  padding: 10px 12px;
  font-weight: 700;
  color: var(--nd-blue-link);
}

/* Sidebar Widgets */
.nd-side-col {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 138px;
}

.nd-widget {
  background: var(--nd-surface);
  border: 1px solid var(--nd-border);
  border-radius: 8px;
  padding: 16px 18px;
}

.nd-widget-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.nd-widget-head h3 {
  font-size: 0.92rem;
  font-weight: 800;
  color: #111;
}

.nd-icon-refresh {
  background: none;
  border: 1px solid var(--nd-border);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: #555;
  font-size: 0.88rem;
}

.nd-today-word {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--nd-blue-link);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  margin-bottom: 4px;
}

.nd-today-word:hover {
  text-decoration: underline;
}

.nd-today-meaning {
  font-size: 0.9rem;
  color: #444;
}

.nd-text-clear {
  background: none;
  border: none;
  font-size: 0.76rem;
  color: var(--nd-muted);
  cursor: pointer;
  font-family: inherit;
}

.nd-text-clear:hover {
  text-decoration: underline;
}

.nd-recent-list {
  list-style: none;
  display: grid;
  gap: 7px;
}

.nd-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.nd-recent-link {
  background: none;
  border: none;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.nd-recent-link:hover {
  color: var(--nd-blue-link);
  text-decoration: underline;
}

.nd-recent-meaning {
  font-size: 0.8rem;
  color: var(--nd-muted);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nd-tool-btns {
  display: grid;
  gap: 8px;
}

.nd-tool-sub-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.nd-btn-primary {
  background: var(--nd-navy);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.nd-btn-primary:hover {
  background: var(--nd-navy-dark);
}

.nd-btn-outline {
  background: #fff;
  color: #444;
  border: 1px solid var(--nd-border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.nd-btn-outline:hover {
  background: #f7f9fc;
  border-color: #c6cdd8;
}

/* Modal */
.nd-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
}

.nd-modal {
  background: #fff;
  border-radius: 10px;
  max-width: 440px;
  width: 100%;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.nd-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.nd-modal-head h3 {
  font-size: 1.05rem;
  font-weight: 800;
}

.nd-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #777;
  cursor: pointer;
}

.nd-form {
  display: grid;
  gap: 13px;
}

.nd-form label {
  display: grid;
  gap: 5px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #333;
}

.nd-form input,
.nd-form select {
  padding: 9px 11px;
  border: 1px solid var(--nd-border);
  border-radius: 6px;
  font-size: 0.94rem;
  font-family: inherit;
}

.nd-form input:focus,
.nd-form select:focus {
  outline: none;
  border-color: var(--nd-navy);
}

.nd-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

@media (max-width: 820px) {
  .nd-layout {
    grid-template-columns: 1fr;
  }
  .nd-side-col {
    position: static;
  }
  .nd-row-actions {
    opacity: 1;
  }
}
