:root {
  color-scheme: dark;
  --ink: #ecf4ef;
  --muted: #91a69b;
  --line: rgba(218, 236, 226, 0.13);
  --panel: rgba(15, 37, 29, 0.88);
  --panel-strong: #132c23;
  --green: #337c60;
  --green-light: #9fd8b8;
  --gold: #edbd63;
  --cream: #f3f0e8;
  --black: #0a1511;
  font-family: Inter, Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 0%, rgba(121, 105, 51, 0.34), transparent 30%),
    radial-gradient(circle at 0% 45%, rgba(31, 95, 69, 0.34), transparent 34%),
    #0b1c16;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 16px;
  padding: 0 4vw;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 24, 18, 0.8);
  backdrop-filter: blur(16px);
}

.back-link {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
}

.topbar > div { flex: 1; }
.topbar p { margin: 0 0 2px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: 0.18em; }
.topbar strong { font-size: 17px; }

.source-badge {
  padding: 8px 12px;
  border: 1px solid rgba(237, 189, 99, 0.28);
  border-radius: 999px;
  color: #e8c988;
  background: rgba(237, 189, 99, 0.08);
  font-size: 12px;
  font-weight: 700;
}

main { width: min(1480px, 92vw); margin: 0 auto; padding: 62px 0 80px; }

.intro {
  margin-bottom: 42px;
}

.eyebrow { margin: 0 0 15px; color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: 0.22em; }
.intro h1 { margin: 0; font-size: clamp(32px, 4vw, 54px); line-height: 1.12; letter-spacing: -0.04em; }
.intro h1 em { color: var(--green-light); font-family: Georgia, serif; font-weight: 500; }

.workspace {
  display: grid;
  min-height: 650px;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(10, 27, 21, 0.8);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.24);
}

.source-panel { padding: 32px; border-right: 1px solid var(--line); background: var(--panel); }
.panel-heading { display: flex; align-items: center; gap: 13px; }
.panel-heading > span { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: #102219; background: var(--gold); font-size: 12px; font-weight: 900; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: 0.2em; }
.panel-heading h2 { margin: 3px 0 0; font-size: 19px; }

.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 28px 0 24px; padding: 5px; border-radius: 13px; background: rgba(5, 14, 11, 0.48); }
.mode-tab { padding: 11px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 13px; font-weight: 800; }
.mode-tab.is-active { color: var(--ink); background: #29473b; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14); }

label { display: block; margin-bottom: 9px; color: #bed0c6; font-size: 12px; font-weight: 700; }
label small { color: var(--muted); font-weight: 500; }

input, textarea, select {
  width: 100%;
  border: 1px solid rgba(219, 238, 228, 0.14);
  border-radius: 13px;
  outline: 0;
  color: var(--ink);
  background: rgba(5, 16, 12, 0.52);
}

input { min-height: 48px; padding: 0 14px; }
textarea { resize: vertical; padding: 13px 14px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--green-light); box-shadow: 0 0 0 3px rgba(107, 180, 142, 0.12); }
.mode-panel label:not(:first-child) { margin-top: 17px; }

.sample-link { margin: 10px 0 23px; padding: 0; border: 0; color: #aac6b7; background: none; cursor: pointer; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.form-error { margin: 0 0 14px; padding: 11px 13px; border-radius: 10px; color: #ffd3ca; background: rgba(164, 56, 35, 0.25); font-size: 12px; line-height: 1.5; }

.primary-button, .secondary-button {
  min-height: 50px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 0 18px; color: #132018; background: var(--gold); }
.primary-button:hover { background: #f5c873; }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: 0.42; }
.primary-button--compact { width: auto; min-width: 172px; gap: 18px; }
.secondary-button { padding: 0 18px; border: 1px solid var(--line); color: var(--ink); background: transparent; }

.source-note { display: flex; gap: 10px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); }
.source-note > span { display: grid; width: 20px; height: 20px; flex: 0 0 auto; place-items: center; border: 1px solid var(--muted); border-radius: 50%; font-size: 10px; font-weight: 900; }
.source-note p { margin: 0; font-size: 11px; line-height: 1.65; }

.result-panel { min-width: 0; background: rgba(243, 240, 232, 0.97); color: #15251d; }
.empty-state, .loading-state { display: flex; min-height: 650px; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.orbit { display: grid; width: 94px; height: 94px; margin-bottom: 24px; place-items: center; border: 1px solid #b7c8be; border-radius: 50%; background: radial-gradient(circle, #fff 0 34%, transparent 35%); box-shadow: 0 0 0 13px rgba(48, 105, 79, 0.05); }
.orbit span { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 50%; color: #f2d087; background: #285b46; font-family: Georgia, serif; font-size: 22px; }
.empty-state p, .loading-state p { margin: 0 0 8px; font-weight: 900; }
.empty-state > span { color: #788b81; font-size: 13px; line-height: 1.65; }
.spinner { width: 38px; height: 38px; margin-bottom: 20px; border: 3px solid #cdd8d2; border-top-color: #2b7657; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.results { min-height: 650px; }
.article-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; padding: 30px 34px 24px; border-bottom: 1px solid #d9ded9; }
.article-summary > div:first-child { min-width: 0; }
.article-summary p { margin: 0 0 6px; color: #658071; font-size: 10px; font-weight: 900; letter-spacing: 0.11em; text-transform: uppercase; }
.article-summary h2 { max-width: 670px; margin: 0 0 8px; overflow: hidden; text-overflow: ellipsis; font-size: 22px; white-space: nowrap; }
.article-summary a { color: #357657; font-size: 11px; font-weight: 800; text-decoration: none; }
.stats { display: flex; flex: 0 0 auto; gap: 8px; }
.stats p { display: flex; min-width: 78px; margin: 0; padding: 11px 12px; flex-direction: column; border-radius: 12px; background: #e4e9e4; text-align: center; }
.stats strong { color: #1c4c38; font-size: 18px; }
.stats span { color: #708278; font-size: 9px; letter-spacing: 0; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 16px 34px; border-bottom: 1px solid #d9ded9; }
.toolbar label { margin: 0; color: #61756a; }
.search-field { position: relative; flex: 1; max-width: 260px; }
.search-field span { position: absolute; top: 11px; left: 13px; font-size: 18px; }
.search-field input { min-height: 42px; padding-left: 38px; border-color: #ccd5cf; color: #1a2a22; background: white; }
.frequency-field { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.frequency-field select { width: auto; min-height: 42px; padding: 0 29px 0 11px; border-color: #ccd5cf; color: #1a2a22; background: white; }
.text-button { padding: 10px 8px; border: 0; color: #357657; background: transparent; cursor: pointer; font-size: 11px; font-weight: 900; }

.word-list { display: grid; max-height: 408px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; overflow-y: auto; padding: 18px 34px 26px; }
.word-card { position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 11px; padding: 14px; border: 1px solid #dbe1dc; border-radius: 13px; background: #fff; cursor: pointer; transition: border-color 120ms, background 120ms; }
.word-card:hover { border-color: #93b4a3; }
.word-card.is-selected { border-color: #5f9a7b; background: #edf6f0; }
.word-card input { width: 17px; min-height: 17px; margin: 3px 0 0; accent-color: #327a59; }
.word-copy { min-width: 0; }
.word-copy strong { display: block; margin-bottom: 3px; font-size: 15px; }
.word-copy p { margin: 0; overflow: hidden; color: #718178; font-size: 10px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.word-frequency { padding: 4px 7px; border-radius: 99px; color: #4f6c5d; background: #e7ece8; font-size: 9px; font-weight: 900; }
.no-results { margin: 80px 0; color: #73857b; text-align: center; font-size: 13px; }

.export-bar { display: flex; min-height: 76px; align-items: center; gap: 9px; padding: 12px 34px; border-top: 1px solid #d9ded9; background: #e9ece7; }
.export-bar p { flex: 1; margin: 0; color: #607168; font-size: 12px; }
.export-bar p strong { color: #1c4c38; }
.export-bar .primary-button, .export-bar .secondary-button { min-height: 44px; font-size: 12px; }

.toast { position: fixed; right: 26px; bottom: 26px; z-index: 10; padding: 13px 18px; border-radius: 12px; color: #102018; background: #b9e4ca; box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3); font-size: 12px; font-weight: 900; }

@media (max-width: 980px) {
  main { padding-top: 42px; }
  .workspace { grid-template-columns: 1fr; }
  .source-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .empty-state, .loading-state { min-height: 430px; }
}

@media (max-width: 680px) {
  .topbar { padding: 0 18px; }
  .source-badge { display: none; }
  main { width: calc(100% - 28px); padding: 34px 0 50px; }
  .intro h1 { font-size: 34px; }
  .source-panel { padding: 25px 20px; }
  .article-summary { flex-direction: column; padding: 24px 20px; }
  .article-summary h2 { white-space: normal; }
  .stats { width: 100%; }
  .stats p { flex: 1; min-width: 0; }
  .toolbar { flex-wrap: wrap; padding: 14px 20px; }
  .search-field { max-width: none; flex-basis: 100%; }
  .frequency-field { flex: 1; }
  .word-list { max-height: 520px; grid-template-columns: 1fr; padding: 15px 20px 22px; }
  .export-bar { flex-wrap: wrap; padding: 14px 20px; }
  .export-bar p { flex-basis: 100%; }
  .export-bar button { flex: 1; }
}
