:root {
  --ink: #18221f;
  --muted: #66716d;
  --green: #173f35;
  --green-2: #245e4e;
  --mint: #dcece4;
  --lime: #d8ee91;
  --paper: #f5f3ec;
  --white: #fffef9;
  --line: #d8ddd8;
  --danger: #9d342d;
  --shadow: 0 18px 50px rgba(30, 54, 46, .09);
  --radius: 22px;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 12px 18px; background: var(--ink); color: white; border-radius: 8px; }
.skip-link:focus { top: 16px; }

.site-header { max-width: 1240px; margin: auto; padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 46% 54%; background: var(--green); color: var(--lime); font-family: Georgia, serif; font-style: italic; }
.header-note, .back-link { margin: 0; color: var(--muted); font-size: .9rem; }
.back-link { text-underline-offset: 4px; }

main { max-width: 1184px; margin: auto; padding: 0 28px 96px; }
.hero { min-height: 410px; padding: 66px 72px; border-radius: 34px; background: var(--green); color: white; display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 360px; height: 360px; right: -70px; top: -130px; border: 1px solid rgba(216, 238, 145, .35); border-radius: 50%; box-shadow: 0 0 0 48px rgba(216,238,145,.04), 0 0 0 96px rgba(216,238,145,.025); }
.hero-copy { max-width: 700px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: var(--green-2); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hero .eyebrow { color: var(--lime); }
.hero h1 { margin: 0; font-size: clamp(2.75rem, 7vw, 5.4rem); line-height: .98; letter-spacing: -.07em; font-weight: 800; }
.hero h1 em { color: var(--lime); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
.hero-description { max-width: 610px; margin: 28px 0 0; color: #dbe5e1; font-size: 1.06rem; }
.hero-stat { min-width: 170px; padding: 20px 24px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.07); backdrop-filter: blur(10px); border-radius: 20px; position: relative; z-index: 1; }
.hero-stat span { display: block; font-size: 2.1rem; font-weight: 900; letter-spacing: -.05em; color: var(--lime); }
.hero-stat small { color: #dbe5e1; }

.search-panel { margin: -36px 32px 80px; padding: 34px 38px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; z-index: 2; }
.section-heading, .results-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.25; letter-spacing: -.045em; }
.text-button { border: 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; min-height: 44px; }
#search-form { margin-top: 26px; }
label { display: grid; gap: 8px; font-size: .86rem; font-weight: 750; color: #34423d; }
.input-wrap { height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.input-wrap span { color: var(--green-2); font-size: 1.6rem; line-height: 1; }
input, select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); padding: 0 14px; }
.input-wrap input { border: 0; padding: 0; outline: 0; min-height: auto; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(36, 94, 78, .28); outline-offset: 2px; }
.filter-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.primary-button, .secondary-button { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 16px; padding: 0 22px; border-radius: 12px; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button { border: 1px solid var(--green); background: var(--green); color: white; }
.primary-button:hover { background: var(--green-2); }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }

.results-section { scroll-margin-top: 20px; }
.result-summary { margin: 0; color: var(--muted); }
.program-list { display: grid; gap: 14px; margin-top: 28px; }
.program-card { background: var(--white); border: 1px solid transparent; border-radius: 18px; padding: 26px 28px; display: grid; grid-template-columns: 1fr auto; gap: 24px; text-decoration: none; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.program-card:hover { transform: translateY(-2px); border-color: #b9c9c1; box-shadow: 0 12px 28px rgba(23,63,53,.07); }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.status-chip, .tag { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.status-OPEN { background: var(--lime); color: #263810; }
.status-UPCOMING { background: #dceafa; color: #254b76; }
.status-CLOSED { background: #e8e8e5; color: #676965; }
.tag { background: var(--mint); color: var(--green); }
.program-card h3 { margin: 0; max-width: 800px; font-size: 1.2rem; letter-spacing: -.025em; line-height: 1.45; }
.card-org { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.card-deadline { min-width: 150px; align-self: center; text-align: right; }
.card-deadline strong { display: block; color: var(--green); font-size: 1.05rem; }
.card-deadline span { color: var(--muted); font-size: .82rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 30px; }
.pagination button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.pagination button[aria-current="page"] { background: var(--green); color: white; border-color: var(--green); }
.pagination button:disabled { opacity: .4; cursor: default; }
.state-panel { margin-top: 28px; min-height: 220px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; background: rgba(255,255,255,.55); border: 1px dashed #bdc6c0; border-radius: var(--radius); color: var(--muted); }
.state-panel[hidden] { display: none; }
.state-panel strong { color: var(--ink); font-size: 1.1rem; }
.state-panel p { margin: 0; }
.state-panel.error { border-color: #dab9b5; color: var(--danger); }
.state-icon { font-size: 2rem; color: var(--green-2); }
.loader { width: 30px; height: 30px; border: 3px solid #cfd8d3; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.detail-main { max-width: 1184px; }
.detail-hero { padding: 70px 8% 64px; border-radius: 32px; background: var(--green); color: white; }
.detail-hero .eyebrow { color: var(--lime); margin-top: 18px; }
.detail-hero h1 { max-width: 880px; margin: 0; font-size: clamp(2.1rem, 5vw, 4rem); line-height: 1.12; letter-spacing: -.06em; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 28px; color: #dbe5e1; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; padding: 56px 5%; }
.detail-content { display: grid; gap: 42px; }
.detail-content section { padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.detail-content h2 { margin-bottom: 14px; font-size: 1.2rem; }
.detail-content p { margin: 0; white-space: pre-wrap; color: #3e4a46; }
.trust-note { background: var(--mint); border: 0 !important; border-radius: 16px; padding: 24px !important; }
.trust-note p + p { margin-top: 8px; color: var(--muted); font-size: .86rem; }
.apply-card { height: fit-content; position: sticky; top: 24px; padding: 26px; background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.apply-card h2 { font-size: 1.35rem; }
.apply-card p:not(.eyebrow) { color: var(--muted); }
.apply-card .primary-button { width: 100%; margin-top: 10px; }

footer { max-width: 1184px; margin: auto; padding: 34px 28px 50px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 22px; color: var(--muted); font-size: .84rem; }
footer strong { color: var(--green); }
footer p { margin: 0; flex: 1; }
footer a { text-underline-offset: 3px; }

@media (max-width: 820px) {
  .header-note { display: none; }
  main { padding-inline: 16px; }
  .hero { min-height: 460px; padding: 48px 26px; align-items: flex-start; flex-direction: column; justify-content: flex-end; }
  .hero-description { font-size: .95rem; }
  .hero-stat { min-width: 0; width: 100%; }
  .search-panel { margin: -24px 8px 62px; padding: 26px 20px; }
  .section-heading { align-items: flex-start; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .program-card { grid-template-columns: 1fr; padding: 22px; }
  .card-deadline { text-align: left; }
  .detail-layout { grid-template-columns: 1fr; padding: 36px 12px; }
  .apply-card { position: static; }
}

@media (max-width: 520px) {
  .site-header { padding: 16px; }
  .hero h1 { font-size: 2.65rem; }
  .filter-grid { grid-template-columns: 1fr; }
  .results-bar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .form-actions .primary-button { width: 100%; }
  .detail-hero { padding: 48px 24px; }
  footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.admin-main { max-width: 1120px; }
.admin-hero { padding: 48px; background: var(--green); color: white; border-radius: 28px; display: grid; grid-template-columns: 1fr minmax(300px, 440px); gap: 48px; align-items: end; }
.admin-hero h1 { margin: 0; font-size: clamp(2.1rem, 4vw, 3.6rem); letter-spacing: -.06em; }
.admin-hero p:not(.eyebrow) { color: #dbe5e1; }
.admin-hero .eyebrow { color: var(--lime); }
.admin-auth { padding: 20px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); border-radius: 16px; }
.admin-auth label { color: white; }
.admin-key-row { display: flex; gap: 8px; }
.admin-key-row input { min-width: 0; }
.admin-key-row .primary-button { border-color: var(--lime); background: var(--lime); color: var(--green); }
.admin-toolbar { margin: 48px 0 24px; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.admin-toolbar label { min-width: 180px; }
.admin-message { min-height: 28px; margin-bottom: 12px; color: var(--green-2); }
.admin-message.error { color: var(--danger); }
.issue-list { display: grid; gap: 12px; }
.issue-card { padding: 24px 26px; border-radius: 16px; background: var(--white); border: 1px solid var(--line); }
.issue-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.issue-heading h3 { margin: 0; font-size: 1.08rem; }
.issue-card > p { color: #44504c; }
.issue-meta { font-size: .8rem; color: var(--muted) !important; }
.issue-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.issue-actions button { min-height: 42px; }

@media (max-width: 720px) {
  .admin-hero { grid-template-columns: 1fr; padding: 30px 22px; gap: 24px; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-toolbar label { width: 100%; }
  .admin-key-row { flex-direction: column; }
}
