*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #222; background: #f4f4f4; line-height: 1.6; }
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; font-weight: 700; color: #111; margin-bottom: 8px; }
h2 { font-size: 20px; font-weight: 700; color: #111; margin-bottom: 12px; }
h3 { font-size: 15px; font-weight: 700; color: #222; margin-bottom: 6px; }

.site-header { background: #1a1a2e; color: #fff; border-bottom: 3px solid #e8a000; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-img { width: 38px; height: 38px; border-radius: 8px; }
.logo-text { font-size: 20px; color: #fff; }
.logo-text strong { color: #e8a000; }
.site-nav { display: flex; gap: 24px; }
.site-nav a { color: #ccc; font-size: 13px; }
.site-nav a:hover { color: #e8a000; text-decoration: none; }

.ad-banner[style*="display:none"],
.ad-banner[style*="display: none"] { display: none !important; }
.ad-placeholder { display: inline-block; background: #f0f0f0; border: 1px dashed #bbb; color: #999; font-size: 12px; padding: 12px 40px; border-radius: 4px; }

main { max-width: 100%; margin: 0; padding: 20px 40px; display: flex; flex-direction: column; gap: 20px; }
.tool-section { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.tool-header { margin-bottom: 16px; }
.tool-desc { color: #555; font-size: 13px; }

.app-wrap { border: 1px solid #ccc; border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }

.toolbar { background: #f0f0f0; border-bottom: 1px solid #ccc; padding: 6px 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.btn { font-size: 12px; padding: 5px 14px; cursor: pointer; background: #fff; border: 1px solid #aaa; border-radius: 4px; color: #222; }
.btn:hover { background: #e8e8e8; }
.btn-primary { background: #1a73e8; color: #fff; border-color: #1557b0; font-weight: bold; }
.btn-primary:hover { background: #1557b0; }
.btn-danger { color: #c00; border-color: #c00; }
.btn-danger:hover { background: #fff0f0; }
.search-input { font-size: 12px; padding: 5px 8px; border: 1px solid #aaa; border-radius: 4px; width: 180px; outline: none; }
.search-input:focus { border-color: #1a73e8; }

/* THE FIX: panels row has a fixed vh height; children stretch to fill it */
.main-panels { display: flex; height: 80vh; min-height: 500px; max-height: 900px; }
.left-panel { width: 30%; border-right: 1px solid #ccc; display: flex; flex-direction: column; }
.right-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.panel-header { background: #f5f5f5; border-bottom: 1px solid #ccc; padding: 4px 10px; font-size: 11px; font-weight: bold; color: #555; flex-shrink: 0; }

/* textarea and tree both take remaining height inside their flex column parent */
#json-input { flex: 1; width: 100%; height: 100%; border: none; outline: none; resize: none; font-family: 'Courier New', monospace; font-size: 12px; padding: 8px; color: #333; background: #fff; overflow-y: auto; }
#tree-panel { flex: 1; width: 100%; height: 100%; overflow-y: auto; overflow-x: auto; padding: 6px 10px; background: #fff; font-family: 'Courier New', monospace; font-size: 12px; }

.statusbar { background: #f0f0f0; border-top: 1px solid #ccc; padding: 3px 10px; font-size: 11px; color: #555; display: flex; gap: 18px; flex-shrink: 0; }

.jv-line { line-height: 1.8; white-space: nowrap; }
.jv-line:hover { background: #f0f4ff; }
.jv-tog { cursor: pointer; display: inline-block; width: 14px; color: #555; user-select: none; font-size: 10px; }
.jv-key { color: #000080; }
.jv-idx { color: #888; }
.jv-str { color: #008000; }
.jv-num { color: #000; }
.jv-bool { color: #b22222; }
.jv-null { color: #808080; }
.jv-punct { color: #333; }
.jv-children { margin-left: 20px; border-left: 1px solid #ddd; padding-left: 4px; }
.jv-count { color: #888; font-size: 11px; }
.jv-hl { background: #ffff99; }

.content-section { background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); width: 100%; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 20px; }
.feature-card { background: #f8f9ff; border: 1px solid #e0e4f0; border-radius: 8px; padding: 16px; }
.feature-icon { font-size: 24px; margin-bottom: 8px; }
.howto-list { padding-left: 20px; }
.howto-list li { margin-bottom: 10px; color: #333; }
.faq-item { border-bottom: 1px solid #eee; padding: 14px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { color: #1a73e8; margin-bottom: 6px; }
.faq-item p { color: #555; font-size: 13px; }

.site-footer { background: #1a1a2e; color: #aaa; text-align: center; padding: 20px; font-size: 12px; margin-top: 32px; }
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-links { margin-top: 8px; }
.footer-links a { color: #ccc; margin: 0 4px; }
.footer-links a:hover { color: #e8a000; }


  .btn { padding: 4px 8px; font-size: 11px; }
}

/* Placeholder styling */
#json-input::placeholder {
  color: #bbb;
  font-style: italic;
  font-size: 12px;
  line-height: 1.8;
}

/* Policy page */
.policy-body h2 { font-size: 17px; margin: 24px 0 8px; color: #111; }
.policy-body h3 { font-size: 14px; margin: 16px 0 6px; color: #333; }
.policy-body p  { margin-bottom: 12px; color: #444; font-size: 14px; line-height: 1.7; }
.policy-list { padding-left: 20px; margin: 8px 0 12px; color: #444; font-size: 14px; }
.policy-list li { margin-bottom: 6px; }

/* Contact form */
.contact-form { margin-top: 24px; }
.form-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: bold; color: #333; }
.form-group input,
.form-group select,
.form-group textarea { font-size: 13px; padding: 8px 10px; border: 1px solid #ccc; border-radius: 4px; outline: none; font-family: Arial, sans-serif; color: #333; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #1a73e8; }
.form-group textarea { resize: vertical; }

/* Placeholder styling */
#json-input::placeholder { color: #bbb; font-style: italic; font-size: 12px; line-height: 1.8; }

/* === Mobile Responsive === */
@media (max-width: 768px) {
  main { padding: 10px; gap: 12px; }

  .site-nav { display: none; }

  .tool-section { padding: 12px; }
  .tool-header { margin-bottom: 10px; }
  h1 { font-size: 18px; }
  .tool-desc { font-size: 12px; }

  /* Stack toolbar buttons */
  .toolbar { padding: 6px 8px; gap: 4px; }
  .btn { font-size: 11px; padding: 4px 8px; }
  .search-input { width: 100%; }

  /* Stack panels vertically */
  .main-panels { flex-direction: column; height: auto; max-height: none; min-height: auto; }
  .left-panel  { width: 100%; height: 240px; border-right: none; border-bottom: 1px solid #ccc; }
  .right-panel { width: 100%; height: 360px; }
  #json-input  { height: 240px; font-size: 11px; }
  #tree-panel  { height: 360px; font-size: 11px; }

  .feature-grid { grid-template-columns: 1fr; }
  .content-section { padding: 16px; }
}

@media (max-width: 480px) {
  main { padding: 8px; }
  .toolbar { flex-wrap: wrap; }
  .btn { font-size: 11px; padding: 4px 8px; }
  h1 { font-size: 16px; }
  .left-panel  { height: 200px; }
  #json-input  { height: 200px; }
  .right-panel { height: 300px; }
  #tree-panel  { height: 300px; }
}
