html, body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: system-ui;
  overflow: hidden;
  transition: background 0.5s ease;
}

#canvas {
  display: block;
  margin: auto;
  width: 100vw;
  height: 100vh;
  transition: opacity 0.3s ease;
}

.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.screen.active {
  display: flex;
}

.screen-header {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-btn {
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
  color: #d4af37;
  border: 1px solid #d4af37;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.back-btn:hover {
  background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
}

.controls-wrapper {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 10px;
}

.controls-wrapper::-webkit-scrollbar {
  display: none;
}

.controls {
  display: inline-flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.8);
  padding: 15px 25px;
  border-radius: 30px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  backdrop-filter: blur(10px);
  min-width: max-content;
  margin: 0 auto;
}

.btn {
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
  color: #d4af37;
  border: 1px solid #d4af37;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn:hover {
  background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.btn.active {
  background: linear-gradient(135deg, #d4af37, #b8941f);
  color: #000;
  border-color: #d4af37;
}

.hud {
  position: fixed;
  top: 15px;
  left: 15px;
  font-size: 12px;
  opacity: 0.7;
  color: #d4af37;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
  z-index: 10;
}

.copyright {
  position: fixed;
  top: 15px;
  right: 15px;
  font-size: 11px;
  opacity: 0.6;
  color: #d4af37;
  text-align: right;
  line-height: 1.4;
  z-index: 10;
  max-width: 200px;
}

/* Stopwatch Screen */
.stopwatch-screen .stopwatch-display {
  font-size: clamp(60px, 15vw, 120px);
  font-weight: bold;
  color: #d4af37;
  margin: 40px 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.stopwatch-screen .stopwatch-controls {
  display: flex;
  gap: 20px;
}

.stopwatch-screen .stopwatch-btn {
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
  color: #d4af37;
  border: 2px solid #d4af37;
  padding: 15px 40px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
}

.stopwatch-screen .stopwatch-btn:hover {
  background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* World Clock Screen */
.world-clock-screen .world-list {
  width: 90%;
  max-width: 600px;
  margin: 20px 0;
  max-height: 60vh;
  overflow-y: auto;
}

.world-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 20px 25px;
  margin: 10px 0;
  border-radius: 15px;
  font-size: 18px;
}

.world-item .city-name {
  color: #d4af37;
  font-weight: 600;
}

.world-item .city-time {
  color: #fff;
  font-size: 24px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.world-item .delete-btn {
  background: #8b0000;
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 10px;
  cursor: pointer;
  margin-left: 15px;
}

.add-city-btn {
  background: linear-gradient(135deg, #d4af37, #b8941f);
  color: #000;
  border: none;
  padding: 15px 40px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  margin-top: 20px;
}

.add-city-btn:hover {
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Alarm Screen */
.alarm-screen .alarm-list {
  width: 90%;
  max-width: 600px;
  margin: 20px 0;
  max-height: 60vh;
  overflow-y: auto;
}

.alarm-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 20px 25px;
  margin: 10px 0;
  border-radius: 15px;
}

.alarm-item .alarm-time {
  color: #d4af37;
  font-size: 32px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

.alarm-item .alarm-label {
  color: #fff;
  font-size: 14px;
  margin-top: 5px;
}

.alarm-item .alarm-toggle {
  width: 60px;
  height: 30px;
  background: #333;
  border-radius: 15px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

.alarm-item .alarm-toggle.active {
  background: #d4af37;
}

.alarm-item .alarm-toggle::after {
  content: '';
  width: 26px;
  height: 26px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.3s;
}

.alarm-item .alarm-toggle.active::after {
  left: 32px;
}

.alarm-item .delete-btn {
  background: #8b0000;
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 10px;
  cursor: pointer;
  margin-left: 15px;
}

.add-alarm-btn {
  background: linear-gradient(135deg, #d4af37, #b8941f);
  color: #000;
  border: none;
  padding: 15px 40px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  margin-top: 20px;
}

.add-alarm-btn:hover {
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

/* Modal for adding items */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #1a1a1a;
  border: 2px solid #d4af37;
  border-radius: 20px;
  padding: 30px;
  max-width: 400px;
  width: 90%;
}

.modal-content h2 {
  color: #d4af37;
  margin-top: 0;
}

.modal-content input,
.modal-content select {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  background: #2a2a2a;
  border: 1px solid #d4af37;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-buttons button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}

.modal-buttons .confirm-btn {
  background: #d4af37;
  color: #000;
}

.modal-buttons .cancel-btn {
  background: #333;
  color: #fff;
}

/* Color themes */
body.theme-arabic {
  background: linear-gradient(135deg, #0a4b78, #1a5f8f) !important;
}

body.theme-arabic .btn {
  color: #4ade80;
  border-color: #4ade80;
}

body.theme-arabic .btn.active {
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #000;
}

body.theme-arabic .hud,
body.theme-arabic #canvas {
  filter: hue-rotate(180deg) saturate(1.2);
}

body.theme-roman {
  background: linear-gradient(135deg, #4a4a4a, #6a6a6a) !important;
}

body.theme-roman .btn {
  color: #cd7f32;
  border-color: #cd7f32;
}

body.theme-roman .btn.active {
  background: linear-gradient(135deg, #cd7f32, #b87333);
  color: #000;
}
