.ai-pilot-overlay {
  position: absolute;
  z-index: 490;
  top: clamp(0px, calc(100% - 240px), 146px);
  left: 10px;
  width: max-content;
  max-width: calc(100% - 20px);
  max-height: calc(100% - 10px);
  box-sizing: border-box;
  padding: 0;
  border: 0;
  color: #dff8ff;
  background: transparent;
  font: 12px/1.5 system-ui, sans-serif;
  white-space: normal;
  overflow: hidden;
  pointer-events: auto;
  cursor: default;
  text-shadow: 0 1px 4px #00101e;
}
.ai-pilot-header {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 148px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 2px;
  border: 1px solid #38e9ff55;
  border-radius: 18px;
  background: rgb(34 180 255 / .2);
}
.ai-pilot-overlay .float-drag-handle {
  display: flex;
  flex: 0 0 18px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  color: #38e9ff;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.ai-pilot-control {
  flex: 1;
  min-width: 0;
  min-height: 26px;
  padding: 2px;
  border: 0;
  border-radius: 7px;
  color: #baff82;
  background: transparent;
  font: 800 10px system-ui, sans-serif;
  letter-spacing: .05em;
  cursor: pointer;
}
.ai-pilot-control[aria-pressed="true"] { color: #eab7ff; background: #d56bff18; }
.ai-pilot-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #38e9ff88;
  border-radius: 50%;
  color: #38e9ff;
  background: transparent;
  cursor: pointer;
}
.ai-pilot-toggle[aria-expanded="true"] { color: #d56bff; border-color: #d56bff99; }
.ai-pilot-toggle svg { width: 25px; height: 25px; transform-origin: center; transition: transform 260ms ease-out; }
.ai-pilot-overlay button:focus-visible { outline: 2px solid #a7ff24; outline-offset: 1px; }
.ai-pilot-chat {
  width: 300px;
  height: 250px;
  min-width: min(180px, 100%);
  min-height: min(150px, calc(100dvh - 60px));
  max-width: 100%;
  margin-top: 5px;
  box-sizing: border-box;
  resize: both;
  overflow: hidden;
  border: 1px solid #38e9ff40;
  border-radius: 10px;
  background: rgb(34 180 255 / .2);
}
.ai-pilot-live-status { flex: 0 0 auto; padding: 4px 7px; color: #c8f4ff; font: 11px/1.3 system-ui,sans-serif; border-bottom: 1px solid #38e9ff55; }
.ai-pilot-chat .duel-chat-messages { padding: 6px; }
.ai-pilot-chat .duel-chat-line { background: transparent; }
.ai-pilot-chat .duel-chat-form { background: transparent; padding: 5px; }
.ai-pilot-chat .duel-chat-form input { background: #03172526; }
.ai-pilot-chat .duel-chat-form button { background: #103a4b44; }
body.ai-pilot-active #controlTable,
body.ai-pilot-active :is(#rotateXButton, #rotateYButton, #rotateZButton, #DropPieceButton) { pointer-events: none; opacity: .4; }
.game-column.duel-active .ai-pilot-overlay,
.game-column.turn-based-ai .ai-pilot-overlay { display: none; }
@media (prefers-reduced-motion: reduce) { .ai-pilot-toggle svg { transition: none; } }
