body {
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  background: #1e1e1e;
  color: #e0e0e0;
  display: flex;
  height: 100vh;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font-size: 16px !important;
}

#left-panel {
  width: 50%;
  display: flex;
  flex-direction: column;
  border-right: 2px solid #3e3e42;
  background: #f4f4f4;
}

#blockly-header {
  background: #252526;
  padding: 10px 15px;
  border-bottom: 1px solid #3e3e42;
}

#blockly-header h1 {
  font-size: 1.1rem;
  color: #43aa8b;
  margin: 0 0 8px 0;
}

#blockly-header h1 img {
  max-width: 100%;
  height: auto;
}

#blockly-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

#blocklyDiv {
  height: 50vh;
  width: 100%;
  background: #fff;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

#blockly-output {
  flex: 1;
  background: #252526;
  padding: 10px 15px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid #3e3e42;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#right-panel {
  width: 50%;
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
}

#path-header {
  background: #252526;
  padding: 10px 15px;
  border-bottom: 1px solid #3e3e42;
}

#path-header h2 {
  font-size: 1.1rem;
  color: #f9c74f;
  margin: 0 0 8px 0;
}

#start-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
  flex-wrap: wrap;
}

#start-controls label {
  font-size: 0.85rem;
  color: #cccccc;
}

#partner-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px;
  background: #2d2d30;
  border-radius: 3px;
}

#partner-controls label {
  font-size: 0.85rem;
  color: #ff6b9d;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

#partner-toggle {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

#canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
  touch-action: none;
}

canvas {
  border: 2px solid #3e3e42;
  background: #2a2a2a;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  touch-action: none;
}

#animation-controls {
  background: #252526;
  border-top: 1px solid #3e3e42;
  border-bottom: 1px solid #3e3e42;
  padding: 10px 15px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

#timer-display {
  font-size: 0.95rem;
  font-weight: 600;
  color: #43aa8b;
  padding: 6px 12px;
  background: #2d2d30;
  border-radius: 3px;
  min-width: 200px;
  text-align: center;
}

#path-info {
  background: #252526;
  padding: 10px 15px;
  max-height: 120px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#path-info h3 {
  font-size: 0.9rem;
  color: #f9c74f;
  margin: 0 0 8px 0;
}

#waypoints-list {
  font-size: 0.8rem;
  color: #cccccc;
}

.waypoint-item {
  padding: 4px 6px;
  margin-bottom: 3px;
  background: #2d2d30;
  border-radius: 3px;
}

button, select {
  padding: 8px 12px;
  background: #43aa8b;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.2s;
  min-height: 44px;
  min-width: 44px;
}

button:hover {
  background: #388e75;
}

button:active {
  transform: scale(0.98);
  background: #2d7360;
}

#playBtn {
  min-width: 100px;
}

#resetBtn {
  background: #577590;
}

#resetBtn:hover {
  background: #465a72;
}

#resetBtn:active {
  background: #3a4a5c;
}

select {
  background: #3c3c3c;
  border: 1px solid #555;
  padding: 8px 12px;
  color: #e0e0e0;
  min-height: 44px;
}

#qr {
  margin-top: 10px;
  text-align: center;
  max-width: 100%;
}

#qr svg, #qr img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

#info {
  color: #888;
  font-size: 0.8rem;
  margin-top: 8px;
  text-align: center;
}

.info-text {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

@media (max-width: 1024px) and (orientation: portrait) {
  body { 
    flex-direction: column; 
  }
  
  #left-panel, #right-panel { 
    width: 100%; 
    height: 50vh;
  }
  
  #left-panel { 
    border-right: none; 
    border-bottom: 2px solid #3e3e42; 
  }
  
  #blocklyDiv {
    height: 30vh;
  }
  
  #blockly-header h1 img {
    width: 150px;
    height: auto;
  }
}

@media (max-width: 768px) {
  body { 
    flex-direction: column; 
  }
  
  #left-panel, #right-panel { 
    width: 100%; 
    height: 50vh;
  }
  
  #left-panel { 
    border-right: none; 
    border-bottom: 2px solid #3e3e42; 
  }
  
  #blocklyDiv {
    height: 25vh;
  }
  
  #blockly-output {
    padding: 8px 10px;
  }
  
  #blockly-header h1 img {
    width: 120px;
    height: auto;
  }
  
  #path-header h2 {
    font-size: 1rem;
  }
  
  #canvas-container {
    padding: 5px;
  }
  
  canvas {
    border-width: 1px;
  }
  
  #animation-controls {
    padding: 8px 10px;
    gap: 6px;
  }
  
  #timer-display {
    min-width: 150px;
    font-size: 0.85rem;
    padding: 6px 10px;
    min-height: auto;
  }
  
  #path-info {
    max-height: 80px;
    padding: 8px 10px;
  }
  
  button, select {
    font-size: 14px;
    padding: 10px 14px;
  }
}

@media (max-width: 480px) {
  #blockly-header h1 {
    font-size: 0.9rem;
  }
  
  #blockly-header h1 img {
    width: 100px;
    height: auto;
  }
  
  #path-header h2 {
    font-size: 0.9rem;
  }
  
  #blockly-controls {
    gap: 4px;
  }
  
  button, select {
    font-size: 13px;
    padding: 10px 12px;
    min-width: 40px;
  }
  
  #blocklyDiv {
    height: 22vh;
  }
  
  .waypoint-item {
    font-size: 0.75rem;
    padding: 3px 5px;
  }
  
  #timer-display {
    min-width: 130px;
    font-size: 0.75rem;
    padding: 5px 8px;
  }
  
  #animation-controls {
    gap: 5px;
    padding: 6px 8px;
  }
  
  #start-controls {
    gap: 6px;
  }
  
  #start-controls label {
    font-size: 0.75rem;
  }
  
  select {
    font-size: 13px;
    padding: 8px 10px;
  }
}

@media (max-width: 932px) and (orientation: landscape) {
  body {
    flex-direction: row;
  }
  
  #left-panel, #right-panel {
    width: 50%;
    height: 100vh;
  }
  
  #left-panel {
    border-right: 2px solid #3e3e42;
    border-bottom: none;
  }
  
  #blocklyDiv {
    height: 40vh;
  }
  
  #blockly-header h1 img {
    width: 100px;
    height: auto;
  }
  
  #path-info {
    max-height: 60px;
  }
}