* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: #111827;
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app {
  width: min(900px, 92vw);
  text-align: center;
}

h1 {
  margin-bottom: 8px;
  font-size: 42px;
}

.subtitle {
  margin-top: 0;
  color: #cbd5e1;
}

.top-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  flex-wrap: wrap;
}

.stat {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 12px 20px;
  min-width: 110px;
}

.stat span {
  display: block;
  color: #9ca3af;
  font-size: 14px;
  margin-bottom: 4px;
}

.stat strong {
  font-size: 24px;
}

button {
  background: #22c55e;
  color: #052e16;
  border: none;
  padding: 14px 22px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 12px;
  cursor: pointer;
}

button:hover {
  background: #16a34a;
}

#gameArea {
  position: relative;
  height: 500px;
  width: 100%;
  background: #f8fafc;
  border: 3px solid #64748b;
  border-radius: 16px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}

#rectangle {
  position: absolute;
  display: none;
  border: 3px solid #2563eb;
  background: rgba(37, 99, 235, 0.18);
}

.results {
  min-height: 80px;
  margin-top: 20px;
}

#message {
  font-size: 22px;
  font-weight: bold;
}

#dimensions {
  color: #cbd5e1;
}

.hidden {
  display: none;
}

.comparison {
  margin: 24px auto 0;
  padding: 20px;
  max-width: 760px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 16px;
  text-align: left;
}

.comparison h2 {
  margin-top: 0;
  text-align: center;
  font-size: 22px;
}

.line-row {
  display: grid;
  grid-template-columns: 75px 1fr 100px;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.line-label {
  font-weight: bold;
  color: #e5e7eb;
}

.line-track {
  height: 18px;
  background: #111827;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #4b5563;
}

.compare-line {
  height: 100%;
  width: 0;
  border-radius: 999px;
  opacity: 0;
}

.width-line {
  background: #3b82f6;
}

.height-line {
  background: #f97316;
}

.line-value {
  color: #cbd5e1;
  font-family: monospace;
}

#differenceText {
  text-align: center;
  color: #cbd5e1;
  margin-bottom: 0;
}

.floating-line {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
  transform-origin: center;
  will-change: left, top, transform, opacity;
}
  transition:
    left 0.85s ease,
    top 0.85s ease,
    width 0.85s ease,
    height 0.85s ease,
    opacity 0.85s ease,
    transform 0.85s ease;
}

.floating-width {
  background: #3b82f6 !important;
}

.floating-height {
  background: #f97316 !important;
}

.rectangle-fade {
  animation: fadeRectangle 0.35s ease forwards;
}

@keyframes fadeRectangle {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}