* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(88, 101, 242, 0.18), transparent 28%),
    radial-gradient(circle at top left, rgba(0, 200, 150, 0.12), transparent 25%),
    linear-gradient(135deg, #0b1020, #111827 45%, #0f172a);
  color: #f3f4f6;
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.app-card {
  width: 100%;
  max-width: 1100px;
  background: rgba(17, 24, 39, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.header {
  margin-bottom: 18px;
}

.header h1 {
  margin: 0 0 10px;
  font-size: 32px;
  line-height: 1.2;
  color: #ffffff;
}

.header p {
  margin: 0;
  color: #cbd5e1;
  font-size: 16px;
}

.top-actions {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.link-btn {
  display: inline-block;
  text-decoration: none;
  background: #1f2937;
  color: #f9fafb;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.link-btn:hover {
  transform: translateY(-1px);
}

.form-section,
.output-section,
.history-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 20px;
}

.form-section {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: #e5e7eb;
}

input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0b1220;
  color: #f9fafb;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 18px;
}

input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

#editor {
  width: 100%;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 18px;
  background: #0b1220;
}

.buttons,
.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary-btn {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.28);
}

.secondary-btn {
  background: #1f2937;
  color: #f9fafb;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.danger-btn {
  background: #7f1d1d;
  color: #ffffff;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.output-header h2 {
  margin: 0;
  font-size: 22px;
}

#statusMessage {
  color: #93c5fd;
  font-size: 14px;
  min-height: 20px;
}

pre {
  margin: 0;
  background: #020617;
  border-radius: 16px;
  padding: 18px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 320px;
}

code {
  color: #d1fae5;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  direction: ltr;
  text-align: left;
  display: block;
}

.run-result {
  margin: 0;
  background: #020617;
  border-radius: 16px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 320px;
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  color: #e2e8f0;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
}

.history-list {
  display: grid;
  gap: 16px;
}

.history-card h3 {
  margin: 0 0 10px;
  color: #ffffff;
}

.history-meta {
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 12px;
}

.empty-state {
  color: #cbd5e1;
  text-align: center;
  padding: 30px 10px;
}

@media (max-width: 900px) {
  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-card {
    padding: 18px;
    border-radius: 18px;
  }

  .header h1 {
    font-size: 26px;
  }

  .buttons,
  .history-actions {
    flex-direction: column;
  }

  button,
  .link-btn {
    width: 100%;
    text-align: center;
  }

  #editor,
  pre,
  .run-result {
    min-height: 220px;
    height: 300px;
  }
}


#editor,
#editor * {
  direction: ltr !important;
  text-align: left !important;
}

.monaco-editor,
.monaco-editor-background,
.monaco-editor .margin,
.monaco-editor .inputarea,
.monaco-editor .lines-content,
.monaco-editor .view-lines {
  direction: ltr !important;
  text-align: left !important;
}