:root {
  --header-h: 60px;
  --bg: #ffffff;
  --fg: #1a1a1a;
  --border: #e5e5e5;
  --brand: #2563eb;
  --brand-hover: #f0f4ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.nav-inner {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--brand-hover);
}

.nav-link.active {
  color: var(--brand);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.page-content {
  min-height: calc(100vh - var(--header-h));
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }

  .nav-menu.open {
    max-height: 500px;
  }

  .nav-link {
    padding: 14px 20px;
    border-radius: 0;
    border-bottom: 1px solid var(--border);
  }
}

/* dns-check page */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.page-title {
  font-size: 26px;
  margin: 0 0 8px;
}

.page-desc {
  color: #555;
  margin: 0 0 24px;
  line-height: 1.5;
}

.check-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.check-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.check-input:focus {
  outline: none;
  border-color: var(--brand);
}

.check-btn {
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.check-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.check-btn-secondary {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
}

.check-status {
  min-height: 20px;
  font-size: 14px;
  margin-bottom: 20px;
}

.check-status.loading { color: #888; }
.check-status.success { color: #16a34a; }
.check-status.error { color: #dc2626; }

.result-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.result-domain {
  margin: 0;
  font-size: 22px;
}

.result-time {
  color: #888;
  font-size: 13px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.field-label {
  margin: 12px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.field-label:first-of-type {
  margin-top: 0;
}

.record-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.record-item {
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  word-break: break-all;
}

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

.empty-note {
  color: #999;
  font-size: 13px;
  margin: 4px 0 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .check-form {
    flex-direction: column;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }
}

.vuln-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.vuln-item {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  border-left: 4px solid transparent;
}

.vuln-item:last-child {
  margin-bottom: 0;
}

.vuln-critical {
  background: #fef2f2;
  border-left-color: #dc2626;
  color: #991b1b;
}

.vuln-high {
  background: #fff7ed;
  border-left-color: #ea580c;
  color: #9a3412;
}

.vuln-medium {
  background: #fffbeb;
  border-left-color: #d97706;
  color: #92400e;
}

.vuln-low {
  background: #f8fafc;
  border-left-color: #64748b;
  color: #334155;
}

.vuln-info {
  background: #f0f9ff;
  border-left-color: #0284c7;
  color: #075985;
}

.vuln-ok {
  color: #16a34a;
  font-size: 14px;
  margin: 0;
}

.port-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.port-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.port-open {
  background: #fef2f2;
  color: #dc2626;
}

.port-closed {
  background: #f0fdf4;
  color: #16a34a;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-ok {
  background: #f0fdf4;
  color: #16a34a;
}

.status-warn {
  background: #fffbeb;
  color: #92400e;
}

.status-bad {
  background: #fef2f2;
  color: #dc2626;
}

.vuln-high-text {
  color: #9a3412;
  font-size: 14px;
  margin: 4px 0 0;
}

.advisory-card {
  background: #f8fafc;
}

.advisory-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: #333;
}

.advisory-list li {
  margin-bottom: 6px;
}

/* office viewer page */
.upload-dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 12px;
}

.upload-dropzone:hover,
.upload-dropzone:focus-visible {
  border-color: var(--brand);
  background: var(--brand-hover);
  outline: none;
}

.upload-dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-hover);
}

.upload-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
}

.upload-dropzone-text span {
  font-size: 13px;
  color: #888;
}

.upload-progress {
  display: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}

.upload-progress.show {
  display: block;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand);
  transition: width 0.2s ease;
}

.upload-progress-bar.busy {
  background: repeating-linear-gradient(
    45deg,
    var(--brand),
    var(--brand) 10px,
    var(--brand-hover) 10px,
    var(--brand-hover) 20px
  );
  background-size: 28px 28px;
  animation: upload-progress-stripes 0.7s linear infinite;
}

@keyframes upload-progress-stripes {
  from { background-position: 0 0; }
  to { background-position: 28px 0; }
}

.viewer-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 320px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-empty {
  color: #999;
  font-size: 14px;
}

.viewer-empty.hidden {
  display: none;
}

.viewer-pdf-pages,
.viewer-image,
.viewer-video {
  display: none;
}

.viewer-pdf-pages,
.viewer-video {
  width: 100%;
}

.viewer-frame.has-pdf .viewer-pdf-pages,
.viewer-frame.has-video .viewer-video {
  display: block;
}

.viewer-frame.has-image .viewer-image {
  display: block;
}

.viewer-frame.has-pdf,
.viewer-frame.has-image,
.viewer-frame.has-video {
  align-items: stretch;
  display: block;
}

.viewer-pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pdf-page-canvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

.viewer-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0 auto;
}

.viewer-video {
  max-width: 100%;
  border-radius: 4px;
  background: #000;
}

@media (max-width: 768px) {
  .upload-dropzone {
    padding: 28px 16px;
  }

  .viewer-frame {
    padding: 10px;
    min-height: 220px;
  }
}


/* AI 악보 변환기 페이지 */
.paste-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 12px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paste-area:hover,
.paste-area:focus-visible {
  border-color: var(--brand);
  background: var(--brand-hover);
  outline: none;
}

.paste-area.dragover {
  border-color: var(--brand);
  background: var(--brand-hover);
}

.paste-area-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
}

.paste-area-text span {
  font-size: 13px;
  color: #888;
}

.paste-area-text.hidden {
  display: none;
}

.original-preview {
  display: none;
  max-width: 100%;
  max-height: 420px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.original-preview.show {
  display: block;
}

.ai-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.btn-ghost-sm {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-ghost-sm:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand);
}

.btn-ghost-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sheet-result-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.sheet-result-frame.hidden {
  display: none;
}

.sheet-result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.sheet-result-title {
  font-size: 14px;
  font-weight: 600;
}

.osmd-container {
  width: 100%;
  overflow-x: auto;
  background: #fff;
}

@media (max-width: 768px) {
  .paste-area {
    padding: 28px 16px;
    min-height: 120px;
  }

  .ai-actions {
    flex-direction: column;
  }
}

.preprocessed-preview {
  display: block;
  max-width: 100%;
  max-height: 500px;
  margin: 0 auto;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 공통 유틸 */
.hidden {
  display: none !important;
}

/* 오피스 서브 탭 (viewer | word | excel) */
.office-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.office-tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #888;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.office-tab:hover {
  color: var(--fg);
}

.office-tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* Word 편집기 */
.word-paragraph-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.word-paragraph-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}

.word-paragraph-label {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  margin-bottom: 6px;
}

.word-paragraph-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
}

.word-paragraph-textarea:focus {
  outline: none;
  border-color: var(--brand);
}

/* Excel 편집기 — 실제 엑셀 화면에 최대한 가깝게 */
.excel-workbook {
  --excel-green: #217346;
  --excel-grid: #d0d7de;
  --excel-header-bg: #f3f2f1;
  border: 1px solid #c6c6c6;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 24px;
  font-family: Calibri, "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

.excel-formula-bar {
  display: flex;
  align-items: stretch;
  height: 32px;
  background: #fff;
  border-bottom: 1px solid var(--excel-grid);
}

.excel-name-box {
  width: 70px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  border-right: 1px solid var(--excel-grid);
  background: #fff;
}

.excel-fx-icon {
  width: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-style: italic;
  color: var(--excel-green);
  border-right: 1px solid var(--excel-grid);
}

.excel-formula-input {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
}

.excel-formula-input:focus {
  outline: none;
}

.excel-grid-wrap {
  overflow: auto;
  max-height: 65vh;
  background: #fff;
}

.excel-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  color: #1a1a1a;
}

.excel-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--excel-header-bg);
  font-weight: 400;
  color: #444;
  padding: 3px 10px;
  min-width: 80px;
  border-right: 1px solid var(--excel-grid);
  border-bottom: 1px solid var(--excel-grid);
  text-align: center;
  white-space: nowrap;
}

.excel-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 40px;
  width: 40px;
}

.excel-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--excel-header-bg);
  font-weight: 400;
  color: #444;
  padding: 3px 8px;
  border-right: 1px solid var(--excel-grid);
  border-bottom: 1px solid var(--excel-grid);
  text-align: center;
  white-space: nowrap;
}

.excel-table td {
  border-right: 1px solid var(--excel-grid);
  border-bottom: 1px solid var(--excel-grid);
  padding: 0;
}

.excel-cell-input {
  display: block;
  width: 100%;
  min-width: 80px;
  height: 22px;
  border: none;
  padding: 2px 6px;
  font-size: 12.5px;
  font-family: inherit;
  color: inherit;
  box-sizing: border-box;
  background: transparent;
}

.excel-cell-input:focus {
  outline: none;
}

.excel-cell-selected {
  position: relative;
  box-shadow: inset 0 0 0 2px var(--excel-green);
}

.excel-cell-formula .excel-cell-input {
  background: #fffbea;
}

.excel-sheet-tabbar {
  background: var(--excel-header-bg);
  border-top: 1px solid var(--excel-grid);
  padding: 0 6px;
}

.excel-sheet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 0;
}

.excel-sheet-tab {
  padding: 6px 16px;
  font-size: 12.5px;
  font-weight: 400;
  color: #444;
  background: transparent;
  border: none;
  border-radius: 2px 2px 0 0;
  cursor: pointer;
}

.excel-sheet-tab:hover {
  background: rgba(0, 0, 0, 0.04);
}

.excel-sheet-tab.active {
  color: var(--excel-green);
  font-weight: 700;
  background: #fff;
  box-shadow: inset 0 -2px 0 var(--excel-green);
}

@media (max-width: 768px) {
  .office-tabs {
    overflow-x: auto;
  }

  .office-tab {
    white-space: nowrap;
  }
}