*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #0f0f11;
  color: #f0f0f2;
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

.preview-area {
  flex: 1;
  height: 100%;
  background-color: #000000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: 340px;
  height: 100%;
  background-color: #18181c;
  border-left: 1px solid #2a2a30;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
  z-index: 10;
  overflow-x: hidden;
}

.sidebar-header .header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-with-lang {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #ffffff;
}

.sidebar-header p {
  font-size: 0.85rem;
  color: #8e8e99;
  margin-top: 4px;
}

.lang-select {
  background-color: #2a2a32;
  color: #ffffff;
  border: 1px solid #3f3f46;
  padding: 2px 6px;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.icon-btn {
  background: transparent;
  border: 1px solid #3f3f46;
  color: #a1a1aa;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
  background: #2a2a32;
  color: #ffffff;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.controls::-webkit-scrollbar {
  width: 6px;
}

.controls::-webkit-scrollbar-track {
  background: transparent;
}

.controls::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.controls::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #202026;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #2c2c34;
}

.control-group h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #a1a1aa;
  margin-bottom: 4px;
}

.control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: #d4d4d8;
  width: 100%;
}

.control-item span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select-input,
input[type="range"],
input[type="color"] {
  max-width: 55%;
}

.select-input {
  background-color: #2a2a32;
  color: #ffffff;
  border: 1px solid #3f3f46;
  padding: 6px 8px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  font-size: 0.85rem;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.select-input:focus {
  border-color: #6366f1;
}

input[type="color"] {
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}

input[type="range"] {
  accent-color: #6366f1;
  cursor: pointer;
  width: 100%;
}

.btn {
  width: 100%;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.btn-primary {
  background-color: #6366f1;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #4f46e5;
}

.btn-secondary {
  background-color: #27272a;
  color: #a1a1aa;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  color: #e4e4e7;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #71717a;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #ffffff;
}

.modal-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.2rem;
  color: #ffffff;
}

.modal-card p {
  font-size: 0.9rem;
  color: #a1a1aa;
  line-height: 1.4;
  margin-bottom: 12px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 16px;
  background-color: #27272a;
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}

.github-link:hover {
  background-color: #3f3f46;
}