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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0f;
  color: #e0e0e0;
  overflow: hidden;
}

body {
  display: flex;
}

#sidebar {
  width: 320px;
  min-width: 320px;
  height: 100vh;
  background: #12121a;
  border-right: 1px solid #2a2a3a;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
  z-index: 10;
}

/* Status bar */
#status-bar {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#status-bar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

#status-bar .dot.idle { background: #555; }
#status-bar .dot.waiting { background: #f0a030; animation: pulse-slow 2s ease-in-out infinite; }
#status-bar .dot.picking { background: #f0a030; animation: pulse-slow 2s ease-in-out infinite; }
#status-bar .dot.building { background: #f0a030; animation: pulse-fast 0.8s ease-in-out infinite; }

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes pulse-fast {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Epoch bar */
#epoch-bar {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

#epoch-count {
  color: #b0b0ff;
  font-weight: 600;
}

#epoch-num {
  font-variant-numeric: tabular-nums;
}

#countdown {
  color: #888;
}

#countdown-time {
  color: #e0e0e0;
  font-variant-numeric: tabular-nums;
}

/* Submit form */
#submit-form {
  margin-bottom: 16px;
}

#submit-form textarea {
  width: 100%;
  height: 80px;
  background: #1a1a2e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  color: #e0e0e0;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

#submit-form textarea:focus {
  outline: none;
  border-color: #6060c0;
}

#submit-form .form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

#char-count {
  font-size: 12px;
  color: #666;
}

#char-count.warn { color: #f0a030; }
#char-count.over { color: #f04040; }

#submit-btn {
  background: #4040a0;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
}

#submit-btn:hover { background: #5050b0; }
#submit-btn:disabled { opacity: 0.4; cursor: default; }

#submit-error {
  color: #f04040;
  font-size: 12px;
  margin-top: 4px;
  min-height: 16px;
}

/* Prompt list */
#prompt-section h2 {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

#prompt-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

#prompt-list .empty {
  color: #555;
  font-size: 13px;
  font-style: italic;
  padding: 12px 0;
}

.prompt-item {
  background: #1a1a2e;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.prompt-item .vote-btn {
  background: none;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  color: #888;
  font-size: 13px;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
  flex-shrink: 0;
}

.prompt-item .vote-btn:hover { border-color: #6060c0; color: #b0b0ff; }
.prompt-item .vote-btn.voted { border-color: #4040a0; color: #6060c0; cursor: default; }

.prompt-item .vote-count {
  font-weight: 600;
  font-size: 15px;
}

.prompt-item .prompt-text {
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  flex: 1;
}

.prompt-item.picked {
  border: 1px solid #30d060;
  background: #1a2e1a;
  animation: picked-glow 1.5s ease-in-out infinite alternate;
}

@keyframes picked-glow {
  from { box-shadow: 0 0 4px rgba(48, 208, 96, 0.3); }
  to   { box-shadow: 0 0 12px rgba(48, 208, 96, 0.6); }
}

/* Main content (iframe) */
#content {
  flex: 1;
  height: 100vh;
  position: relative;
}

#agent-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #0a0a0f;
}

/* Result overlay */
#result-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a1a2e;
  border: 1px solid #30d060;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  max-width: 360px;
  z-index: 100;
  display: none;
}

#result-toast.visible { display: block; }

#result-toast .result-title {
  color: #30d060;
  font-weight: 600;
  margin-bottom: 4px;
}

#result-toast .result-summary {
  color: #ccc;
}
