:root {
  --bg-primary: #000000; /* 加算式ディスプレイでは純黒=透明 */
  --bg-secondary: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent-primary: #00d4ff;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  width: 600px;
  height: 600px;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
}

/* --- Screens --- */
.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px; /* セーフマージン */
}
.screen.hidden { display: none; }

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  gap: 12px;
  flex-shrink: 0;
}
.header h1 {
  font-size: 22px;
  font-weight: 600;
  flex: 1;
}
.header-meta {
  font-size: 14px;
  color: var(--text-secondary);
}
.header-meta.live { color: var(--accent-primary); }

/* --- Content --- */
.content {
  flex: 1;
  padding: 12px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.compass-content {
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* --- コンパス --- */
.compass-wrap {
  position: relative;
  width: 400px;
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lubber-line {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 18px solid var(--accent-primary);
  z-index: 3;
}
.compass-dial {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 20, 31, 0.9) 55%, #1a1a2e 100%);
  border: 3px solid #2a2a40;
  will-change: transform;
}
.dial-tick {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 10px;
  margin-left: -1px;
  background: var(--text-muted);
  transform-origin: center center;
}
.dial-tick.major {
  width: 3px;
  height: 18px;
  margin-left: -1.5px;
  background: var(--text-secondary);
}
.dial-label {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  margin-left: -30px;
  margin-top: -14px;
  text-align: center;
  font-size: 15px;
  color: var(--text-secondary);
  transform-origin: center center;
}
.dial-label.cardinal {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: -20px;
}
.dial-label.cardinal.north { color: var(--danger); }
.dial-label.intercardinal {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}
.compass-center {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.compass-degrees {
  font-size: 64px;
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.compass-direction {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- つかいかた --- */
.help-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 16px;
  line-height: 1.5;
}
.help-icon {
  font-size: 26px;
  flex-shrink: 0;
}

/* --- Focus states（D-pad操作の要） --- */
.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 44px;
}
.focusable:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}

/* --- Nav bar --- */
.nav-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.nav-item {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
  text-align: center;
}
.nav-item:focus { background: var(--bg-card); }
.nav-item.primary {
  background: var(--accent-primary);
  color: #0a0a0f;
}
.nav-item.primary:focus { background: #33ddff; }

.hidden { display: none !important; }
