/* Professional design system with improved typography and spacing */
:root {
  /* Color System */
  --background: #ffffff;
  --foreground: #1a1a1a;
  --card: #f8fafc;
  --card-foreground: #334155;
  --popover: #ffffff;
  --popover-foreground: #1a1a1a;
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #475569;
  --muted: #f8fafc;
  --muted-foreground: #64748b;
  --accent: #3b82f6;
  --accent-foreground: #ffffff;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #e2e8f0;
  --input: #f8fafc;
  --ring: rgba(37, 99, 235, 0.2);
  --radius: 8px;

  /* Spacing System */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Monaco", "Cascadia Code", monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark {
  --background: #0f172a;
  --foreground: #f1f5f9;
  --card: #1e293b;
  --card-foreground: #e2e8f0;
  --popover: #1e293b;
  --popover-foreground: #f1f5f9;
  --primary: #3b82f6;
  --primary-foreground: #ffffff;
  --secondary: #334155;
  --secondary-foreground: #cbd5e1;
  --muted: #1e293b;
  --muted-foreground: #94a3b8;
  --accent: #60a5fa;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #ffffff;
  --border: #334155;
  --input: #1e293b;
  --ring: rgba(59, 130, 246, 0.3);
}

/* Enhanced base styles with better typography */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  height: 100vh;
  overflow: hidden;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.playground-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: linear-gradient(135deg, var(--background) 0%, var(--muted) 100%);
}

/* Professional header with improved layout and spacing */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  min-height: 64px;
}

.dark .header {
  background: rgba(15, 23, 42, 0.95);
}

.header-section {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.pro-badge {
  background: linear-gradient(45deg, var(--primary), var(--accent));
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s infinite;
}

.connection-status.offline .status-dot {
  background: #ef4444;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.editor-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 var(--space-sm);
}

/* Enhanced button system with consistent styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--secondary) 80%, var(--foreground));
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  padding: var(--space-sm);
}

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

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-tiny {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Improved main content layout with better organization */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.workspace {
  display: flex;
  width: 100%;
  gap: 1px;
  background: var(--border);
}

.editors-section {
  flex: 1.2;
  display: flex;
  flex-direction: column;
  background: var(--background);
}

.output-section {
  flex: 0.8;
  display: flex;
  flex-direction: column;
  background: var(--background);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--card-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.layout-controls,
.output-controls {
  display: flex;
  gap: var(--space-xs);
}

/* Enhanced editor panels with professional styling */
.editors-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--background);
  position: relative;
}

.editor-panel[data-language="html"] .editor-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: #e34c26;
}

.editor-panel[data-language="css"] .editor-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: #1572b6;
}

.editor-panel[data-language="javascript"] .editor-header::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: #f7df1e;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.editor-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.editor-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--card-foreground);
}

.editor-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.editor-actions {
  display: flex;
  gap: var(--space-xs);
}

.editor-wrapper {
  flex: 1;
  position: relative;
}

.editor-wrapper.focused {
  box-shadow: 0 0 0 2px var(--accent);
  border-radius: var(--radius);
}

.code-editor {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  padding: var(--space-lg);
  background: var(--background);
  color: var(--foreground);
  tab-size: 2;
}

.code-editor::placeholder {
  color: var(--muted-foreground);
  font-style: italic;
}

/* Enhanced output section with better preview and console */
.output-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
}

.preview-panel {
  flex: 2;
  display: flex;
  flex-direction: column;
  background: var(--background);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.preview-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.preview-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--card-foreground);
}

.preview-url {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
}

.preview-wrapper {
  flex: 1;
  position: relative;
  background: #ffffff;
}

.dark .preview-wrapper {
  background: #ffffff;
}

#preview {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

.console-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--background);
  min-height: 200px;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.console-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.console-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--card-foreground);
}

.console-count {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  background: var(--muted);
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
}

.console-wrapper {
  flex: 1;
  overflow-y: auto;
}

.console-output {
  padding: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  background: var(--muted);
  color: var(--foreground);
  height: 100%;
}

.console-welcome {
  color: var(--muted-foreground);
  font-style: italic;
}

.console-prompt {
  color: var(--accent);
  font-weight: 600;
}

.console-log {
  margin: var(--space-sm) 0;
  padding: var(--space-sm);
  border-radius: 4px;
  border-left: 3px solid var(--border);
}

.console-log.console-error {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: #ef4444;
  color: #dc2626;
}

.console-log.console-warn {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: #f59e0b;
  color: #d97706;
}

.console-log.console-info {
  background: rgba(59, 130, 246, 0.1);
  border-left-color: #3b82f6;
  color: #2563eb;
}

/* Enhanced modal system with better UX */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.modal-content {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-xl);
}

.modal.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}

.modal-body {
  padding: var(--space-xl);
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.template-card {
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--card);
  position: relative;
  overflow: hidden;
}

.template-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.template-preview {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

.template-card h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--card-foreground);
  margin-bottom: var(--space-sm);
}

.template-card p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: var(--space-md);
}

.template-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.tag {
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 500;
}

.share-options {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.share-link {
  position: relative;
}

.share-link input {
  width: 100%;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.share-link input:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Adding missing offline page styles that were referenced but not defined */
.offline-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0a;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease;
}

.offline-page.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.glitch-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.glitch-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #ff0080, #00ff80, #8000ff, #ff8000);
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
  opacity: 0.1;
}

.circuit-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: circuitMove 10s linear infinite;
}

.offline-content {
  position: relative;
  text-align: center;
  z-index: 10;
}

.glitch-text {
  font-size: 4rem;
  font-weight: 900;
  color: #00ff00;
  text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00, 0 0 40px #00ff00;
  animation: glitch 2s infinite;
  margin-bottom: 2rem;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch-text::before {
  animation: glitch-1 0.5s infinite;
  color: #ff0080;
  z-index: -1;
}

.glitch-text::after {
  animation: glitch-2 0.5s infinite;
  color: #00ffff;
  z-index: -2;
}

.neon-text {
  color: #00ffff;
  text-shadow: 0 0 5px #00ffff, 0 0 10px #00ffff, 0 0 20px #00ffff;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.offline-message p {
  color: #ccc;
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.loading-animation {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0;
}

.loading-bar {
  width: 4px;
  height: 40px;
  background: linear-gradient(45deg, #ff0080, #00ff80);
  animation: loadingPulse 1.5s ease-in-out infinite;
}

.loading-bar:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-bar:nth-child(3) {
  animation-delay: 0.4s;
}

.neon-button {
  background: transparent;
  border: 2px solid #00ffff;
  color: #00ffff;
  padding: 1rem 2rem;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.neon-button:hover {
  background: rgba(0, 255, 255, 0.1);
  box-shadow: 0 0 20px #00ffff, inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.button-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.neon-button:hover .button-glow {
  left: 100%;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes circuitMove {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(50px, 50px);
  }
}

@keyframes glitch {
  0%,
  100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
}

@keyframes glitch-1 {
  0%,
  100% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 2px);
  }
  40% {
    transform: translate(-2px, -2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(2px, -2px);
  }
}

@keyframes glitch-2 {
  0%,
  100% {
    transform: translate(0);
  }
  20% {
    transform: translate(2px, -2px);
  }
  40% {
    transform: translate(2px, 2px);
  }
  60% {
    transform: translate(-2px, -2px);
  }
  80% {
    transform: translate(-2px, 2px);
  }
}

@keyframes loadingPulse {
  0%,
  100% {
    transform: scaleY(1);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1.5);
    opacity: 1;
  }
}

/* Add missing notification styles */
.notification {
  position: fixed;
  top: 80px;
  right: var(--space-xl);
  background: var(--primary);
  color: var(--primary-foreground);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 300px;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

/* Responsive design improvements */
@media (max-width: 480px) {
  .header {
    padding: var(--space-xs) var(--space-sm);
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .header-left {
    flex: 1;
    min-width: 0;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .logo {
    font-size: 1.2rem;
  }

  .pro-badge {
    font-size: 0.6rem;
    padding: 2px 6px;
  }

  .connection-status {
    font-size: 0.75rem;
  }

  .header-center {
    display: none;
  }

  .header-right {
    flex-shrink: 0;
  }

  .action-buttons {
    gap: var(--space-xs);
    flex-wrap: wrap;
  }

  .btn {
    padding: var(--space-xs);
    min-width: 36px;
    min-height: 36px;
  }

  .btn svg {
    width: 14px;
    height: 14px;
  }

  .main-content {
    padding: var(--space-xs);
  }

  .workspace {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .section-header {
    padding: var(--space-sm);
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .section-title {
    font-size: 1rem;
  }

  .editors-container {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .editor-panel {
    min-height: 200px;
  }

  .editor-header {
    padding: var(--space-xs) var(--space-sm);
  }

  .editor-title {
    font-size: 0.9rem;
  }

  .editor-subtitle {
    font-size: 0.75rem;
  }

  .code-editor {
    font-size: 12px;
    line-height: 1.4;
  }

  .output-container {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .preview-panel {
    min-height: 250px;
  }

  .console-panel {
    min-height: 120px;
  }

  .console-output {
    font-size: 11px;
  }

  .modal-content {
    margin: var(--space-sm);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }

  .templates-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .template-card {
    padding: var(--space-sm);
  }

  .offline-content {
    padding: var(--space-md);
  }

  .glitch-text {
    font-size: 1.5rem;
  }

  .neon-text {
    font-size: 1.2rem;
  }
}

/* Tablet portrait */
@media (min-width: 481px) and (max-width: 768px) {
  .header {
    padding: var(--space-sm) var(--space-md);
  }

  .header-center {
    display: none;
  }

  .action-buttons {
    gap: var(--space-xs);
  }

  .btn {
    padding: var(--space-sm);
  }

  .workspace {
    flex-direction: column;
  }

  .editors-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }

  .editor-panel:last-child {
    grid-column: 1 / -1;
  }

  .output-container {
    flex-direction: column;
  }

  .console-panel {
    min-height: 180px;
  }

  .templates-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet landscape and small desktop */
@media (min-width: 769px) and (max-width: 1024px) {
  .workspace {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .editors-section {
    flex: 1.2;
  }

  .output-section {
    flex: 0.7;
  }

  .editors-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }

  .output-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-md);
  }

  .console-panel {
    min-height: 200px;
  }
}

/* Large desktop */
@media (min-width: 1025px) {
  .workspace {
    flex-direction: row;
    gap: var(--space-xl);
  }

  .editors-section {
    flex: 1.2;
  }

  .output-section {
    flex: 1;
  }

  .editors-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }

  .output-container {
    flex-direction: column;
    gap: var(--space-lg);
  }

  .preview-panel {
    flex: 1.5;
  }

  .console-panel {
    flex: 1;
    min-height: 250px;
  }
}

/* Ultra-wide screens */
@media (min-width: 1440px) {
  .playground-container {
    max-width: 1400px;
    margin: 0 auto;
  }

  .workspace {
    gap: var(--space-2xl);
  }

  .editors-container {
    gap: var(--space-xl);
  }

  .output-container {
    gap: var(--space-xl);
  }
}

/* Touch-friendly improvements for mobile devices */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .code-editor {
    font-size: 16px; /* Prevents zoom on iOS */
    line-height: 1.5;
  }

  .editor-panel {
    touch-action: pan-y;
  }

  .console-output {
    -webkit-overflow-scrolling: touch;
  }

  .modal-content {
    -webkit-overflow-scrolling: touch;
  }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .status-dot {
    border-width: 0.5px;
  }

  .divider {
    width: 0.5px;
  }

  .editor-panel::before {
    border-width: 0.5px;
  }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .workspace {
    flex-direction: row;
  }

  .editors-section {
    flex: 1;
  }

  .output-section {
    flex: 1;
  }

  .editors-container {
    flex-direction: column;
    gap: var(--space-sm);
  }

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

  .output-container {
    flex-direction: column;
  }

  .preview-panel {
    flex: 1.5;
  }

  .console-panel {
    flex: 1;
    min-height: 100px;
  }
}

/* Print styles */
@media print {
  .header,
  .action-buttons,
  .output-section,
  .modal,
  .offline-page {
    display: none !important;
  }

  .playground-container {
    background: white;
    color: black;
  }

  .editors-container {
    display: block;
  }

  .editor-panel {
    break-inside: avoid;
    margin-bottom: 2rem;
  }

  .code-editor {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    font-size: 12px;
    line-height: 1.4;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .glitch-text::before,
  .glitch-text::after {
    animation: none;
  }

  .loading-bar {
    animation: none;
  }

  .neon-button .button-glow {
    animation: none;
  }
}

/* Focus management for keyboard navigation */
@media (prefers-reduced-motion: no-preference) {
  .btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    animation: focusPulse 2s infinite;
  }

  @keyframes focusPulse {
    0%,
    100% {
      outline-color: var(--accent);
    }
    50% {
      outline-color: transparent;
    }
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
