:root{
  --bg1:#070a14;
  --bg2:#0b1020;
  --border: rgba(255,255,255,0.12);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --accent: #3b82f6;
  --ok:#34d399;
  --bad:#fb7185;
  --shadow: 0 20px 60px rgba(0,0,0,0.35);
  --radius: 16px;
  --radius2: 12px;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  margin:0;
  color:var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Malgun Gothic", Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(59,130,246,0.25), transparent 60%),
    radial-gradient(900px 600px at 95% 15%, rgba(52,211,153,0.16), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

.app{
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 18px 18px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand{ display:flex; align-items:center; gap:12px; min-width:0; }
.logo{
  width:42px; height:42px;
  border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  font-weight:900;
  background: linear-gradient(135deg, rgba(96,165,250,0.25), rgba(59,130,246,0.75));
  border:1px solid rgba(255,255,255,0.18);
}
.brand-text{ min-width:0; }
.brand-title{ font-weight:900; font-size:16px; letter-spacing:-0.2px; }
.brand-sub{
  margin-top:2px;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.pill{
  border:1px solid var(--border);
  background: rgba(255,255,255,0.05);
  padding:8px 10px;
  border-radius:999px;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}
.pill b{ color:var(--text); font-weight:900; }

/* 탭형 레이아웃: 상단(탭/작업) + 하단(원본 미리보기) */
.layout{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.panel{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.05));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}

/* 상단 작업 영역은 내용에 따라 높이 자동 */
.panel.controls{ min-height: auto; }

/* 탭 */
.tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.tab-btn{
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border-radius:999px;
  padding:8px 12px;
  font-weight:900;
  font-size:12px;
  cursor:pointer;
}
.tab-btn[aria-selected="true"]{
  border-color: rgba(96,165,250,0.45);
  background: linear-gradient(135deg, rgba(96,165,250,0.18), rgba(59,130,246,0.55));
}
.tab-btn:hover{ filter: brightness(1.05); }
.tab-btn:active{ transform: translateY(1px); }

.tab-panels{ display:block; }
.tab-panel{ padding-top:2px; }

.panel-head h2{ margin:0; font-size:14px; font-weight:900; }
.panel-head p{
  margin:6px 0 0;
  font-size:12px;
  color:var(--muted);
  line-height:1.4;
}

.filebox{
  margin-top:14px;
  border:1px dashed rgba(255,255,255,0.20);
  border-radius: var(--radius2);
  padding:12px;
  background: rgba(255,255,255,0.04);
}
.filebox-head{ display:flex; justify-content:space-between; gap:10px; margin-bottom:10px; }
.label{ font-size:12px; color:var(--muted); font-weight:800; }
.hint{ font-size:12px; color:rgba(255,255,255,0.78); font-weight:800; }
.filebox input[type="file"]{ width:100%; }

/* 기존 actions는 탭으로 분리했지만, 남아도 동작하도록 유지 */
.actions{ margin-top:14px; display:flex; flex-direction:column; gap:10px; }

.btn{
  width:100%;
  border:1px solid rgba(255,255,255,0.14);
  border-radius:14px;
  padding:12px 14px;
  cursor:pointer;
  font-weight:900;
  letter-spacing:-0.15px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-align:left;
}
.btn .btn-sub{
  display:block;
  margin-top:4px;
  font-size:12px;
  font-weight:700;
  color:rgba(255,255,255,0.78);
}

.btn.primary{
  background: linear-gradient(135deg, rgba(96,165,250,0.25), rgba(59,130,246,0.85));
  border:1px solid rgba(255,255,255,0.18);
}
.btn.ghost{ background: rgba(255,255,255,0.04); }

.btn:hover{ filter: brightness(1.03); }
.btn:active{ transform: translateY(1px); }

.btn:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  transform:none;
  filter:none;
}

.note{ font-size:12px; color: rgba(255,255,255,0.55); line-height:1.35; }

.status{
  margin-top:14px;
  border:1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius2);
  background: rgba(0,0,0,0.18);
  overflow:hidden;
}
.status-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,0.10);
}
.status-title{ font-size:12px; font-weight:900; }
.badge{
  font-size:11px;
  font-weight:900;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
}
.badge.ok{ border-color: rgba(52,211,153,0.35); background: rgba(52,211,153,0.15); }
.badge.bad{ border-color: rgba(251,113,133,0.35); background: rgba(251,113,133,0.15); }

.status-body{
  margin:0;
  padding:12px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size:12px;
  min-height: 150px;
}

.preview .preview-wrap{
  margin-top:12px;
  position:relative;
  border:1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius2);
  overflow:hidden;
  background: rgba(0,0,0,0.18);
  height: 72vh;
}
.preview-frame{ width:100%; height:100%; border:0; background:#fff; }
.preview-empty{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(255,255,255,0.65);
  font-size:13px;
  text-align:center;
  padding:18px;
  pointer-events:none;
  backdrop-filter: blur(2px);
}

.footer{
  margin-top: 12px;
  padding: 10px 2px;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
}

@media (max-width: 980px){
  .preview .preview-wrap{ height: 70vh; }
}
