* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; margin: 0; color: #1b1b1b; background: #fafafa; }
header { padding: 24px; background: #1f2937; color: #f9fafb; }
header h1 { margin: 0 0 8px; font-size: 24px; }
header p { margin: 0; opacity: 0.9; }
main { padding: 16px; max-width: 1100px; margin: 0 auto; }

.controls { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.controls label { display: block; font-weight: 600; margin-bottom: 8px; }
.controls .row { display: flex; gap: 8px; }
.controls input { flex: 1; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; }
.controls button { padding: 10px 16px; background: #2563eb; color: white; border: none; border-radius: 6px; cursor: pointer; }
.controls small { display: block; margin-top: 8px; color: #6b7280; }

#status { margin-bottom: 12px; color: #374151; }
.hidden { display: none !important; }

/* Modal Styles */
.modal {
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #fefefe;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.close-btn {
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  color: #64748b;
}

.close-btn:hover {
  color: #1e293b;
}

.summary { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.summary .score { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 16px; width: 180px; text-align: center; }
.summary .value { font-size: 36px; font-weight: 700; }
.summary .badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { 
  display: inline-block;
  padding: 4px 10px; 
  border-radius: 999px; 
  font-size: 12px;
  font-weight: 600;
  margin-right: 5px;
  background: #eef2ff; 
  color: #1e40af; 
  border: 1px solid #c7d2fe; 
}

.badge.priority {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge.basic {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

button.primary {
  background: #2563eb;
  color: white;
  border: none;
  font-weight: bold;
}

button.primary:hover {
  background: #1d4ed8;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.panel { 
  background: rgba(255, 255, 255, 0.8); 
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(229, 231, 235, 0.5); 
  border-radius: 12px; 
  padding: 16px; 
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  overflow: hidden;
}

#comparison-grid .panel:first-child { border-top: 4px solid #2563eb; }
#comparison-grid .panel:last-child { border-top: 4px solid #7c3aed; }

#battle-header {
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.kv .key { color: #374151; overflow: hidden; text-overflow: ellipsis; }
.kv .value { font-weight: 600; word-break: break-all; }

.history-row {
  cursor: pointer;
  transition: background 0.2s;
}

.history-row:hover {
  background: #f8fafc;
}

.pricing-card {
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  border: 2px solid #2563eb;
  border-radius: 12px;
  background: #f0f7ff;
}

.pricing-card .price {
  font-size: 32px;
  font-weight: 800;
  color: #1e40af;
  margin-bottom: 16px;
  text-align: center;
}

.pricing-card .price span {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
}

.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.pricing-card li {
  margin-bottom: 10px;
  font-size: 14px;
}

.scrollable-content {
  height: 320px;
  overflow-y: auto;
  padding-right: 8px;
}

#rationale .item {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3f4f6;
  overflow-wrap: break-word;
  word-break: break-word;
}

#rationale .item:last-child {
  border-bottom: none;
}

pre, code { 
  white-space: pre-wrap; 
  word-break: break-all; 
  overflow-wrap: break-word; 
  max-height: 400px; 
  overflow: auto; 
  background: #0b1020; 
  color: #d1e7ff; 
  padding: 12px; 
  border-radius: 6px;
  max-width: 100%;
  display: block;
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 12px; margin-bottom: 8px; width: 100%; }
.skeleton-title { height: 24px; margin-bottom: 16px; width: 60%; }
.skeleton-rect { height: 100px; width: 100%; margin-bottom: 16px; }

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  background: #1e293b;
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.3s ease-out;
}

.toast.error { border-left: 4px solid #ef4444; }
.toast.success { border-left: 4px solid #10b981; }

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
