body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f5f5f5;
  color: #000;
}

.container {
  padding: 20px;
  max-width: 1350px;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}

.panel {
  background: #ffffff;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #ccc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel:first-child {
  min-height: 70vh;
}

.panel.controls {
  position: sticky;
  max-height: calc(100vh - 85px);
  overflow-y: auto;
}

.hint {
  font-size: 13px;
  color: #084887;
  margin: -4px 0 12px;
}

label {
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  color: #333;
}

input[type="range"] {
  width: 100%;
}

.btn {
  padding: 6px 10px;
  border-radius: 4px;
  background: #e0e0e0;
  color: #000;
  border: 1px solid #aaa;
  cursor: pointer;
}

.btn.primary {
  background: #4caf50;
  border-color: #43a047;
  color: #fff;
}

.btn.danger {
  background: #e53935;
  border-color: #c62828;
  color: #fff;
}

.slope {
  border: 1px solid #ccc;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  position: relative;
  background: #fafafa;
}

.slope input[type="text"] {
  width: 65%;
  margin-top: 2px;
  margin-bottom: 10px;
  padding: 6px;
  background: #fff;
  color: #000;
  border: 1px solid #bbb;
  border-radius: 5px;
}

.slope-row {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.slope-row input[type="range"] {
  flex: 3;
}

.slope-row input[type="number"] {
  padding: 4px;
  width: 10%;
}

.slope label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
  margin-top: 20px;
}

.slope select {
  width: 100%;
  border-radius: 4px;
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 45px;
}

.chip {
  padding: 4px 8px;
  border: 1px solid #bbb;
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  display: inline-block;
  margin-right: 4px;
  margin-top: 4px;
  background: #eee;
}

svg {
  background: #ffffff;
  border-radius: 10px;
  width: 100%;
  border: 1px solid #ccc;
}

.result-table div {
  display: grid;
  grid-template-columns: 40px 1fr 120px 60px 60px 80px 80px 80px;
  /* #, name, object, angle, mu, a, v, time */
  padding: 4px;
  border-bottom: 1px solid #ddd;
  font-size: 0.8rem;
  color: #333;
}

.result-table div:first-child {
  font-weight: 700;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.delete-btn {
  position: absolute;
  width: 25%;
  height: 28px;
  top: 12px;
  right: 6px;
  font-size: 10px;
  padding: 3px 6px;
  margin-right: 2px;
}

@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
  }
}

body.dark {
  background: #000 !important;
  color: #fff !important;
}

body.dark .panel {
  background: #111 !important;
  border-color: #333 !important;
  box-shadow: none !important;
  color: #fff !important;
}

body.dark label {
  color: #ccc !important;
}

body.dark .hint {
  color: #9ab0ff;
}

body.dark .btn {
  background: #222 !important;
  color: #fff !important;
  border-color: #555 !important;
}

body.dark .slope {
  background: #000 !important;
  border-color: #444 !important;
}

body.dark .slope input[type="text"] {
  background: #000;
  color: #fff;
  border-color: #555;
}

body.dark .slope select {
  background: #000;
  color: #fff;
  border-color: #555;
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 45px;
}

body.dark .chip {
  background: #222 !important;
  border-color: #555 !important;
  color: #fff !important;
}

body.dark svg {
  background: #000 !important;
  border-color: #444 !important;
}

body.dark .result-table div {
  color: #eee !important;
  border-color: #444 !important;
}

/* Hide the spin buttons in WebKit browsers */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

@media (max-width: 1300px) {
  .panel.controls {
    max-height: calc(100vh - 60px);
  }
}
