:root {
  --purple-dark:  #3D0C40;
  --purple-mid:   #7B2D8B;
  --purple-light: #C8A0D0;
  --purple-bg:    #F8F5FA;
  --white:        #ffffff;
  --text:         #1a1a1a;
  --text-muted:   #888;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--purple-bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  background: var(--purple-dark);
}
.logo-wrap {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: white;
  padding: 5px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.header-title { color: white; font-size: 1.2rem; font-weight: 700; }
.header-sub   { color: var(--purple-light); font-size: 0.82rem; }

/* ── Views ── */
#app { max-width: 960px; margin: 0 auto; padding: 24px 16px 40px; }
.view { display: none; }
.view.active { display: block; }

/* ── Select view ── */
.subtitle {
  text-align: center;
  color: var(--purple-dark);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.doc-upload {
  background: white;
  border: 2px dashed var(--purple-light);
  border-radius: 14px;
  padding: 20px 24px;
  margin-top: 24px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.doc-upload:hover {
  border-color: var(--purple-mid);
  background: #f3eaf7;
}
.doc-icon { font-size: 1.6rem; flex-shrink: 0; }
.doc-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.doc-label    { color: var(--purple-dark); font-size: 1rem; font-weight: 600; }
.doc-sublabel { color: var(--text-muted); font-size: 0.82rem; }
.doc-name     { font-size: 0.85rem; color: var(--purple-mid); font-style: italic; margin-left: auto; }
#doc-input    { display: none; }

/* ── Shark grid ── */
.shark-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.shark-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  text-align: left;
}
.shark-card:hover {
  border-color: var(--purple-mid);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(61, 12, 64, 0.15);
}
.shark-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top;
  display: block;
}
.card-label {
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--purple-dark);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.card-label span {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ── Session layout ── */
.session-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* ── Session left ── */
.session-left img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  object-position: top;
  border-radius: 16px;
  display: block;
  margin-bottom: 16px;
}
.scorecard-box {
  background: white;
  border-radius: 12px;
  padding: 16px;
}
#verdict-btn {
  width: 100%;
  margin-bottom: 12px;
}
.verdict-placeholder {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Session right ── */
.session-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding-top: 16px;
}
.status-box {
  font-size: 0.95rem;
  color: var(--purple-mid);
  text-align: center;
  padding: 12px 20px;
  background: white;
  border-radius: 12px;
  width: 100%;
}

/* ── Controls ── */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.controls.hidden { display: none; }
.hint { font-size: 0.8rem; color: var(--text-muted); }

/* ── Talk button ── */
.talk-btn {
  width: 140px; height: 140px;
  border-radius: 50%;
  border: none;
  background: var(--purple-dark);
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 6px 20px rgba(61, 12, 64, 0.35);
}
.talk-btn:hover {
  background: var(--purple-mid);
  transform: scale(1.05);
}
.talk-btn.talking {
  background: #c0392b;
  box-shadow: 0 6px 20px rgba(192, 57, 43, 0.5);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

/* ── Buttons ── */
.btn-secondary {
  background: white;
  border: 2px solid var(--purple-light);
  color: var(--purple-dark);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--purple-bg); }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--purple-mid);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.2s;
}
.btn-ghost:hover { background: rgba(61, 12, 64, 0.08); }

/* ── Score card styles (injected via /api/verdict) ── */
.scorecard { font-family: inherit; }
.sc-score  { font-size: 1.8rem; font-weight: 700; color: var(--purple-dark); margin-bottom: 12px; }
.sc-section { margin-bottom: 12px; }
.sc-label   { font-weight: 600; color: var(--purple-dark); margin-bottom: 6px; font-size: 0.9rem; }
.badge {
  padding: 4px 12px;
  border-radius: 20px;
  margin: 3px 2px;
  display: inline-block;
  font-size: 0.82rem;
}
.sc-summary {
  background: var(--purple-bg);
  border-left: 3px solid var(--purple-mid);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  color: #444;
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ── Loading overlay ── */
.loading {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}
.loading.hidden { display: none; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading p { color: white; font-size: 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 640px) {
  .shark-grid    { grid-template-columns: 1fr; }
  .session-layout { grid-template-columns: 1fr; }
}
