/* JSON 차이 비교 전용 스타일 */

nav { max-width: 880px; }
main { max-width: 880px; }

.io-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

@media (min-width: 720px) {
  .io-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.io-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.io-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.io-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-sub);
}

.io-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  background: var(--surface);
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.io-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.io-block textarea {
  flex: 1;
  width: 100%;
  padding: 0.85rem 0.95rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  border: none;
  background: transparent;
  color: var(--text);
  resize: vertical;
  outline: none;
  min-height: 220px;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

.parse-error {
  margin: 0;
  padding: 0.5rem 0.85rem;
  background: rgba(239, 68, 68, 0.08);
  border-top: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.parse-error[hidden] { display: none; }

/* 요약 */
.summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.summary[hidden] { display: none; }

.sum-item {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: center;
  text-align: center;
}

.sum-key {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sum-val {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 1.4rem;
  font-weight: 800;
}

.sum-add {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.4);
}
.sum-add .sum-key, .sum-add .sum-val { color: var(--success); }

.sum-del {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.4);
}
.sum-del .sum-key, .sum-del .sum-val { color: var(--error); }

.sum-mod {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.4);
}
.sum-mod .sum-key, .sum-mod .sum-val { color: var(--warning); }

.sum-eq {
  background: var(--surface);
  border-color: var(--border);
}
.sum-eq .sum-key, .sum-eq .sum-val { color: var(--text-sub); }

/* 차이 트리 */
.diff-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.diff-output[hidden] { display: none; }

.diff-tree {
  margin: 0;
  padding: 0.85rem 0.95rem;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}

.diff-tree .line {
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  display: flex;
  flex-wrap: nowrap;
  white-space: pre;
  align-items: baseline;
}

.diff-tree .line .sign {
  display: inline-block;
  width: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.diff-tree .line .key {
  color: var(--text-sub);
  flex-shrink: 0;
}

.diff-tree .line .val,
.diff-tree .line .bracket {
  white-space: pre;
}

.diff-tree .line.eq {
  color: var(--text-sub);
  opacity: 0.65;
}

.diff-tree .line.add {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}
.diff-tree .line.add .sign { color: var(--success); }
.diff-tree .line.add .key { color: rgba(16, 185, 129, 0.85); }

.diff-tree .line.del {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}
.diff-tree .line.del .sign { color: var(--error); }
.diff-tree .line.del .key { color: rgba(239, 68, 68, 0.85); }

.diff-tree .line.bracket {
  opacity: 0.55;
}

.diff-tree .no-change {
  display: block;
  padding: 1rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--success);
  font-weight: 600;
}

@media (max-width: 600px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .io-block textarea { font-size: 0.78rem; min-height: 180px; }
  .diff-tree { font-size: 0.78rem; }
}
