:root {
    color-scheme: light;
    --bg: #ffffff;
    --panel: #f7f7f7;
    --border: #e3e3e3;
    --text: #111111;
    --muted: #6d6d6d;
    --accent: #111111;
    --accent-hover: #000000;
    --success: #1f8a4d;
    --error: #c72c41;
  }

  .theme-toggle {
    position: fixed;
    top: 18px;
    right: 18px;
    width: auto;
    height: auto;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.2s ease, transform 0.15s ease;
  }
  
  .theme-toggle:hover {
    background: var(--accent);
    color: #000;
    transform: scale(1.05);
  }
  
  .theme-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
  }
  
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
  }
  
  .app-header {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
  }
  
  .app-header h1 {
    margin: 0;
    font-size: 2.6rem;
    font-weight: 600;
  }
  
  .progress-label {
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: var(--muted);
  }
  
  .app-layout {
    max-width: 960px;
    margin: 1.5rem auto 3rem;
    display: flex;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg);
    min-height: 520px;
  }
  
  .editor-pane,
  .info-pane {
    padding: 1.25rem;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .editor-pane {
    flex: 0 0 60%;
    border-right: 1px solid var(--border);
  }
  
  .info-pane {
    flex: 0 0 40%;
  }
  
  .editor-container {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    height: auto;
    min-height: 0;
  }
  
  .problem-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
  }
  
.problem-description {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
  }
  
  .difficulty-tag {
    margin-top: 0.4rem;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--muted);
    display: inline-block;
  }
  
  .controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  
  button {
    border-radius: 999px;
    padding: 0.6rem 1.3rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
  }
  
  button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }
  
  .primary-btn {
    border-color: var(--accent);
  }
  
  .primary-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #fff;
  }
  
  .secondary-btn:hover:not(:disabled),
  .ghost-btn:hover:not(:disabled) {
    background: var(--panel);
  }
  
  .ghost-btn {
    color: var(--muted);
  }
  
.results-section {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    background: var(--panel);
  }
  
  .results-placeholder {
    margin: 0;
    color: var(--muted);
  }
  
  .test-row {
    border-bottom: 1px solid #dedede;
    padding: 0.9rem 0;
    display: grid;
    gap: 0.4rem;
  }
  
  .test-row:last-child {
    border-bottom: none;
  }
  
  .test-status {
    font-weight: 700;
  }
  
  .test-status.pass {
    color: var(--success);
  }
  
  .test-status.fail {
    color: var(--error);
  }
  
  .test-detail {
    font-size: 0.9rem;
    color: var(--muted);
  }
  
  .loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    color: var(--text);
    z-index: 999;
    transition: opacity 0.4s ease;
  }
  
  .loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
  }
  
  .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
  }
  
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
  
  .results-section .test-status.pass::before {
    content: "✓ ";
  }
  
  .results-section .test-status.fail::before {
    content: "✕ ";
  }
  
  @media (max-width: 980px) {
    .app-layout {
      flex-direction: column;
      border-radius: 12px;
    }
  
    .editor-pane {
      border-right: none;
      border-bottom: 1px solid var(--border);
    }
  
    .editor-container {
      min-height: 360px;
    }
  }
  
  @media (max-width: 640px) {
    .app-header,
    .app-layout {
      margin: 0 1rem;
    }
  
    button {
      width: 100%;
      justify-content: center;
    }
  }

  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.75rem;
    padding: 0.45rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background: #fff;
    transition: background 0.2s ease, color 0.2s ease;
  }
  
  .back-link:hover {
    background: var(--accent);
    color: #fff;
  }

  .console-output {
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    background: #1e1e1e;
    color: #f0f0f0;
    overflow-x: auto;
  }

  .console-output h3 {
    margin-top: 0;
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 0.5rem;
  }

  .console-output pre {
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    font-size: 0.9rem;
  }

  .hidden {
    display: none !important;
  }