/* extracted from index.html */
:root {
  --bg: #0f172a;
  --panel: #111827;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --accent: #22d3ee;
  --border: #1f2937;
  --ok: #bbf7d0;
  --err: #fecaca;
  --ready: #fde68a;
}

/* Light mode variables */
[data-theme="light"] {
  --bg: #fefefe;
  --panel: #f9f7f4;
  --muted: #6b5b73;
  --text: #2d1b2e;
  --accent: #0ea5e9;
  --border: #e8ddd4;
  --ok: #16a34a;
  --err: #dc2626;
  --ready: #ca8a04;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

/* Header bar */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

/* Mobile header adjustments */
@media (max-width: 768px) {
  .header {
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .header img {
    height: 24px;
  }

  .title {
    font-size: 16px;
  }

  .subtitle {
    font-size: 12px;
  }

  .bookmark-hint {
    display: none;
    /* Hide bookmark hint on mobile to save space */
  }

  .info-btn {
    margin-left: auto;
    min-width: 50px;
    padding: 8px 12px;
  }
}

/* Google Ad Container */
.ad-container {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-wrapper {
  width: 100%;
  max-width: 728px;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure ads don't overflow */
.ad-wrapper ins {
  max-width: 100%;
}

/* Mobile ad adjustments */
@media (max-width: 768px) {
  .ad-container {
    padding: 8px;
  }

  .ad-wrapper {
    max-width: 100%;
    min-height: 50px;
  }
}

.header img {
  height: 28px;
}

.title {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
}

.title-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.subtitle {
  font-family: 'Raleway';
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.layout {
  display: grid;
  grid-template-columns: var(--left, 40%) 6px var(--right, 60%);
  min-height: calc(100vh - 52px);
}

/* Mobile layout adjustments */
@media (max-width: 768px) {
  .layout {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 50px);
  }

  .pane {
    min-height: 200px;
  }

  .right {
    flex: 1;
    min-height: 0;
  }

  .drag {
    display: none;
    /* Hide drag handle on mobile */
  }
}

.pane {
  padding: 12px 16px;
}

.json-input-container {
  position: relative;
  width: 100%;
  min-height: 300px;
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.line-numbers {
  background: var(--bg);
  color: var(--muted);
  padding: 12px 8px 12px 12px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  user-select: none;
  border-right: 1px solid var(--border);
  min-width: 40px;
  text-align: right;
  white-space: pre;
  overflow: hidden;
  flex-shrink: 0;
  box-sizing: border-box;
}

.json-input {
  flex: 1;
  min-height: 276px;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 12px 12px 12px 8px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  white-space: nowrap;
  overflow-x: auto;
}

.drag {
  background: linear-gradient(to bottom, #0b2c33, #0b2c33) center/4px 80% no-repeat;
  cursor: col-resize;
}

.right {
  display: grid;
  grid-template-rows: auto 1fr;
}

.exprbox {
  border-bottom: 1px solid var(--border);
  padding: 16px;
}

.exprbox h2,
.result h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: monospace;
  font-size: 14px;
}

.btn {
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: #0b2c33;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  border-color: #23424a;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: #0b1220;
  color: var(--text);
}

.info-btn {
  margin-left: 12px;
  background: #0b1220;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 10px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
  /* Mobile-friendly touch targets */
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.info-btn:hover {
  background: #111827;
}

.language-selector {
  background: #0b1220;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 500;
  cursor: pointer;
  font-size: 12px;
  min-width: 140px;
  height: 32px;
}

.language-selector:hover {
  background: #111827;
  color: var(--text);
}

.language-selector:focus {
  outline: none;
  border-color: var(--accent);
}

.bookmark-hint {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  user-select: none;
}

.bookmark-hint svg {
  height: 20px;
  width: 20px;
  opacity: 0.9;
}


.badge {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.result {
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.resultbox {
  flex: 1;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  transition: background-color 0.3s ease;
}

.resultbox.new-result {
  background: rgba(34, 211, 238, 0.1);
  animation: resultHighlight 1.5s ease-out;
}

@keyframes resultHighlight {
  0% {
    background: rgba(34, 211, 238, 0.2);
    border-color: var(--accent);
  }

  100% {
    background: var(--panel);
    border-color: var(--border);
  }
}

.kv {
  position: relative;
  width: 100%;
}

.copy-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity .12s ease, visibility .12s ease, color .2s ease;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  padding: 2px 6px;
  line-height: 1;
  height: auto;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: right;
  min-height: 20px;
}

/* Parent nodes (objects/arrays) should have copy button at top */
.kv.parent-node .copy-btn {
  top: 2px;
  transform: none;
}

.copy-btn:hover {
  color: #ffffff;
  opacity: 0.7;
  /* brighter white on hover */
}

.kv.hovering>.copy-btn,
.kv.hovering span+.copy-btn {
  opacity: 1;
  visibility: visible;
}

/* Root copy button should always be visible */
.kv.parent-node .copy-btn {
  opacity: 0.7;
  visibility: visible;
}

.bottom-bracket {
  font-family: monospace;
  color: var(--muted);
  font-weight: bold;
  margin-top: 2px;
}

.array-index {
  color: #666;
  font-size: 12px;
  opacity: 0.7;
  margin-left: 4px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.json-comma {
  color: var(--muted);
  margin: 0 2px;
}

.indent {
  white-space: pre;
  user-select: text;
}

.kv.hovering {
  background: rgba(34, 211, 238, 0.08);
}

.kv.copy-hover {
  background: rgba(34, 211, 238, 0.14);
}

.status.ok {
  background: rgba(187, 247, 208, 0.15);
  color: var(--ok);
  border-color: rgba(187, 247, 208, 0.3);
}

.status.err {
  background: rgba(254, 202, 202, 0.12);
  color: var(--err);
  border-color: rgba(254, 202, 202, 0.3);
}

.status.ready {
  background: rgba(253, 230, 138, 0.12);
  color: var(--ready);
  border-color: rgba(253, 230, 138, 0.3);
}

.tree {
  font-family: monospace;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre;
}

.kv {
  display: block;
  position: relative;
  width: 100%;
}

.key {
  color: #93c5fd;
}

.num {
  color: #fca5a5;
}

.str {
  color: #86efac;
}

.str a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(134, 239, 172, 0.5);
  transition: text-decoration-color 0.2s ease, text-shadow 0.2s ease;
  text-shadow: 0 0 4px rgba(134, 239, 172, 0.3);
}

.str a:hover {
  text-decoration-color: #86efac;
  text-shadow: 0 0 8px rgba(134, 239, 172, 0.6);
}

.bool {
  color: #fcd34d;
}

.null {
  color: #a78bfa;
}

.toggle {
  display: inline-block;
  width: 1em;
  cursor: pointer;
  user-select: none;
  color: var(--accent);
  margin-right: 4px;
}

.braces {
  color: var(--muted);
}

.ellipsis {
  color: var(--muted);
  background: #0b1220;
  border: 1px solid var(--border);
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  min-width: 24px;
  margin: 0 2px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: saturate(120%) blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

[data-theme="light"] .modal {
  background: rgba(0, 0, 0, 0.3);
}

.modal.show {
  display: flex;
}

/* Hide modal when aria-hidden="true" */
.modal[aria-hidden="true"] {
  display: none !important;
}

/* Show modal when aria-hidden="false" */
.modal[aria-hidden="false"] {
  display: flex !important;
}

/* Mobile-specific modal styles */
.mobile-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9999 !important;
  background: rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(4px) !important;
}

.mobile-modal .modal-card {
  width: 95% !important;
  max-width: none !important;
  max-height: 90vh !important;
  margin: 5vh auto !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

.mobile-modal .modal-card header {
  flex-shrink: 0 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  background: var(--panel) !important;
}

.mobile-modal .modal-card .content {
  overflow-y: auto !important;
  flex: 1 !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 16px !important;
  overscroll-behavior: contain !important;
}

/* Prevent body scroll on mobile when modal is open */
body.modal-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

/* Mobile scrolling improvements */
@media (max-width: 768px) {
  .modal-card .content {
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
  }

  .modal-card {
    max-height: 95vh !important;
    margin: 2.5vh auto !important;
  }
}

/* Thought Bubble Component */
.thought-bubble-container {
  position: relative;
  display: inline-block;
}

.thought-bubble {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 15px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-width: 300px;
  min-width: 200px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

/* Dark mode thought bubble - make it stand out */
[data-theme="dark"] .thought-bubble {
  background: #1e293b;
  border: 2px solid #3b82f6;
  color: #f1f5f9;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.thought-bubble.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-10px);
}

/* Arrow direction for bubble above container */
.thought-bubble.above::before {
  top: 100%;
  bottom: auto;
  border-bottom: 12px solid var(--border);
  border-top: none;
}

.thought-bubble.above::after {
  top: 100%;
  bottom: auto;
  border-bottom: 10px solid var(--panel);
  border-top: none;
  margin-bottom: -2px;
  margin-top: 0;
}

/* Dark mode above arrow colors */
[data-theme="dark"] .thought-bubble.above::before {
  border-bottom: 12px solid #3b82f6;
}

[data-theme="dark"] .thought-bubble.above::after {
  border-bottom: 10px solid #1e293b;
}

.thought-bubble::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: var(--arrow-position, 50%);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 12px solid var(--border);
}

.thought-bubble::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: var(--arrow-position, 50%);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--panel);
  margin-bottom: -2px;
}

/* Dark mode arrow colors */
[data-theme="dark"] .thought-bubble::before {
  border-bottom: 12px solid #3b82f6;
}

[data-theme="dark"] .thought-bubble::after {
  border-bottom: 10px solid #1e293b;
}

/* Shimmer Animation */
@keyframes shimmer {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0.3);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.shimmer {
  animation: shimmer 1.5s ease-out;
  border-radius: 8px;
}

/* Dark mode shimmer */
[data-theme="dark"] .shimmer {
  animation: shimmer-dark 1.5s ease-out;
}

@keyframes shimmer-dark {
  0% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.7);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(96, 165, 250, 0.3);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0);
  }
}

/* Mobile responsive thought bubble */
@media (max-width: 768px) {
  .thought-bubble {
    max-width: 250px;
    min-width: 180px;
    font-size: 13px;
    padding: 10px 14px;
  }
}

.modal-card {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 840px;
  width: 92%;
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Mobile-specific modal styles */
@media (max-width: 768px) {
  .modal-card {
    width: 95%;
    max-height: 90vh;
    margin: 10px;
    border-radius: 8px;
  }

  .modal-card header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-card header h2 {
    font-size: 14px;
    flex: 1;
    min-width: 0;
  }

  .modal-card header>div {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
  }

  .language-selector {
    min-width: 120px;
    font-size: 11px;
  }

  .theme-toggle,
  .close {
    padding: 6px 8px;
    font-size: 11px;
    min-width: 40px;
  }

  .modal-card .content {
    padding: 12px;
  }

  .modal-card .content h2 {
    font-size: 16px;
    margin: 12px 0 8px;
  }

  .modal-card .content p {
    font-size: 14px;
    line-height: 1.4;
  }

  .modal-card code {
    font-size: 12px;
    padding: 2px 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-weight: 500;
    line-height: 1.3;
  }
}

.modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 10;
}

.modal-card h2 {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

.modal-card .close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  /* Mobile-friendly touch targets */
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--border);
  color: var(--text);
}

.modal-card .content {
  padding: 16px;
}

.modal-card .content h3 {
  margin: 16px 0 6px;
  font-size: 14px;
  color: var(--muted);
}

.modal-card .content p {
  margin: 6px 0 10px;
}

.modal-card code {
  background: #0b1220 !important;
  border: 1px solid var(--border) !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
  font-size: 13px !important;
  color: #e5e7eb !important;
  font-weight: 500 !important;
  display: inline-block !important;
  line-height: 1.4 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
  position: relative !important;
}

/* Enhanced code highlighting classes */
.modal-card code.highlight-root {
  color: #60a5fa;
  /* Blue for root */
}

.modal-card code.highlight-find {
  color: #fbbf24;
  /* Yellow for find */
}

.modal-card code.highlight-array {
  color: #f472b6;
  /* Pink for array access */
}

.modal-card code.highlight-property {
  color: #34d399;
  /* Green for property access */
}

.modal-card code.highlight-string {
  color: #fbbf24;
  /* Yellow for strings */
}

.info {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 12px 16px 0;
  padding: 12px;
}

.info h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.info ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.info code {
  background: #0b1220;
  border: 1px solid var(--border);
  padding: 0 6px;
  border-radius: 6px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  max-width: 400px;
  word-break: break-all;
}

.toast.show {
  opacity: 1;
  visibility: visible;
}

.context-menu {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 200;
  min-width: 200px;
  max-width: 300px;
}

.context-menu.show {
  opacity: 1;
  visibility: visible;
}

.context-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-item:hover {
  background: var(--border);
}

.context-item:first-child {
  border-radius: 8px 8px 0 0;
}

.context-item:last-child {
  border-radius: 0 0 8px 8px;
}

/* Light mode button adjustments */
[data-theme="light"] .btn {
  background: #f5f2ed;
  color: var(--text);
  border-color: var(--border);
}

[data-theme="light"] .btn:hover {
  border-color: #d4c4b0;
  background: #ede7dd;
}

[data-theme="light"] .btn-ghost {
  background: transparent;
  color: var(--muted);
}

[data-theme="light"] .btn-ghost:hover {
  background: #f5f2ed;
  color: var(--text);
}

[data-theme="light"] .info-btn {
  background: #f5f2ed;
  border-color: var(--border);
  color: var(--muted);
}

[data-theme="light"] .info-btn:hover {
  background: #ede7dd;
}

[data-theme="light"] .language-selector {
  background: #f5f2ed;
  border-color: var(--border);
  color: var(--muted);
}

[data-theme="light"] .language-selector:hover {
  background: #ede7dd;
  color: var(--text);
}


/* Light mode code highlighting */
[data-theme="light"] .key {
  color: #1d4ed8;
}

[data-theme="light"] .num {
  color: #dc2626;
}

[data-theme="light"] .str {
  color: #16a34a;
}

[data-theme="light"] .str a {
  color: inherit;
  text-decoration-color: rgba(22, 163, 74, 0.5);
  text-shadow: 0 0 4px rgba(22, 163, 74, 0.3);
}

[data-theme="light"] .str a:hover {
  text-decoration-color: #16a34a;
  text-shadow: 0 0 8px rgba(22, 163, 74, 0.6);
}

[data-theme="light"] .bool {
  color: #ca8a04;
}

[data-theme="light"] .null {
  color: #7c3aed;
}

[data-theme="light"] .modal-card code {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* Light mode highlighting classes */
[data-theme="light"] .modal-card code.highlight-root {
  color: #2563eb !important;
  /* Softer blue for light mode */
}

[data-theme="light"] .modal-card code.highlight-find {
  color: #ea580c !important;
  /* Softer orange for light mode */
}

[data-theme="light"] .modal-card code.highlight-array {
  color: #c026d3 !important;
  /* Softer purple for light mode */
}

[data-theme="light"] .modal-card code.highlight-property {
  color: #16a34a !important;
  /* Softer green for light mode */
}

[data-theme="light"] .modal-card code.highlight-string {
  color: #ea580c !important;
  /* Softer orange for light mode */
}

[data-theme="light"] .ellipsis {
  background: #f5f2ed;
  border-color: var(--border);
}


/* Light mode copy button */
[data-theme="light"] .copy-btn {
  color: #374151;
  background: var(--panel);
  border-color: var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .copy-btn:hover {
  color: #0ea5e9;
  opacity: 0.7;
}

/* Autocomplete styles */
.autocomplete-container {
  position: relative;
  margin-top: 8px;
}

.autocomplete-suggestions {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.autocomplete-suggestion {
  padding: 8px 12px;
  cursor: pointer;
  font-family: monospace;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

.autocomplete-suggestion:last-child {
  border-bottom: none;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.selected {
  background: rgba(34, 211, 238, 0.1);
  color: var(--accent);
}

.autocomplete-suggestion .highlight {
  color: var(--accent);
  font-weight: bold;
}

.autocomplete-suggestion.find-suggestion {
  background: rgba(34, 211, 238, 0.05);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.autocomplete-suggestion.find-suggestion:hover,
.autocomplete-suggestion.find-suggestion.selected {
  background: rgba(34, 211, 238, 0.15);
  border-left-color: var(--accent);
}

/* Light mode autocomplete */
[data-theme="light"] .autocomplete-suggestions {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .autocomplete-suggestion:hover,
[data-theme="light"] .autocomplete-suggestion.selected {
  background: rgba(14, 165, 233, 0.1);
  color: var(--accent);
}

/* Light mode result highlight */
[data-theme="light"] .resultbox.new-result {
  background: rgba(14, 165, 233, 0.1);
  animation: resultHighlightLight 1.5s ease-out;
}

@keyframes resultHighlightLight {
  0% {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--accent);
  }

  100% {
    background: var(--panel);
    border-color: var(--border);
  }
}

/* Go to top button */
.go-to-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.3);
  /* Remove default button styles */
  padding: 0;
  margin: 0;
  outline: none;
}

.go-to-top-btn:hover {
  background: var(--panel);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 211, 238, 0.4);
}

.go-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

.go-to-top-btn img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
  transition: filter 0.3s ease;
}

.go-to-top-btn:hover img {
  filter: brightness(0) saturate(100%) invert(52%) sepia(98%) saturate(2090%) hue-rotate(170deg) brightness(98%) contrast(101%);
}

/* Light mode go-to-top button */
[data-theme="light"] .go-to-top-btn {
  background: var(--accent);
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

[data-theme="light"] .go-to-top-btn:hover {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

[data-theme="light"] .go-to-top-btn img {
  filter: brightness(0) invert(1);
}

[data-theme="light"] .go-to-top-btn:hover img {
  filter: brightness(0) saturate(100%) invert(52%) sepia(98%) saturate(2090%) hue-rotate(170deg) brightness(98%) contrast(101%);
}

/* Mobile adjustments for go-to-top button */
@media (max-width: 768px) {
  .go-to-top-btn {
    bottom: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
  }

  .go-to-top-btn img {
    width: 20px;
    height: 20px;
  }
}

/* Snackbar notification */
.snackbar {
  position: fixed;
  bottom: 80px;
  /* Above the go-to-top button */
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  /* Start hidden below */
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  /* Above go-to-top button */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snackbar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.snackbar span {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

/* Light mode snackbar */
.light .snackbar {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Mobile snackbar adjustments */
@media (max-width: 768px) {
  .snackbar {
    bottom: 70px;
    max-width: 95vw;
    padding: 10px 16px;
  }

  .snackbar span {
    font-size: 13px;
  }
}

/* Result synchronization status */
.result.not-synchronized {
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.result.not-synchronized .resultbox {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.sync-status {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85em;
}

/* Light mode sync status */
[data-theme="light"] .sync-status {
  color: var(--muted);
}