:root {
  --ink-950: #17072f;
  --ink-900: #20104d;
  --ink-800: #33206d;
  --ink-700: #4e38a5;
  --violet-500: #886ef7;
  --violet-300: #c9bbff;
  --aqua-500: #64d7d8;
  --aqua-200: #d8fbfb;
  --peach-400: #ff9b78;
  --peach-200: #ffe1d6;
  --cloud-100: #f4f2ff;
  
  --shadow-strong: 0 30px 60px rgba(32, 16, 77, 0.18);
  --shadow-card: 0 16px 40px rgba(32, 16, 77, 0.12);
  --shadow-float: 0 24px 48px rgba(32, 16, 77, 0.25);
  --shadow-subtle: 0 4px 12px rgba(32, 16, 77, 0.05);
  
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 9999px;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink-950);
  background: 
    radial-gradient(circle at top left, rgba(100, 215, 216, 0.25), transparent 35%),
    radial-gradient(circle at bottom right, rgba(255, 155, 120, 0.15), transparent 40%),
    linear-gradient(135deg, #faf9ff 0%, #f4f2ff 100%);
  background-attachment: fixed;
  overflow: hidden; /* App-like feel, no page scrolling */
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px;
}

/* Header */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  flex-shrink: 0;
}

.logo {
  height: 32px;
  object-fit: contain;
}

.nav-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-pill {
  background: white;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  color: var(--ink-800);
  box-shadow: var(--shadow-subtle);
  display: flex;
  gap: 8px;
  align-items: center;
}

.stat-pill strong {
  font-size: 1.1rem;
  color: var(--ink-900);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  color: var(--ink-800);
  box-shadow: var(--shadow-subtle);
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn-icon:hover, .btn-icon:active {
  transform: scale(1.05);
  background: var(--cloud-100);
}

/* Main Stages */
.main-stage, .summary-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 24px;
  padding-top: 16px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.is-hidden {
  display: none !important;
}

/* Card Area (Top Half) */
.card-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
}

.scenario-card {
  width: 100%;
  max-width: 860px;
  background: linear-gradient(135deg, var(--ink-900), var(--ink-800));
  border-radius: var(--radius-xl);
  padding: 48px;
  color: white;
  text-align: center;
  box-shadow: var(--shadow-card);
  transform: translate3d(var(--card-x, 0px), var(--card-y, 0px), 0) rotate(var(--card-rotate, 0deg));
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  touch-action: none;
  user-select: none;
  cursor: grab;
  position: relative;
  z-index: 10;
}

.scenario-card:active {
  cursor: grabbing;
}

.scenario-card.is-dragging {
  z-index: 50;
  transition: none;
  box-shadow: var(--shadow-float);
}

.drag-handle {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  color: rgba(255, 255, 255, 0.2);
  transition: color 0.2s ease;
}

.scenario-card:hover .drag-handle {
  color: rgba(255, 255, 255, 0.5);
}

.scenario-card:active .drag-handle {
  color: rgba(255, 255, 255, 0.8);
}

.badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.95);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}

.scenario-card h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.15;
  margin: 0 0 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.scenario-context {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 auto;
  max-width: 640px;
}

/* Action Area (Bottom Half) */
.action-area {
  height: 280px;
  flex-shrink: 0;
  position: relative;
}

.zones-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  height: 100%;
}

.drop-zone {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  border: 2px dashed rgba(78, 56, 165, 0.25);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-subtle);
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.drop-zone:hover, .drop-zone:focus-visible {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--violet-300);
  outline: none;
}

body.is-dragging .drop-zone {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--violet-300);
}

body.is-dragging .drop-zone.is-target {
  background: var(--aqua-200);
  border-color: var(--aqua-500);
  border-style: solid;
  transform: scale(1.03);
  box-shadow: 0 12px 24px rgba(100, 215, 216, 0.2);
}

.zone-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.2;
}

.zone-desc {
  font-size: 1rem;
  color: var(--ink-700);
  line-height: 1.4;
}

/* Feedback Panel */
.feedback-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

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

.feedback-content {
  flex: 1;
}

.feedback-title {
  font-size: 1.8rem;
  margin: 0 0 12px;
  color: var(--ink-900);
}

.feedback-body {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--ink-800);
  margin: 0 0 24px;
  max-width: 800px;
}

.takeaway-box {
  background: var(--cloud-100);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--violet-500);
}

.takeaway-label {
  display: block;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--violet-500);
  margin-bottom: 4px;
}

.takeaway-text {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-900);
}

/* Summary Stage */
.summary-stage {
  align-items: center;
  justify-content: center;
}

.summary-card {
  background: white;
  padding: 64px;
  border-radius: var(--radius-xl);
  text-align: center;
  max-width: 600px;
  box-shadow: var(--shadow-card);
}

.summary-title {
  font-size: 3.5rem;
  margin: 0 0 20px;
  color: var(--ink-900);
}

.summary-body {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--ink-800);
  margin: 0 0 40px;
}

/* Buttons */
.btn-primary {
  background: var(--ink-900);
  color: white;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 18px 40px;
  border-radius: var(--radius-pill);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-2px);
  background: var(--ink-800);
  box-shadow: 0 8px 20px rgba(32, 16, 77, 0.2);
}

.btn-large {
  font-size: 1.3rem;
  padding: 20px 48px;
}

/* Responsive constraints */
@media (max-width: 900px) {
  body {
    overflow: auto; /* Allow scrolling on smaller screens */
  }
  
  .app-container {
    height: auto;
    min-height: 100vh;
    padding: 16px;
  }
  
  .action-area {
    height: auto;
  }
  
  .zones-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .feedback-panel {
    position: static;
    flex-direction: column;
    text-align: center;
    padding: 24px;
    gap: 24px;
  }
  
  .scenario-card {
    padding: 32px 20px;
  }
  
  .takeaway-box {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
