* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0d0d0d;
  color: #e8e8e8;
  min-height: 100vh;
}

/* ===== PASSWORD PAGE ===== */
#password-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  background: linear-gradient(135deg, #0d0d0d 0%, #1a0a2e 50%, #0d0d0d 100%);
}

.lock-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 48px 40px;
  text-align: center;
  width: 360px;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.lock-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.lock-box h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lock-box p {
  color: #888;
  font-size: 14px;
  margin-bottom: 28px;
}

.pw-hint {
  font-size: 12px;
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
  border: 1px dashed rgba(167, 139, 250, 0.25);
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-style: italic;
}

.pw-input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 16px;
  letter-spacing: 4px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 14px;
}

.pw-input:focus {
  border-color: #7c3aed;
}

.pw-input.error {
  border-color: #ef4444;
  animation: shake 0.3s;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  75% {
    transform: translateX(8px);
  }
}

.pw-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.pw-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.pw-btn:active {
  transform: translateY(0);
}

.pw-error {
  color: #ef4444;
  font-size: 13px;
  margin-top: 10px;
  display: none;
}

/* Footer credit */
.site-footer {
  text-align: center;
  padding: 28px 16px 36px;
  font-size: 13px;
  color: #666;
  letter-spacing: 0.3px;
}

.pw-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.footer-name {
  font-weight: 600;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-heart {
  color: #ef4444;
  animation: heartbeat 1.4s ease-in-out infinite;
  display: inline-block;
}

@keyframes heartbeat {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.25);
  }
}

/* ===== MAIN PAGE ===== */
#main-page {
  display: none;
  min-height: 100vh;
}

header {
  padding: 20px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

@media (max-width: 700px) {
  header {
    justify-content: flex-start;
    padding: 16px 20px;
  }
}

header h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header .badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.4);
  color: #a78bfa;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* API Keys section */
.api-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.api-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 20px;
}

.api-card.gpt {
  border-top: 3px solid #10b981;
}

.api-card.gemini {
  border-top: 3px solid #3b82f6;
}

.api-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #ccc;
}

.dot-gpt {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.dot-gemini {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b82f6;
}

.api-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: #e8e8e8;
  font-size: 13px;
  font-family: monospace;
  outline: none;
  transition: border-color 0.2s;
}

.api-input:focus {
  border-color: rgba(255, 255, 255, 0.3);
}

.model-select {
  cursor: pointer;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.model-select option {
  background: #1a1a1a;
  color: #e8e8e8;
}

.dual-select {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
}

/* Thinking toggle */
.thinking-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.thinking-toggle {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  transition: background 0.25s, border-color 0.25s;
  flex-shrink: 0;
}

.thinking-toggle.on {
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  border-color: #7c3aed;
}

.thinking-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transition: left 0.25s;
}

.thinking-toggle.on .thinking-knob {
  left: 21px;
}

.thinking-label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

.thinking-toggle.on+.thinking-label {
  color: #a78bfa;
}

.error-card {
  border-radius: 14px;
  padding: 14px 18px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.6;
}

/* Topic input */
.topic-section {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 28px;
}

.topic-label {
  font-size: 13px;
  font-weight: 600;
  color: #aaa;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.topic-row {
  display: flex;
  gap: 12px;
}

.topic-input {
  flex: 1;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.topic-input:focus {
  border-color: #7c3aed;
}

.run-btn {
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.run-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Config row */
.config-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.config-row label {
  font-size: 13px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 8px;
}

.round-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.4);
  color: #e8e8e8;
  font-size: 13px;
  outline: none;
}

/* Debate area */
.debate-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.debater-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
}

.debater-tag.gpt {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.debater-tag.gemini {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.debater-tag .ai-icon {
  font-size: 20px;
}

#debate-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  animation: fadeSlide 0.4s ease;
}

.message-wrap .empty-col {
  visibility: hidden;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-card {
  border-radius: 14px;
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.7;
  position: relative;
}

.msg-card.gpt {
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.msg-card.gemini {
  background: rgba(59, 130, 246, 0.07);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.msg-round {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.msg-card.gpt .msg-round {
  color: #10b981;
}

.msg-card.gemini .msg-round {
  color: #60a5fa;
}

/* Loading indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: typingBounce 1s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typingBounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.typing-dot.gpt {
  background: #10b981;
}

.typing-dot.gemini {
  background: #60a5fa;
}

/* Status bar */
#status-bar {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: #666;
  display: none;
}

#status-bar.active {
  display: block;
  color: #a78bfa;
}

/* Summary */
#summary-section {
  display: none;
  margin-top: 24px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  border-top: 3px solid #f59e0b;
}

#summary-section h3 {
  color: #f59e0b;
  font-size: 15px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#summary-text {
  font-size: 14px;
  line-height: 1.8;
  color: #ccc;
}

/* Error toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #ef4444;
  color: #fff;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  animation: slideIn 0.3s ease;
  display: none;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 700px) {
  .api-section {
    grid-template-columns: 1fr;
  }

  .debate-header {
    grid-template-columns: 1fr;
  }

  .message-wrap {
    grid-template-columns: 1fr;
  }

  .message-wrap .empty-col {
    display: none;
  }

  .topic-row {
    flex-direction: column;
  }
}
