body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
  margin: 0;
}

.container {
  position: relative;
  max-width: 1200px;
  margin: auto;
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  margin-top: 100px;
  margin-bottom: 100px;
}

h1 {
  color: #212529;
  text-align: center;
  margin-bottom: 30px;
}

.flex-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
}

.editor, .history {
  flex: 1 1 500px;
  min-width: 300px;
}

label {
  display: block;
  margin: 10px 0 5px;
  font-weight: bold;
}

input, textarea {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  font-family: monospace;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #f1f3f5;
  font-size: 16px;
}

.button-row {
  display: flex;
  gap: 10px;
}

.butn {
  padding: 12px 20px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn-run {
  background-color: #28a745;
}

.btn-run:hover {
  background-color: #218838;
}

.btn-step {
  background-color: #ffc107;
  color: #212529;
}

.btn-step:hover {
  background-color: #e0a800;
}

.btn-reset {
  background-color: #dc3545;
}

.btn-reset:hover {
  background-color: #c82333;
}

.result {
  margin-top: 20px;
  font-weight: bold;
  white-space: pre-wrap;
  padding: 15px;
  background-color: #e9ecef;
  border-radius: 6px;
}

.history {
  display: flex;
  flex-direction: column;
}

.history-table-container {
  overflow-y: auto;
  max-height: 400px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 15px;
  border-bottom: 1px solid #ccc;
  text-align: left;
  font-family: monospace;
}

th {
  background-color: #f0f0f0;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.9em;
  position: sticky;
  top: 0;
  background-clip: padding-box;
}

td.wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.back-link {
  text-align: center;
  margin-top: 40px;
}

.back-link a {
  text-decoration: none;
  color: #007bff;
}

.back-link a:hover {
  text-decoration: underline;
}

.flex-column {
  flex-direction: column !important;
}

.layout-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #dee2e6;
  color: #333;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
}

.layout-toggle:hover {
  background-color: #ced4da;
}

@media (max-width: 900px) {
  .flex-wrap {
    flex-direction: column;
  }
}
