/* Voice Chess */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  background: #1d1f2b;
  color: #e8e9ee;
}

.vc-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.vc-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.9rem;
}

.vc-header p {
  margin: 0 0 1.25rem;
  color: #9ea3b8;
}

/* --- Mic row --- */

.vc-mic-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.vc-mic-btn.active {
  background: #b3403f;
  border-color: #b3403f;
  color: #fff;
}

.vc-mic-status {
  color: #9ea3b8;
  font-style: italic;
  min-height: 1.2em;
}

.vc-mic-status.live {
  color: #8fd08f;
}

.vc-mic-status.live::before {
  content: "●";
  color: #e05252;
  margin-right: 0.4rem;
  animation: vc-pulse 1.4s ease-in-out infinite;
}

.vc-mic-status.muted {
  color: #d9a441;
}

@keyframes vc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* --- Layout --- */

.vc-main {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-bottom: 2rem;
}

/* --- Board --- */

.vc-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: min(640px, calc(100vw - 2rem));
  aspect-ratio: 1;
  border: 3px solid #3a3e52;
  border-radius: 4px;
  flex-shrink: 0;
}

.vc-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.vc-square.selected {
  box-shadow: inset 0 0 0 3px #4a90d9;
}

.vc-square.drag-over {
  box-shadow: inset 0 0 0 3px #6fb36f;
}

.vc-square.light {
  background: #e9dbc0;
}

.vc-square.dark {
  background: #a98a63;
}

.vc-square.last-move.light {
  background: #ccd88a;
}

.vc-square.last-move.dark {
  background: #a8b35f;
}

.vc-square.in-check {
  background: radial-gradient(circle, #e05252 25%, transparent 75%);
}

.vc-piece {
  /* ~90% of the square (board is 640px → 80px squares) */
  font-size: clamp(38px, 10.5vw, 72px);
  line-height: 1;
  user-select: none;
  cursor: grab;
}

.vc-piece:active {
  cursor: grabbing;
}

.vc-piece.white {
  color: #fdfdfd;
  text-shadow: 0 0 2px #333, 0 1px 2px #333;
}

.vc-piece.black {
  color: #1b1b1b;
  text-shadow: 0 0 1px #999;
}

.vc-coord {
  position: absolute;
  font-size: 0.8rem;
  font-weight: 800;
  pointer-events: none;
}

.vc-square.light .vc-coord {
  color: #8a6d4a;
}

.vc-square.dark .vc-coord {
  color: #f0e4cb;
}

.vc-coord.rank {
  top: 2px;
  left: 4px;
}

.vc-coord.file {
  bottom: 1px;
  right: 4px;
}

/* --- Eval bar --- */

.vc-evalbar {
  position: relative;
  width: 26px;
  height: min(640px, calc(100vw - 2rem));
  border: 2px solid #3a3e52;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.vc-evalbar-black {
  background: #33353f;
  transition: height 0.4s ease;
}

.vc-evalbar-white {
  background: #f0f0f0;
  transition: height 0.4s ease;
}

.vc-evalbar-label {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.6rem;
  font-weight: 700;
}

.vc-evalbar-label.on-white {
  bottom: 4px;
  color: #333;
}

.vc-evalbar-label.on-black {
  top: 4px;
  color: #eee;
}

/* --- Side panel --- */

.vc-side {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vc-status {
  font-size: 1.1rem;
  font-weight: 600;
}

.vc-warning {
  background: #4a3524;
  border: 1px solid #8a5a2a;
  border-radius: 6px;
  color: #e8b36a;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
}

.vc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.vc-btn {
  background: #2d3142;
  color: #e8e9ee;
  border: 1px solid #454a63;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.vc-btn:hover {
  background: #3a3f57;
}

.vc-btn.toggled {
  background: #4a6b4a;
  border-color: #5d855d;
}

.vc-typed {
  display: flex;
  gap: 0.4rem;
}

.vc-typed input {
  flex: 1;
  background: #262a3a;
  border: 1px solid #454a63;
  border-radius: 6px;
  color: #e8e9ee;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
}

.vc-typed input::placeholder {
  color: #767b93;
}

/* --- Command log --- */

.vc-log {
  border: 1px solid #33374b;
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.5rem;
  background: #232636;
}

.vc-log-empty {
  color: #767b93;
  font-style: italic;
  padding: 0.4rem;
}

.vc-log-entry {
  display: flex;
  gap: 0.6rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88rem;
}

.vc-log-entry:nth-child(odd) {
  background: #272b3d;
}

.vc-log-cmd {
  color: #9ea3b8;
  flex-shrink: 0;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vc-log-entry.ok .vc-log-result {
  color: #8fd08f;
}

.vc-log-entry.err .vc-log-result {
  color: #e08b8b;
}

/* --- Help panel --- */

.vc-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 18, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.vc-help {
  border: 1px solid #454a63;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  background: #232636;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

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

.vc-help-header h3 {
  margin: 0;
}

.vc-help-section h4 {
  margin: 1rem 0 0.4rem;
  color: #b8bdd4;
}

.vc-help table {
  border-collapse: collapse;
  width: 100%;
}

.vc-help td {
  padding: 0.25rem 0.75rem 0.25rem 0;
  vertical-align: top;
  font-size: 0.9rem;
}

.vc-help-cmd {
  white-space: nowrap;
  color: #8fd08f;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.vc-help-tip {
  color: #9ea3b8;
  font-style: italic;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .vc-main {
    justify-content: center;
  }
}
