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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: #e0e0e0;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.container {
  text-align: center;
  padding: 20px;
  width: 100%;
  max-width: 400px;
}

header {
  margin-bottom: 24px;
}

h1 {
  font-size: 1.8rem;
  font-weight: 600;
  background: linear-gradient(90deg, #f7971e, #ffd200);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.version {
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.compass {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 0 auto 24px;
}

.compass-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #1e1e3a, #12122a);
  box-shadow:
    0 0 30px rgba(247, 151, 30, 0.15),
    inset 0 0 40px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(247, 151, 30, 0.3);
}

.compass-ring span {
  position: absolute;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ccc;
}

.n { top: 12px; left: 50%; transform: translateX(-50%); color: #ff4444; }
.s { bottom: 12px; left: 50%; transform: translateX(-50%); }
.e { right: 14px; top: 50%; transform: translateY(-50%); }
.w { left: 14px; top: 50%; transform: translateY(-50%); }

.tick {
  position: absolute;
  width: 2px;
  background: rgba(255, 255, 255, 0.15);
  transform-origin: bottom center;
  bottom: 50%;
  left: 50%;
  height: 50%;
  margin-left: -1px;
}

.tick-0   { transform: rotate(0deg); }
.tick-45  { transform: rotate(45deg); }
.tick-90  { transform: rotate(90deg); }
.tick-135 { transform: rotate(135deg); }
.tick-180 { transform: rotate(180deg); }
.tick-225 { transform: rotate(225deg); }
.tick-270 { transform: rotate(270deg); }
.tick-315 { transform: rotate(315deg); }

.tick-0::after,
.tick-90::after,
.tick-180::after,
.tick-270::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 18px;
  background: rgba(255, 255, 255, 0.08);
}

.needle {
  position: absolute;
  width: 8px;
  height: 110px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  z-index: 2;
  transition: transform 0.1s ease-out;
}

.needle-north {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 58px solid #f7971e;
  filter: drop-shadow(0 0 6px rgba(247, 151, 30, 0.5));
}

.needle-south {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 52px solid #666;
}

.needle-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd700, #b8860b);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
  z-index: 3;
}

.heading {
  position: absolute;
  bottom: 35px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  font-weight: 300;
  color: #fff;
  letter-spacing: 2px;
  z-index: 4;
  text-shadow: 0 0 20px rgba(247, 151, 30, 0.3);
}

.status {
  margin-bottom: 16px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-text {
  font-size: 0.85rem;
  color: #aaa;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  max-width: 100%;
  line-height: 1.4;
}

.status-text.error {
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.status-text.success {
  color: #51cf66;
  border: 1px solid rgba(81, 207, 102, 0.2);
}

.calibrate-btn {
  background: linear-gradient(135deg, #f7971e, #ffd200);
  border: none;
  color: #1a1a2e;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 32px;
  border-radius: 30px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(247, 151, 30, 0.3);
}

.calibrate-btn:active {
  transform: scale(0.95);
}

.calibrate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 360px) {
  .compass { width: 220px; height: 220px; }
  .heading { font-size: 1.5rem; bottom: 28px; }
}
