* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #eaeaea;
  background: #1a1a1a;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ─── 사이드바 ─── */
.sidebar {
  width: 360px;
  min-width: 360px;
  height: 100%;
  background: #232323;
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.search-box {
  padding: 12px 14px;
  border-bottom: 1px solid #333;
}
.search-box input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: #eaeaea;
  outline: none;
}
.search-box input:focus {
  border-color: #4a90e2;
}
.search-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #888;
  min-height: 16px;
}

.results {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.result-item {
  padding: 10px 14px;
  border-bottom: 1px solid #2a2a2a;
  cursor: pointer;
  transition: background 0.1s;
}
.result-item:hover, .result-item.active {
  background: #2e3a4a;
}
.result-item .name {
  font-size: 13px;
  font-weight: 500;
  color: #eaeaea;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-item .meta {
  margin-top: 3px;
  font-size: 11px;
  color: #888;
}

.property-panel {
  max-height: 45%;
  border-top: 1px solid #333;
  padding: 12px 14px;
  overflow-y: auto;
  font-size: 12px;
  background: #1e1e1e;
  display: none;
}
.property-panel.open { display: block; }
.property-panel h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #4a90e2;
}
.property-panel .prop-group {
  margin-bottom: 10px;
}
.property-panel .prop-group-title {
  font-weight: 600;
  color: #ccc;
  margin-bottom: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid #333;
}
.property-panel .prop-row {
  display: flex;
  padding: 3px 0;
  gap: 8px;
}
.property-panel .prop-key {
  color: #999;
  min-width: 100px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.property-panel .prop-val {
  color: #eaeaea;
  word-break: break-word;
  flex: 1;
}

/* ─── 뷰어 ─── */
.viewer-wrap {
  flex: 1;
  position: relative;
  background: #111;
  min-width: 0;
}
#viewer {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ─── 로딩 마스크 ─── */
.loading-mask {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: #ccc;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: #4a90e2;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── 버튼 ─── */
.icon-btn {
  background: transparent;
  border: none;
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
.fab {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: #4a90e2;
  color: white;
  border: none;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
}

/* ─── 모바일 대응 ─── */
.mobile-only { display: none; }

@media (max-width: 768px) {
  .mobile-only { display: inline-block; }

  .sidebar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 85vw;
    max-width: 380px;
    z-index: 200;
    transform: translateX(-100%);
    box-shadow: 2px 0 20px rgba(0,0,0,0.6);
  }
  .sidebar.open {
    transform: translateX(0);
  }
}
