body {
  margin: 0;
}

.playground-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: var(--playground-bg);
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  overflow: hidden;
}

.playground-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--secondary-color);
  color: white;
  padding: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
}

.playground-header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: bold;
}

.header-icon-button {
  background: none;
  border: none;
  color: var(--header-icon-color);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.header-icon-button:hover {
  background-color: var(--hover-bg);
}

.save-status {
  display: flex;
  align-items: center;
}

.save-status-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.save-status-item.saved {
  color: var(--success-color);
}

.save-status-item.saving {
  color: var(--info-color);
}

.save-status-item.unsaved {
  color: var(--warning-color);
}

.current-file-path {
  color: light-dark(#cbd5e0, #a0aec0);
  font-family: monospace;
  font-size: 11px;
}

.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.playground-content {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.playground-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: light-dark(var(--dark-color), var(--secondary-color));
  color: white;
  padding: 4px 12px;
  min-height: 24px;
  font-size: 12px;
  border-top: 1px solid light-dark(#2c5282, #3e3e42);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.footer-icon-button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  transition: background-color 0.15s;
}

.footer-icon-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.cursor-position {
  font-family: monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.footer-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.execution-time {
  background-color: light-dark(rgba(103, 184, 227, 0.15), rgba(103, 184, 227, 0.2));
  color: var(--header-title-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.footer-diagnostic {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
}

.footer-diagnostic-error {
  color: light-dark(#fc8181, #fc8181);
  background-color: light-dark(rgba(252, 129, 129, 0.12), rgba(252, 129, 129, 0.15));
}

.footer-diagnostic-warning {
  color: light-dark(#f6ad55, #f6ad55);
  background-color: light-dark(rgba(246, 173, 85, 0.12), rgba(246, 173, 85, 0.15));
}

.file-tree-panel {
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.left-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.right-panel {
  flex: 1;
  min-width: 0;
}

.editor-container {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.editor {
  height: 100%;
}

.right-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 32px;
  background-color: var(--secondary-color);
  color: var(--light-color);
  padding: 4px;
  gap: 8px;
}

.editor-header.output {
  border-bottom: none;
  justify-content: flex-end;
  height: auto;
  min-height: 32px;
}

.editor-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  color: var(--light-color);
  padding: 4px;
  gap: 4px;
}

.editor-header h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  margin-left: 4px;
  padding: 4px;
}

.editor-content {
  flex: 1;
  overflow: hidden;
}

.button {
  background-color: transparent;
  color: var(--button-color);
  border: none;
  padding: 4px 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
}

.run-button {
  padding: 4px 16px;
}

.button:hover {
  color: var(--button-hover-color);
  font-weight: 600;
}

.save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
}

.save-button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}

.format-button:disabled,
.run-button:disabled {
  background-color: var(--disabled-bg);
  cursor: not-allowed;
}

.result-container {
  height: 100%;
}

.loading-message,
.empty-message {
  padding: 16px;
  background-color: var(--secondary-color);
  height: 100%;
}

:root {
  color-scheme: light dark;

  /* Common values that don't change between modes */
  --accent-blue: light-dark(#4299e1, #5dade2);

  /* Light/dark mode values */
  --primary-color: light-dark(#3182ce, #3a8ec5);
  --secondary-color: light-dark(#f7fafc, #2a2a2a);
  --dark-color: light-dark(#2c5282, #1a4c6b);
  --light-color: light-dark(#ffffff, #e8f4fc);
  --lighter-blue: light-dark(#ebf8ff, #1e2a38);
  --text-color: light-dark(#2d3748, #e2e8f0);
  --code-bg: light-dark(#f7fafc, #2d3748);
  --select-fg: light-dark(#333, #d4d4d4);
  --select-bg: light-dark(#f5f5f5, #2d2d30);
  --border: light-dark(#ccc, #3e3e42);
  --header-icon-color: light-dark(#ffffff, #cccccc);
  --success-color: light-dark(#48bb78, #68d391);
  --info-color: light-dark(#4299e1, #63b3ed);
  --warning-color: light-dark(#ed8936, #f6ad55);
  --hover-bg: light-dark(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1));
  --playground-bg: light-dark(#f0f4f8, #1e1e1e);
  --button-color: light-dark(#3182ce, #63b3ed);
  --button-hover-color: light-dark(#2c5282, #88acd2);
  --disabled-bg: light-dark(#a0aec0, #4a5568);
  --header-title-color: light-dark(#67b8e3, #5dade2);

  /* File tree colors */
  --tree-bg: light-dark(#f7fafc, #252526);
  --tree-border: light-dark(#e2e8f0, #3e3e42);
  --tree-header-bg: light-dark(#edf2f7, #2d2d30);
  --tree-title-color: light-dark(#4a5568, #cccccc);
  --tree-item-color: light-dark(#2d3748, #cccccc);
  --tree-item-hover-bg: light-dark(#edf2f7, #2a2d2e);
  --tree-item-selected-bg: light-dark(#bee3f8, #37373d);
  --tree-item-selected-color: light-dark(#2c5282, #ffffff);
  --tree-empty-color: light-dark(#718096, #858585);
  --scrollbar-track: light-dark(#f7fafc, #252526);
  --scrollbar-thumb: light-dark(#cbd5e0, #424242);
  --scrollbar-thumb-hover: light-dark(#a0aec0, #4e4e4e);

  /* Context menu colors */
  --context-menu-bg: light-dark(#ffffff, #2d2d30);
  --context-menu-item-hover-bg: light-dark(#edf2f7, #37373d);
}

.playground-header {
  background-color: light-dark(var(--dark-color), var(--secondary-color));
  color: white;
}

.editor-header {
  background-color: light-dark(#edf2f7, var(--secondary-color));
  color: light-dark(var(--text-color), var(--light-color));
}

.loading-message,
.empty-message {
  color: light-dark(#718096, #a0aec0);
  background-color: light-dark(#f7fafc, var(--secondary-color));
}

.logo-icon {
  width: 32px;
  height: 32px;
  background-color: transparent;
}

/* Tablet breakpoint - maintains horizontal layout */
@media (max-width: 1024px) and (min-width: 769px) {
  .editor-header {
    height: auto;
    min-height: 32px;
    padding: 4px 2px;
  }

  .editor-actions {
    flex-wrap: wrap;
    gap: 2px;
    padding: 2px;
  }

  .dropdown {
    padding: 4px 8px;
    font-size: 12px;
    margin-right: 4px;
  }

  .button {
    padding: 4px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .run-button {
    padding: 4px 12px;
    font-weight: 700;
  }

  .label {
    font-size: 12px;
    margin-left: 2px;
  }

  .label div {
    white-space: nowrap;
  }

  .editor-header h2 {
    font-size: 0.75rem;
  }

  .editor-header.code,
  .editor-header.output {
    height: auto;
    min-height: 40px;
  }
}

/* Mobile breakpoint - stacks vertically */
@media (max-width: 768px) {

  .footer-left {
    gap: 8px;
  }

  .current-file-path {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .left-panel,
  .right-panel {
    width: 100%;
    flex: 1;
  }

  .playground-content {
    flex-direction: column;
    overflow-y: auto;
  }

  .editor-container {
    height: auto;
    min-height: 250px;
  }

  .editor-content {
    min-height: 150px;
  }

  .editor-header {
    flex-wrap: wrap;
  }

  .editor-header.code,
  .editor-header.output {
    height: auto;
  }

  .editor-header h2 {
    font-size: 0.75rem;
  }

  .editor-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 2px;
  }

  .format-button,
  .run-button {
    padding: 3px 8px;
    font-size: 0.75rem;
  }

  .button span {
    display: none;
  }

  .button {
    padding: 4px;
    gap: 0;
  }

  .run-button {
    padding: 4px 8px;
  }

  .file-tree-panel {
    width: 100%;
    height: 300px;
    border-bottom: 1px solid var(--tree-border);
  }
}

.dropdown {
  appearance: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  margin-right: 8px;
  background-color: var(--select-bg);
  border: 1px solid var(--border);
  color: var(--select-fg);
}

.label {
  margin-left: 4px;
  display: flex;
  align-items: center;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  color: var(--text-color);
}

.tab-container {
  display: flex;
  background-color: light-dark(#e8eef5, #252526);
  border-bottom: 1px solid light-dark(#d0d7de, #3e3e42);
  overflow-x: auto;
  overflow-y: hidden;
  height: 35px;
  align-items: center;
  gap: 0;
}

.tab-container::-webkit-scrollbar {
  height: 3px;
}

.tab-container::-webkit-scrollbar-track {
  background: transparent;
}

.tab-container::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.tab-container::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background-color: transparent;
  border: none;
  border-right: 1px solid light-dark(#d0d7de, #3e3e42);
  color: light-dark(#586069, #969696);
  white-space: nowrap;
  transition: background-color 0.1s;
  height: 100%;
}

.tab:hover {
  background-color: light-dark(#f3f4f6, #2d2d30);
}

.tab.active {
  background-color: light-dark(#ffffff, #1e1e1e);
  color: light-dark(#24292e, #cccccc);
  border-bottom: 2px solid var(--accent-blue);
}

/* Tab bar for file tabs */
.tab-bar {
  display: flex;
  background-color: light-dark(#e8eef5, #252526);
  border-bottom: 1px solid light-dark(#d0d7de, #3e3e42);
  overflow-x: auto;
  overflow-y: hidden;
  height: 35px;
  align-items: center;
}

.tab-bar::-webkit-scrollbar {
  height: 3px;
}

.tab-bar::-webkit-scrollbar-track {
  background: transparent;
}

.tab-bar::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.tab-bar::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.tab-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 6px 8px;
  cursor: pointer;
  background-color: transparent;
  border-right: 1px solid light-dark(#d0d7de, #3e3e42);
  color: light-dark(#586069, #969696);
  font-size: 12px;
  white-space: nowrap;
  transition: background-color 0.1s;
  min-width: 100px;
  max-width: 200px;
}

.tab-item:hover {
  background-color: light-dark(#f3f4f6, #2d2d30);
}

.tab-item.active {
  background-color: light-dark(#ffffff, #1e1e1e);
  color: light-dark(#24292e, #cccccc);
  border-bottom: 2px solid var(--accent-blue);
}

.tab-content {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-dirty-indicator {
  color: light-dark(#d97706, #f59e0b);
  flex-shrink: 0;
}

.tab-close-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: light-dark(#6a737d, #858585);
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.1s, background-color 0.1s;
  flex-shrink: 0;
}

.tab-item:hover .tab-close-button {
  opacity: 1;
}

.tab-item.active .tab-close-button {
  opacity: 1;
}

.tab-close-button:hover {
  background-color: light-dark(#e1e4e8, #3e3e42);
  color: light-dark(#24292e, #cccccc);
}

/* ── mq theme ─────────────────────────────────────────────────── */
[data-theme="mq"] {
  --primary-color: #67b8e3;
  --secondary-color: #2a3444;
  --dark-color: #1e293b;
  --light-color: #e2e8f0;
  --lighter-blue: #1e2a38;
  --text-color: #e2e8f0;
  --code-bg: #1e293b;
  --select-fg: #e2e8f0;
  --select-bg: #2a3444;
  --border: #4a5568;
  --header-icon-color: #94a3b8;
  --success-color: #68d391;
  --info-color: #67b8e3;
  --warning-color: #f6ad55;
  --hover-bg: rgba(103, 184, 227, 0.12);
  --playground-bg: #1e293b;
  --button-color: #67b8e3;
  --button-hover-color: #85d4ff;
  --disabled-bg: #3d4a5c;
  --header-title-color: #85d4ff;
  --accent-blue: #67b8e3;

  /* file tree */
  --tree-bg: #1e293b;
  --tree-border: #4a5568;
  --tree-header-bg: #232e3d;
  --tree-title-color: #94a3b8;
  --tree-item-color: #e2e8f0;
  --tree-item-hover-bg: #2a3444;
  --tree-item-selected-bg: #32404f;
  --tree-item-selected-color: #e2e8f0;
  --tree-empty-color: #94a3b8;
  --scrollbar-track: #1e293b;
  --scrollbar-thumb: #4a5568;
  --scrollbar-thumb-hover: #5a6778;

  /* context menu */
  --context-menu-bg: #232e3d;
  --context-menu-item-hover-bg: #32404f;
}

[data-theme="mq"] .playground-header {
  background-color: #2a3444;
  border-bottom: 1px solid #4a5568;
}

[data-theme="mq"] .playground-footer {
  background-color: #1e293b;
  border-top: 1px solid #4a5568;
}

[data-theme="mq"] .editor-header {
  background-color: #2a3444;
  color: #e2e8f0;
}

[data-theme="mq"] .loading-message,
[data-theme="mq"] .empty-message {
  background-color: #2a3444;
  color: #94a3b8;
}

[data-theme="mq"] .tab-container,
[data-theme="mq"] .tab-bar {
  background-color: #1e293b;
  border-bottom: 1px solid #4a5568;
}

[data-theme="mq"] .tab,
[data-theme="mq"] .tab-item {
  color: #94a3b8;
  border-right: 1px solid #4a5568;
}

[data-theme="mq"] .tab:hover,
[data-theme="mq"] .tab-item:hover {
  background-color: #232e3d;
}

[data-theme="mq"] .tab.active,
[data-theme="mq"] .tab-item.active {
  background-color: #2a3444;
  color: #e2e8f0;
  border-bottom: 2px solid #67b8e3;
}

[data-theme="mq"] .tab-close-button {
  color: #94a3b8;
}

[data-theme="mq"] .tab-close-button:hover {
  background-color: #32404f;
  color: #e2e8f0;
}

[data-theme="mq"] .settings-dialog {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="mq"] .settings-header {
  border-bottom: 1px solid #4a5568;
}

[data-theme="mq"] .settings-close-btn {
  color: #94a3b8;
}

[data-theme="mq"] .settings-close-btn:hover {
  background-color: #2a3444;
  color: #e2e8f0;
}

[data-theme="mq"] .settings-select {
  background-color: #2a3444;
  border: 1px solid #4a5568;
  color: #e2e8f0;
}

[data-theme="mq"] .dropdown {
  background-color: #2a3444;
  border: 1px solid #4a5568;
  color: #e2e8f0;
}
