@font-face{
  font-family: "Paperlogy";
  src: url("https://cdn.jsdelivr.net/gh/fonts-archive/Paperlogy/Paperlogy-5Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
}

@font-face{
  font-family: "Paperlogy";
  src: url("https://cdn.jsdelivr.net/gh/fonts-archive/Paperlogy/Paperlogy-7Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
}

:root{
  --bg0:#f7fbff;
  --bg1:#fff7ea;
  --paper:#ffffff;
  --card:#ffffff;
  --ink:#16243a;
  --muted:#5a6b86;
  --line:rgba(22,36,58,.12);
  --accent:#ffb703;
  --accent2:#4cc9f0;
  --accent3:#80ed99;
  --danger:#ff4d6d;
  --ok:#22c55e;
  --shadow: 0 18px 55px rgba(22,36,58,.12);
  --r12:12px;
  --r16:16px;
  --r20:20px;
  --max: 1060px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 24px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--ink);
  background: var(--bg0);
  font-family: "Paperlogy", "Noto Sans KR", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  letter-spacing:-0.1px;
  min-height: 100vh;
  display:flex;
  flex-direction:column;
  /* Korean line breaking: prefer breaks at spaces (eojeol) */
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}

a{ color:inherit; }
button, input, select, textarea{ font:inherit; }

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px 16px;
  background: rgba(255,255,255,.72);
  border-bottom:1px solid var(--line);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(22,36,58,.08);
}

.brand{ display:flex; flex-direction:column; line-height:1.05; min-width:0; }
.brandTitle{
  font-weight:900;
  letter-spacing:0.1px;
  background: linear-gradient(135deg, #0b1b2a, #2653ff);
  -webkit-background-clip:text;
  background-clip:text;
  color: transparent;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.brandSub{ color:var(--muted); font-size:12px; margin-top:4px; }
.topbarRight{ margin-left:auto; display:flex; gap:10px; align-items:center; }

.topbar::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-1px;
  height:1px;
  background: linear-gradient(90deg, rgba(255,183,3,.0), rgba(255,183,3,.55), rgba(76,201,240,.55), rgba(128,237,153,.45), rgba(255,183,3,.0));
  pointer-events:none;
}

.pillLink{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.65);
  text-decoration:none;
  color:var(--ink);
}
.pillLink:hover{ border-color: rgba(22,36,58,.22); }

.iconBtn{
  width:42px;
  height:42px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.65);
  color:var(--ink);
  cursor:pointer;
  display:grid;
  place-items:center;
}
.iconBtn:hover{ border-color: rgba(22,36,58,.22); background: rgba(255,255,255,.90); }

.hamburger{
  width:18px; height:12px; position:relative; display:block;
  border-top:2px solid rgba(22,36,58,.85);
  border-bottom:2px solid rgba(22,36,58,.85);
}
.hamburger::before{
  content:"";
  position:absolute;
  left:0; right:0;
  top:50%;
  transform:translateY(-50%);
  border-top:2px solid rgba(22,36,58,.85);
}

.xIcon{
  width:18px; height:18px; position:relative; display:block;
}
.xIcon::before,.xIcon::after{
  content:"";
  position:absolute;
  left:50%; top:50%;
  width:18px; height:2px;
  background: rgba(22,36,58,.85);
  transform-origin:center;
}
.xIcon::before{ transform:translate(-50%,-50%) rotate(45deg); }
.xIcon::after{ transform:translate(-50%,-50%) rotate(-45deg); }

.backdrop{
  position:fixed;
  inset:0;
  background: rgba(22,36,58,.28);
  backdrop-filter: blur(3px);
  z-index:20;
}

.drawer{
  position:fixed;
  top:0; left:0;
  height:100%;
  width:min(380px, 88vw);
  z-index:30;
  background: rgba(255,255,255,.96);
  border-right:1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
  transform: translateX(-8px);
}

.drawerHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 6px 2px 14px 2px;
}
.drawerTitle{
  font-weight:800;
  letter-spacing:0.1px;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.drawerKicker{
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.2px;
  margin: 0 2px 10px 2px;
}
.drawerNav{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding: 6px 0 14px 0;
}
.navItem{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 12px 12px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.72);
  text-decoration:none;
  min-width:0;
}
.navItem:hover{ border-color: rgba(22,36,58,.22); background: rgba(255,255,255,.90); }
.navItem.active{ border-color: rgba(255,183,3,.55); background: rgba(255,183,3,.12); }
.badge{
  width:28px; height:28px;
  display:grid; place-items:center;
  border-radius:10px;
  font-weight:800;
  color: rgba(22,36,58,.92);
  border: 1px solid rgba(22,36,58,.14);
  background: #e8f1ff;
}
.badge.is-h{ background: #ffe6a7; } /* pastel yellow */
.badge.is-p{ background: #cfefff; } /* pastel sky */
.badge.is-d{ background: #d9f9e3; } /* pastel mint */
.navText{ font-weight:700; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ext{ margin-left:auto; color: var(--muted); font-size: 12px; }

.drawerSection{
  margin-top: 8px;
  padding-top: 12px;
  border-top:1px solid var(--line);
}
.drawerSectionTitle{
  font-size: 13px;
  margin: 0 0 8px 0;
  color: rgba(22,36,58,.90);
}
.muted{ color: var(--muted); font-size: 13px; margin: 0; }

.shell{
  width: min(var(--max), calc(100% - 32px));
  margin: 18px auto 0 auto;
  display:flex;
  flex-direction:column;
  gap: 18px;
  flex: 1 0 auto;
  padding-bottom: 64px; /* keep footer from visually sticking to last card */
}

.hero{
  padding: 18px 6px 4px 6px;
}
.h1{
  font-family: inherit;
  font-weight:700;
  font-size: clamp(28px, 3.1vw, 44px);
  margin: 0 0 10px 0;
  letter-spacing: -0.4px;
  line-height: 1.15;
}
.lead{
  margin: 0;
  color: rgba(22,36,58,.86);
  max-width: 72ch;
  line-height: 1.55;
}

.warning{
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,77,109,.25);
  background: rgba(255,107,143,.08);
  color: rgba(22,36,58,.92);
  font-size: 13px;
  line-height: 1.5;
}

.card{
  border:1px solid var(--line);
  border-radius: var(--r20);
  background: rgba(255,255,255,.74);
  box-shadow: 0 12px 42px rgba(22,36,58,.10);
  overflow:hidden;
}
.cardHead{
  padding: 18px 18px 0 18px;
}
.cardBody{
  padding: 0 18px 4px 18px;
}
.h2{
  margin: 0 0 10px 0;
  font-size: 16px;
  letter-spacing: -0.1px;
}

.form{
  padding: 0 18px 18px 18px;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.grid3{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
@media (max-width: 920px){
  .grid3{ grid-template-columns: 1fr; }
}
@media (max-width: 760px){
  .grid2{ grid-template-columns: 1fr; }
}

.field{
  display:flex;
  flex-direction:column;
  gap: 12px;
  margin: 16px 0 0 0;
  min-width:0;
}
.label{
  font-size: 12px;
  color: rgba(22,36,58,.80);
  line-height: 1.35;
}
.hint{
  font-size: 12px;
  color: rgba(90,107,134,.92);
  line-height: 1.35;
}

.guideCard .cardBody{ padding-bottom: 14px; }
.guideGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.guideCol{
  border: 1px dashed rgba(22,36,58,.14);
  border-radius: 16px;
  background: rgba(255,255,255,.70);
  padding: 14px 14px;
}
.guideH{
  font-weight: 800;
  color: rgba(22,36,58,.92);
  margin-bottom: 10px;
}
.guideUl{
  margin: 0;
  padding-left: 18px;
  color: rgba(22,36,58,.86);
  line-height: 1.55;
}
.guideUl li{ margin: 8px 0; }
.guideUl li.em{ font-weight: 800; }
@media (max-width: 760px){
  .guideGrid{ grid-template-columns: 1fr; }
}
.input,.select,.textarea{
  width:100%;
  border-radius: 14px;
  border:1px solid rgba(22,36,58,.14);
  background: rgba(255,255,255,.88);
  color: var(--ink);
  padding: 14px 14px;
  outline: none;
  min-width:0;
  line-height: 1.45;
  min-height: 46px;
}

/* Template box: ensure placeholder/value doesn't look stuck to borders (esp. mobile + select arrow). */
.template-section input.input,
.template-section select.select{
  box-sizing: border-box;
  height: 48px;
  padding: 12px 14px;
  line-height: 1.3;
  border-radius: 14px;
}
.template-section select.select{
  padding-right: 44px;
}
.template-section input.input::placeholder{
  line-height: 1.3;
}
.input:focus,.select:focus,.textarea:focus{
  border-color: rgba(76,201,240,.65);
  box-shadow: 0 0 0 3px rgba(76,201,240,.18);
}
.textarea{
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
  padding: 14px 14px;
}

.row{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 16px 18px 18px 18px;
  flex-wrap:wrap;
}
.spacer{ flex:1; }

.btn{
  border:1px solid rgba(22,36,58,.16);
  background: rgba(255,255,255,.75);
  color: var(--ink);
  border-radius: 999px;
  padding: 11px 16px;
  cursor:pointer;
  font-weight: 600;
  max-width: 100%;
  line-height: 1.2;
}
.btn:hover{ border-color: rgba(22,36,58,.24); background: rgba(255,255,255,.92); }
.btn:disabled{ opacity: .45; cursor:not-allowed; }
.btn.primary{
  border-color: rgba(255,183,3,.50);
  background: #ffe6a7; /* pastel yellow */
}
.btn.ghost{
  background: transparent;
}
.btn.subtle{
  border-color: rgba(22,36,58,.10);
  color: rgba(22,36,58,.88);
}

.status{
  font-size: 12px;
  color: var(--muted);
}

.output{
  margin: 0;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 140px;
}

@media (max-width: 520px){
  .topbar{ gap:10px; padding: 12px 12px; }
  .topbarRight{ gap:8px; }
  .brandSub{ display:none; }
  .pillLink{ padding: 8px 10px; }
  .iconBtn{ width:40px; height:40px; border-radius: 12px; }
  .row{ padding: 14px 12px 16px 12px; }
  .cardHead{ padding: 16px 12px 0 12px; }
  .cardBody{ padding: 0 12px 2px 12px; }
  .form{ padding: 0 12px 16px 12px; }
  .shell{ width: min(var(--max), calc(100% - 24px)); }
  .footer{ width: min(var(--max), calc(100% - 24px)); }
}

.footer{
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 6px 34px 6px;
  color: rgba(22,36,58,.80);
  text-align:left;
  flex: 0 0 auto;
}
.footerTitle{
  font-weight: 700;
  font-size: 13px;
}
.footerSub{
  margin-top: 8px;
  font-size: 12px;
  color: rgba(90,107,134,.88);
}
