/* ThoughtSift — Share Landing Page Styles
   Bic pen aesthetic: stroke #1a1a2e, bg #f5f5f0
   Page chrome: dark #0C0B14 */

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

:root {
  --ts-bg: #0C0B14;
  --ts-surface: #16151f;
  --ts-text: #e8e8f0;
  --ts-text-dim: #8a8a9e;
  --ts-accent: #6c63ff;
  --ts-accent-hover: #5a52e0;
  --ts-bic-stroke: #1a1a2e;
  --ts-bic-bg: #f5f5f0;
  --ts-error: #e04040;
  --ts-success: #40c060;
  --ts-font: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }

body {
  font-family: var(--ts-font);
  background: var(--ts-bg);
  color: var(--ts-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */

.ts-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ts-logo {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ts-text);
}

/* ---- Main ---- */

.ts-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

.ts-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---- Loading ---- */

.ts-spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid rgba(255,255,255,0.1);
  border-top-color: var(--ts-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.ts-loading-text {
  color: var(--ts-text-dim);
  font-size: 14px;
}

/* ---- Error ---- */

.ts-error-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(224, 64, 64, 0.15);
  color: var(--ts-error);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.ts-error-text {
  color: var(--ts-text-dim);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ---- Expired ---- */

.ts-expired-icon { margin-bottom: 20px; opacity: 0.6; }

.ts-expired-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
}

.ts-expired-text {
  color: var(--ts-text-dim);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.ts-expired-brand {
  font-size: 13px;
  font-weight: 500;
  color: var(--ts-text-dim);
  letter-spacing: 0.04em;
  opacity: 0.5;
}

/* ---- PIN gate ---- */

.ts-pin-icon { margin-bottom: 16px; opacity: 0.7; }

.ts-pin-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.ts-pin-text {
  color: var(--ts-text-dim);
  font-size: 14px;
  margin-bottom: 24px;
}

.ts-pin-form {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.ts-pin-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 18px;
  font-family: var(--ts-font);
  letter-spacing: 0.2em;
  text-align: center;
  background: var(--ts-surface);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--ts-text);
  outline: none;
  transition: border-color 0.2s;
}

.ts-pin-input:focus {
  border-color: var(--ts-accent);
}

.ts-pin-error {
  color: var(--ts-error);
  font-size: 13px;
  margin-top: 12px;
}

.ts-pin-lockout {
  color: var(--ts-error);
  font-size: 14px;
  font-weight: 500;
  margin-top: 16px;
  padding: 12px 20px;
  background: rgba(224, 64, 64, 0.1);
  border-radius: 8px;
}

/* ---- Buttons ---- */

.ts-btn {
  font-family: var(--ts-font);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px 20px;
  transition: background 0.15s, opacity 0.15s;
}

.ts-btn:disabled { opacity: 0.5; cursor: default; }

.ts-btn-primary {
  background: var(--ts-accent);
  color: #fff;
}

.ts-btn-primary:hover:not(:disabled) { background: var(--ts-accent-hover); }

.ts-btn-secondary {
  background: var(--ts-surface);
  color: var(--ts-text);
  border: 1px solid rgba(255,255,255,0.1);
}

.ts-btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.08); }

/* ---- Diagram section ---- */

.ts-diagram-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.ts-canvas-wrap {
  width: 100%;
  background: var(--ts-bic-bg);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.ts-canvas-wrap canvas {
  display: block;
  width: 100%;
}

.ts-canvas-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: rgba(26, 26, 46, 0.35);
  pointer-events: none;
}

/* ---- Audio ---- */

.ts-audio-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--ts-surface);
  border-radius: 10px;
}

.ts-btn-audio {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  color: var(--ts-text);
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
  white-space: nowrap;
}

.ts-btn-audio svg { flex-shrink: 0; }

.ts-audio-progress {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.ts-audio-progress-fill {
  height: 100%;
  width: 0;
  background: var(--ts-accent);
  border-radius: 2px;
  transition: width 0.25s linear;
}

.ts-audio-time {
  font-size: 12px;
  color: var(--ts-text-dim);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ts-audio-error {
  color: var(--ts-text-dim);
  font-size: 13px;
  margin-top: 12px;
}

/* ---- Bullet points ---- */

.ts-bullets {
  width: 100%;
  margin-top: 20px;
  text-align: left;
}

.ts-bullets ul {
  list-style: none;
  padding: 0;
}

.ts-bullet-item {
  padding: 10px 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ts-text);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  animation: fadeInUp 0.4s ease both;
}

.ts-bullet-item:last-child { border-bottom: none; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Reaction overlay ---- */

.ts-reaction-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.ts-reaction-dialog {
  width: 100%;
  max-width: 400px;
  background: var(--ts-surface);
  border-radius: 16px 16px 12px 12px;
  padding: 20px;
}

.ts-reaction-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.ts-emoji-picker {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.ts-emoji-btn {
  font-size: 28px;
  background: none;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.ts-emoji-btn:hover { transform: scale(1.15); }
.ts-emoji-btn.selected { border-color: var(--ts-accent); background: rgba(108, 99, 255, 0.12); }

.ts-reaction-note {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--ts-font);
  font-size: 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--ts-text);
  resize: none;
  height: 60px;
  outline: none;
  margin-bottom: 16px;
}

.ts-reaction-note:focus { border-color: var(--ts-accent); }

.ts-reaction-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ---- Toast ---- */

.ts-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ts-surface);
  color: var(--ts-text);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 200;
  animation: fadeInUp 0.3s ease;
}

/* ---- Responsive ---- */

@media (max-width: 480px) {
  .ts-main { padding: 16px 12px 32px; }
  .ts-diagram-title { font-size: 16px; }
  .ts-emoji-btn { font-size: 24px; padding: 4px 6px; }
  .ts-pin-form { max-width: 240px; }
}
